DirectShow SetPositions not working
Hi.
I am a beginner with Directshow. I am trying to play specific portion of a given video clip
(say in a 100sec clip I want to play from 20-40 seconds).This is the main portion of the code that I use:
CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC,IID_IGraphBuilder,(LPVOID*)&pGraphBuilder);
pGraphBuilder->QueryInterface(IID_IMediaControl,(LPVOID*)&pMediaControl);
pGraphBuilder->QueryInterface(IID_IMediaEvent,(LPVOID*)&pMediaEvent);
pGraphBuilder->QueryInterface(IID_IMediaSeeking,(LPVOID*)&pMediaSeeking);
double length;
pMediaControl->RenderFile(FILENAME);
IMediaPosition *pMediaPosition;
pGraphBuilder->QueryInterface(IID_IMediaPosition,(LPVOID*)&pMediaPosition);
pMediaPosition->get_Duration(&length);
pGraphBuilder->QueryInterface(IID_IVideoWindow,(LPVOID*)&pVideoWindow);
LONGLONG start=20;
LONGLONG stop=60;
HRESULT hr=pMediaSeeking->SetPositions(&start,AM_SEEKING_AbsolutePositioning,&stop,AM_SEEKING_AbsolutePositioning);
pMediaControl->Run();
I set a breakpoint and check the value of hr which is S_OK.But the video does not play ...only a blank video window shows up.
Can anybody help me with this?
Re: DirectShow SetPositions not working
Did you CheckCapabilities about absolute seeking?
Besides, what is the current time format?
Quote:
IMediaSeeking::SetPositions Method
Parameters
pCurrent [in, out]
[in,out] Pointer to a variable that specifies the current position, in units of the current time format.
Quote:
(say in a 100sec clip I want to play from 20-40 seconds)
Code:
const QWORD QW_SECOND = 10000000;
LONGLONG start = 20 * QW_SECOND;
LONGLONG stop = 60 * QW_SECOND;
Re: DirectShow SetPositions not working
I did check that out.Actually I am using the following graph
Source Filter->AVI mux->File Writer
and perhaps because of the AVI mux the setpositions method of IMediaSeeking returns a E_NOTIMPL.I am confused now how to implement this.