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