June 3rd, 2010, 10:38 AM
#1
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?
June 5th, 2010, 02:52 AM
#2
Re: DirectShow SetPositions not working
Did you CheckCapabilities about absolute seeking?
Besides, what is the current time format?
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 .
(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;
Last edited by Igor Vartanov; June 5th, 2010 at 02:58 AM .
June 14th, 2010, 07:39 PM
#3
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.
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks