locked
MFCreateSourceReaderFromByteStream return 0xc00d36c4 for extended video format

    Question

  • Hello:

        I'm writting code about extended video playback with video format(.rm). Playback is okay but it will fail(hr=0xc00d36c4) when call MFCreateSourceReaderFromByteStream to get the video thumbnail

        // Register custom ByteStreamHandler and custom decoder.
         m_extensions = ref new MediaExtensionManager();

         m_extensions->RegisterByteStreamHandler("Test.RMByteStreamHandler", ".rm", "video/testrm");
         m_extensions->RegisterAudioDecoder("Test.RADecoder", Guid(MEDIASUBTYPE_RA), Guid(GUID_NULL));
          m_extensions->RegisterVideoDecoder("Test.RVDecoder", Guid(MEDIASUBTYPE_RV), Guid(GUID_NULL));

         ......

      task<StorageFile^>(StorageFile::GetFileFromPathAsync(Path)).then([this](StorageFile^ file) -> IAsyncOperation<IRandomAccessStream^>^
      {
          return file->OpenAsync(FileAccessMode::Read);
      }).then([this,bManual](IRandomAccessStream^ strm)
      {

            //Playback

           VideoElement->SetSource(strm,"video/testrm");

            //Try to get the video thumbnail by MF SourceReader

           MFStartup(MF_VERSION);

        //First Get IMFSourceReader

        IMFSourceReader*  pMFSourceReader = NULL;
        UINT32  nWidth = 0, nHeight = 0;
        UINT32  nAspectX = 0, nAspectY = 0;
        LONGLONG llDuration = 0;
        HRESULT   hr = S_OK;
           //Get IMFSourceReader
           IRandomAccessStream ^pStream = strm;
           IMFByteStream*  pMFByteStream = NULL;

          hr = MFCreateMFByteStreamOnStreamEx((IUnknown*)pStream, &pMFByteStream);
          IMFAttributes  *pAttr = NULL;
          hr = pMFByteStream->QueryInterface(__uuidof(IMFAttributes),(void**)&pAttr);
          if (pAttr)
          {
               hr = pAttr->SetString(MF_BYTESTREAM_CONTENT_TYPE,L"video/testrm");
          }
          IMFAttributes  *pAttr = NULL;
         MFCreateAttributes(&pAttr,1);
         hr = pAttr->SetUINT32(MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING,true);
         hr = MFCreateSourceReaderFromByteStream(pMFByteStream,pAttr,&pMFSourceReader);//Now it will fail with  0xc00d36c4

       }
      });

       My Questions:

       1.How to create SourceReader for extended video source?

       2.How to get the thumbnai for extended video format?

    Best Wishes,

    Xinhua

    Tuesday, July 3, 2012 2:51 AM

All replies

  • Xinhua,

    Is this link helpful:  http://msdn.microsoft.com/en-us/library/aa371872.aspx

    Best Wishes - Eric

    Wednesday, July 4, 2012 1:08 AM
    Moderator
  • Eric:

    You link is for Microsoft Media Foundation.

    I'm writting metro codec on W8 8400.It will succeed when call MFCreateSourceReaderFromByteStream if the video file is system suppprted.But it will fail(hr= 0xc00d36c4) if the video file is system no suppprted even if I register it by call RegisterByteStreamHandler("Test.RMByteStreamHandler", ".rm", "video/testrm");

    My question is:

    1.if the WRT API (registerByteStreamHandler) is useless when call Win32 API(MFCreateSourceReaderFromByteStream)?

    2.If so,what's the resolution to get the video thumbnail for extended video format on metro APP?

    Thanks,

    Wednesday, July 4, 2012 2:21 AM