|
-
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?
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
|