- Online Community Forums » Programming Questions » APEG Library

This thread is locked; no one can reply to it. rss feed Print
APEG Library
Member #7,400
June 2006

Hi, this is the code that i use for play video in my program, but the video appears in his original size, how can i do for format the size to 800x600???? and other question... how can i detect the end of the video??? thanks...

int playvideo(char video[])
     apeg_play_mpg(video, screen,0,NULL);
     return 0;

Kitty Cat
Member #2,815
October 2002

One option is to setup a callback:

int my_callback()
      return 1;

   stretch_blit(apeg_stream->bitmap, screen, 0, 0, apeg_stream->w, apeg_stream->h, 0, 0, 800, 600);
   return 0;

And pass NULL for the target bitmap for apeg_play_mpg. Another option would be to use the manual-advance functions:

APEG_STREAM *stream = apeg_open_stream(video);
while(apeg_advance_stream(stream, FALSE) == APEG_OK)
   if(stream->frame_updated > 0)
      stretch_blit(stream->bitmap, screen, 0, 0, stream->w, stream->h, 0, 0, 800, 600);
   else if(stream->frame_updated == 0)

To detect the end of the stream, you'll have to do the latter method and check apeg_advance_stream's return value for APEG_EOF (note that it may also return APEG_ERROR, which also means you should stop playing).

"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Go to: