Example #1
0
int apeg_play_apeg_stream(APEG_STREAM *stream_to_play, BITMAP *bmp, int loop, int (*callback)(BITMAP*tempBuffer))
{
	int ret = APEG_OK;
  apeg_stream = stream_to_play;

	Initialize_Decoder();

	if(bmp)
		clear_to_color(bmp, makecol(0, 0, 0));

	// Install the callback function
	if(callback)
		callback_proc = callback;
	else
		callback_proc = default_callback;

restart_loop:
	ret = decode_stream((APEG_LAYER*)apeg_stream, bmp);
	if(loop && ret == APEG_OK)
	{
		apeg_reset_stream(apeg_stream);
		goto restart_loop;
	}

	apeg_stream = NULL;

	return ret;
}
Example #2
0
int apeg_play_mpg_ex(void *ptr, BITMAP *bmp, int loop, int (*callback)(BITMAP*))
{
	int ret;

	Initialize_Decoder();

	apeg_stream = apeg_open_stream_ex(ptr);
	if(!apeg_stream)
		return APEG_ERROR;

	if(bmp)
		clear_to_color(bmp, makecol(0, 0, 0));

	if(callback)
		callback_proc = callback;
	else
		callback_proc = default_callback;

restart_loop:
	ret = decode_stream((APEG_LAYER*)apeg_stream, bmp);
	if(loop && ret == APEG_OK)
	{
		apeg_reset_stream(apeg_stream);
		goto restart_loop;
	}

	apeg_close_stream(apeg_stream);
	apeg_stream = NULL;

	return ret;
}
Example #3
0
int main(int argc, char *argv[])
{
    /* local variables */
    raw_t   *raw;
    socket_t sock;
    unsigned char buff[4096];
    int recvnum, i;


    /* initialise raw */
    raw = (raw_t *)malloc(sizeof(raw_t));
    if (0 == init_raw(raw))
    {
        trace(0, "%s\n\n", "ERROR: memory allocation error!");
        return 0;
    }
    strcpy(raw->opt, "-LE");    /* the file type is set to LITTLE_ENDIAN */
    raw->outtype    = 1;        /* set to output message type id */

    /* initialize socket */
    sock = creat_client_socket("192.168.3.108", 50000);
    if(sock < 0) {
        printf("sock error\n");
        exit(0);
    }

    /* main loop */
    while(1) {
        memset(buff, 0x00, sizeof(buff));
        recvnum = recv(sock, (char*)buff, 4000, 0);
#ifdef WIN32_
        Sleep(1000);
#endif
        decode_stream(raw, buff, recvnum);
    }

    /* clear */
    free_raw(raw);
    close_client_socket(sock);
}