Jump to content
  • Advertisement
Sign in to follow this  
Mari_p

DirectShow: how to play an interval of frames from an AVI

This topic is 4996 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I already worked with Direct3D, but I don't have experience in DirectShow. I would like to play (using DirectShow) intervals of a movie (avi). I used some time functions from DirectShow: put_CurrentPosition and WaitForCompletion. They works, but not perfectly, because the video may not run smoothly. Suppose, for example, that the avi has 1000 frames... How could I play EXACTLY the frames contained in interval [235, 612]? Is there some function like "put frame" instead put_CurrentPosition? Please, could somebody help me? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
This is in C++, right?

Instead of using the IMediaPosition interface, you can use the IMediaSeeking interface. The three functions you would probably want are SetTimeFormat(), SetPositions(), and GetPositions(). To start at a certain location, use something similar to the following:

void PlaySegment(LONGLONG StartFrame, LONGLONG StopFrame)
{
pMediaSeeking->SetTimeFormat(&TIME_FORMAT_FRAME);
pMediaSeeking->SetPositions(&Frame, AM_SEEKING_AbsolutePositioning, &StopFrame, AM_SEEKING_AbsolutePositioning);
}


*Note that I just realized that you can set the stop time as well. I had previously overlooked that feature, since I had previously not needed it, so I personally have not tried it. But it looks like it'll do what you want, and I might look into using it as well...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!