Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/128.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 利用媒体基础生成即时消费数据 我试图通过使用内存流作为源流,将动态生成的数据馈送到媒体基础源读取器: InMemoryRandomAccessStream^ memstream = ref new InMemoryRandomAccessStream(); IRandomAccessStream^ pInputStream = (IRandomAccessStream^)memstream; ComPtr<IMFByteStream> pInputByteStream; MFCreateMFByteStreamOnStreamEx((IUnknown*)pInputStream, &pInputByteStream); hr = MFCreateSourceReaderFromByteStream(pInputByteStream.Get(), NULL, &m_pSourceReader); // last line FAILS, “The handle is invalid.” InMemoryRandomAccessStream^memstream=ref new InMemoryRandomAccessStream(); irandomaccesstream^ pInputStream=(irandomaccesstream^)memstream; ComPtr pInputByteStream; MFCreateMfByTestStreamOnStreamex((IUnknown*)pInputStream和PinputByTestStream); hr=MFCreateSourceReaderFrombyTestStream(pInputByteStream.Get(),NULL,&m_pSourceReader); //最后一行失败,“句柄无效。”_C++_Windows_Ms Media Foundation - Fatal编程技术网

C++ 利用媒体基础生成即时消费数据 我试图通过使用内存流作为源流,将动态生成的数据馈送到媒体基础源读取器: InMemoryRandomAccessStream^ memstream = ref new InMemoryRandomAccessStream(); IRandomAccessStream^ pInputStream = (IRandomAccessStream^)memstream; ComPtr<IMFByteStream> pInputByteStream; MFCreateMFByteStreamOnStreamEx((IUnknown*)pInputStream, &pInputByteStream); hr = MFCreateSourceReaderFromByteStream(pInputByteStream.Get(), NULL, &m_pSourceReader); // last line FAILS, “The handle is invalid.” InMemoryRandomAccessStream^memstream=ref new InMemoryRandomAccessStream(); irandomaccesstream^ pInputStream=(irandomaccesstream^)memstream; ComPtr pInputByteStream; MFCreateMfByTestStreamOnStreamex((IUnknown*)pInputStream和PinputByTestStream); hr=MFCreateSourceReaderFrombyTestStream(pInputByteStream.Get(),NULL,&m_pSourceReader); //最后一行失败,“句柄无效。”

C++ 利用媒体基础生成即时消费数据 我试图通过使用内存流作为源流,将动态生成的数据馈送到媒体基础源读取器: InMemoryRandomAccessStream^ memstream = ref new InMemoryRandomAccessStream(); IRandomAccessStream^ pInputStream = (IRandomAccessStream^)memstream; ComPtr<IMFByteStream> pInputByteStream; MFCreateMFByteStreamOnStreamEx((IUnknown*)pInputStream, &pInputByteStream); hr = MFCreateSourceReaderFromByteStream(pInputByteStream.Get(), NULL, &m_pSourceReader); // last line FAILS, “The handle is invalid.” InMemoryRandomAccessStream^memstream=ref new InMemoryRandomAccessStream(); irandomaccesstream^ pInputStream=(irandomaccesstream^)memstream; ComPtr pInputByteStream; MFCreateMfByTestStreamOnStreamex((IUnknown*)pInputStream和PinputByTestStream); hr=MFCreateSourceReaderFrombyTestStream(pInputByteStream.Get(),NULL,&m_pSourceReader); //最后一行失败,“句柄无效。”,c++,windows,ms-media-foundation,C++,Windows,Ms Media Foundation,然而,我被上面的错误所困扰。为什么这是无效的,我如何纠正它?或者,有更好的方法来创建一个具有动态数据的媒体基础管道吗? < P>这是为我工作的: void MyClass::Init(Windows::Storage::Streams::IRandomAccessStream^ stream) { ComPtr<IUnknown> pStreamUnk = reinterpret_cast<IUnknown*>(stream); ComPtr<IMF

然而,我被上面的错误所困扰。为什么这是无效的,我如何纠正它?或者,有更好的方法来创建一个具有动态数据的媒体基础管道吗?

< P>这是为我工作的:

void MyClass::Init(Windows::Storage::Streams::IRandomAccessStream^ stream)
{
    ComPtr<IUnknown> pStreamUnk = reinterpret_cast<IUnknown*>(stream);
    ComPtr<IMFByteStream> pMFStream;
    hr = ::MFCreateMFByteStreamOnStreamEx(pStreamUnk.Get(), &pMFStream);

    hr = ::MFCreateSourceReaderFromByteStream(pMFStream.Get(), NULL, &m_pSourceReader);
}
void MyClass::Init(Windows::Storage::Streams::irandomaccesstream^stream)
{
ComPtr pStreamUnk=重新解释铸件(流);
ComPtr-pMFStream;
hr=::MFCreateMFByteStreamOnStreamEx(pStreamUnk.Get(),&pMFStream);
hr=::MFCreateSourceReaderFrombyTestStream(pMFStream.Get(),NULL,&m_pSourceReader);
}
但这是一个文件流。 对于您的情况,内存流可能没有管道所需的所有数据

更好的解决方案是实现媒体源。查看(GeometricsSource和Mpeg1Source)