Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Unable to set IMediaSeeking::SetTimeFormat to TIME_FORMAT_FRAME

Nelrum
2013-06-19
2013-06-22
  • Nelrum
    Nelrum
    2013-06-19

    Greetings.

    I'm trying to get duration and position of video file as frames instead of default nano seconds but I'm unable to do so due to exception I'm getting when using IMediaSeeking::SetTimeFormat function.
    Sample of the code I'm using:

    pGraph = (IGraphBuilder)new FilterGraph();
    pMediaSeek = (IMediaSeeking)pGraph;            
    
    BuildGraph(pGraph, vFile, _videoSurface); 
    
    // Get the seeking capabilities.
    int hr = pMediaSeek.GetCapabilities(out m_seekCaps);
    DsError.ThrowExceptionForHR(hr);
    
    int thr = pMediaSeek.SetTimeFormat(TimeFormat.Frame);
    DsError.ThrowExceptionForHR(thr);   // Here I'm getting an exception
                        // thr value is '-2147467259'
    

    At the same time if I set TimeFormat to TIME_FORMAT_NONE or TIME_FORMAT_MEDIA_TIME it will work without an problems.
    What might cause such exception?

     
    Last edit: Nelrum 2013-06-19
  • Nelrum
    Nelrum
    2013-06-20

    Hm. I tried validating it. It returns 1 for TIME_FORMAT_FRAME. Where can I find a dictionary or any reference of those return codes?

     
  • snarfle
    snarfle
    2013-06-20

    On the link eric provided. If you don't know the numeric values for S_FALSE or S_OK, there's always google: http://msdn.microsoft.com/en-us/library/windows/desktop/ff485842%28v=vs.85%29.aspx

     
    • Eric
      Eric
      2013-06-22

      On the DXSDK, there is also an handy tool called DirectX Error Lookup (dxerr.exe).
      It translate a COM error code into a human readable form.