Direct Show Looping?

Started by
-1 comments, last by Muzzy A 11 years, 10 months ago
I'm still working on a game for school, and we're using direct show, but we can't get it to replay the video correctly. The only way we can figure out how to get it to loop is call IMediaControl::Render("video.wmv"). The problem with that is it opens up an entirely new window and plays the video in full resolution.

I know how to check if a video has completed it's duration, but how do I make it restart from the beginning without a new window?

I can't find anything useful on the web, or maybe im just overlooking something I dont know.


IGraphBuilder *pGraph;
IMediaControl *pControl;
IMediaEvent *pEvent;

pGraph->RenderFile(L"video.wmv");

pControl->Run();

while(true)
{
pEvent->GetEvent(&evCode,&param1,&param2,0);

switch(evCode)
{
case EC_COMPLETE:
// Restart
pControl->Stop();

// Right here i want to tell it to restart from beginning
pControl->RenderFile(L"video.wmv"); // <- Opens new window
pGraph-> RenderFile(L"video.wmv"); // <- As does this

// I'm guessing that i need to use filters somehow, but i have no clue where to begin with it
break;
}

pEvent->FreeEventParams(evCode,param1,param2);
}



any help would be appreciated =)

This topic is closed to new replies.

Advertisement