PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Playing video file

Hi! I'm trying to play video file using this code (I'll show part of it here)

Code:
HRESULT InitialApplication::onNextFrame(Surface* pBackBuffer)
{
if (gamestate == 2)
{
if(introvideo.open(TEXT("new.mpg"))==ReturnCode::OK){
HRESULT hr = introvideo.getNextFrame(&videosurface;);
switch(hr){
case ReturnCode::OK:
//blit the image to the screen
pBackBuffer->bltFast(0, 0, &videosurface;);
frame++;
break;
case ReturnCode::END_OF_VIDEO:
//Video is over
gamestate = 0;
break;
default:
shutdown();
break;
}
}

But all I can see on screen is the first frame of video. The NextFrame method works fine and it loops throught all file, but no results are shown on screen. I did mencode video before use and tryed to adapt flip() method here, but with no luck. What kind of mistake had I made?
Hi Ryumaster,
The problem is that you are reopening the video on each frame.


This call:

Code:
introvideo.open(TEXT("new.mpg"))


must be done only once, on the onInit() event handler method.

Best regards,
Sergio.
Oh! Yes, thank you, I think I'll go and get some rest :)