DirectShow: how to play an interval of frames from an AVI
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.
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:
*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...
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...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement