如何使用IMFMediaEngine接口从磁盘加载视频? [英] How to load the video from the disk using IMFMediaEngine interface ?

查看:94
本文介绍了如何使用IMFMediaEngine接口从磁盘加载视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用
IMFMediaEngine-> Load()
方法,我们需要从磁盘文件中读取视频。你可以帮我看看如何在不使用UWP API的情况下从磁盘读取它 - 我可以使用UWF文件流类。使用UWP的示例代码低于 -  

I am trying to use IMFMediaEngine->Load() method, for that we need to read video from the disk file. Can you please help me on how to read it from the disk without using UWP APIs - I am able to do with UWF File Stream class. The Sample code using UWP is below - 

HRESULT hr = S_OK;
ComPtr<IMFByteStream> spMFByteStream = nullptr;
hr = MFCreateMFByteStreamOnStreamEx((IUnknown*)streamHandle, &spMFByteStream);
hr = m_mediaEngineEx->SetSourceFromByteStream(spMFByteStream.Get(), m_bstrURL))
            


我想我需要使用IMFByteStream接口,然后使用
MFBeginCreateFunction
。但不确定如何实现它。

I think I need to Use IMFByteStream Interface, then use MFBeginCreateFunction. But not sure entirely how to implement it.

注意:我无法为此问题找到合适的类别。技术上说它应该属于Media Foundation Programming Interfaces。

Note: I couldn't able to find a suitable category for this question. Technically Speaking it should belong Media Foundation Programming Interfaces.

推荐答案

您好AjayRamesh,

Hi AjayRamesh,

感谢您在此发布。

>>我想我需要使用IMFByteStream接口,然后使用  MFBeginCreateFunction。但不确定如何实现它。

注意:我无法找到合适的类别对于这个问题。技术上说它应该属于Media Foundation Programming Interfaces。

当MFBeginCreateFile请求完成时,将调用回调对象的IMFAsyncCallback :: Invoke方法。然后回调对象应该调用MFEndCreateFile函数来获取指向字节流的指针。

When the MFBeginCreateFile request is completed, the callback object's IMFAsyncCallback::Invoke method is called. The callback object should then call the MFEndCreateFile function to get a pointer to the byte stream.

以下是一些指南和示例供您参考。

Here are some guides and samples for you as a reference.

https:/ /msdn.microsoft.com/en-us/library/windows/desktop/aa371827%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

https://msdn.microsoft.com/en -us / library / windows / desktop / ms697062(v = vs.85).aspx

希望这可以为您提供帮助。

Hope this could be help of you.

最诚挚的问候,

Baron Bi

Baron Bi


这篇关于如何使用IMFMediaEngine接口从磁盘加载视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆