How to get output render format from the SourceReader RRS feed

  • Question

  • Hi,

    I'm working on a video player using the IMFSourceReader. I use IDirect3D9 to render video frames. I was earlier creating and initializing D3D and creating render surfaces, assuming the decoded video would be of type D3DFMT_YUY2. This format worked well with most of the videos until I came across videos with other color format (eg NV12).

    How can I query the SourceReader, for the decoded format which I get as output on every 'ReadSample' for video frames? The 'sample' I get, is and IMFSample, does not seem to carry this information either.

    I checked GetCurrentMediaType/GetNativeMediaType on the SourceReader, but it gives the format for the encoded streams.

    I feel I'm missing something trivial but I can't seem to get hold of it.



    • Edited by mots_g Friday, February 10, 2012 1:33 PM
    Friday, February 10, 2012 1:26 PM

All replies

  • I am a little confused -- are you ever setting a media type on the source reader?  Normally the source reader outputs compressed samples directly from the media source (the 'native' media type) and if you want uncompressed samples you have to set an uncompressed format on the source reader.  Are you setting a YUY2 format and getting NV12 samples?  In theory this should never happen, you would get an error trying to set the YUY2 format and would need to set a different format.

    Only a limited number of color conversions are supported by the source reader.  If you want to convert to a color format that the source reader will not output, you would need to use the color converter DSP manually.

    Tuesday, March 20, 2012 12:32 AM