CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2010
    Posts
    5

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

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    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.
    Time Format GUIDs
    TIME_FORMAT_MEDIA_TIME Reference time (100-nanosecond units).
    (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.
    Best regards,
    Igor

  3. #3
    Join Date
    Jun 2010
    Posts
    5

    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
  •  





Click Here to Expand Forum to Full Width

Featured