|
|
|
date: Sun, 22 Jun 2008 15:27:48 -0700 (PDT),
group: microsoft.public.win32.programmer.directx.sdk
back
Precise control of playback position
I have a DirectShow application where I maintain a clock externally,
and I need to sync video to this clock. The external clock may not be
wall clock time; it might be going faster, it might be going slower,
all my application knows is that it's being fed timestamps in strictly
increasing order and must sync video playback to that timestamp each
frame.
My graph is currently set up with some input filter eventually leading
to an ISampleGrabber. I've been able to achieve what I want, for the
most part, using IMediaPosition:: put_CurrentPostion before getting
each frame via ISampleGrabber::GetCurrentBuffer -- although it's not
perfect. What is the best way to do this?
There are a couple of reasons why my current method isn't any good:
1) Not all codecs seem to support seeking this way.
2) DirectShow seems to create a background thread that's always
decoding, and everything happens asynchronously, and so it's not
necessarily true that the GetCurrentBuffer() call actually does get me
the frame at the precise timestamp I asked for.
3) DirectShow's background thread is always decoding stuff -- and
usually that means it's working on decoding frames that I don't care
about, since I'm going to use put_CurrentPosition every time anyway.
I'd like to not waste CPU here, and just have it decode frames on-
demand.
I don't need to worry about playing videos backwards, which may
simplify things.
Any advice is welcome,
Thanks,
Jason
date: Sun, 22 Jun 2008 15:27:48 -0700 (PDT)
author: unknown
|
|