IMFByteStream QueryInterface to get IMFAttributes

654 views Asked by At

I wanted to open a video file using IMFSourceResolver but it returned The Byte Stream Type of the Given URL is unsupported. What I did is that open the video to get IRandomAccessStream, convert it to IMFByteStream and use CreateObjectFromByteStream() to get the IMFMediaSource.

According to this link CreateObjectFromByteStream it says if MF_E_UNSUPPORTED_BYTESTREAM_TYPE is returned Specify the MIME type by setting the MF_BYTESTREAM_CONTENT_TYPE attribute on the byte stream. This link for MF_BYTESTREAM_CONTENT_TYPE says To get the attribute value, query the byte stream object for the IMFAttributes interface. But I could not figure it out how to do that.

Is it possible to get IMFAttribute interface from IMFByteStream? If so how? And what should the values MF_BYTESTREAM_CONTENT_TYPE?

1

There are 1 answers

1
Anton Angelov On BEST ANSWER

From MSDN (http://msdn.microsoft.com/en-us/library/windows/desktop/aa374773%28v=vs.85%29.aspx)

To find out whether a byte stream supports attributes, query the byte stream object for the IMFAttributes interface.

According to this info, some byte-streams support IMFAttributes, others don't. If you query your IMFByteStream for IMFAttributes and it returns E_NOINTERFACE this will mean that yours doesn't.