如何使用 WRL 中的可激活类 ID 字符串访问自定义 MFT? [英] How I can access a custom MFT using activatable class ID string inside a WRL?

查看:25
本文介绍了如何使用 WRL 中的可激活类 ID 字符串访问自定义 MFT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

链接演练:使用 WRL 和 Media Foundation 创建 Windows 应用商店应用

提供了自定义 MFT 创建并将其用作可激活类的示例.在 C# 代码中,MFT 是使用可激活的类 ID 字符串引用的,如下所示

provides example of a custom MFT creation and using it as activatable class. Inside C# code the MFT is referenced using activatable class ID string like this

mediaCapture.AddEffectAsync(MediaStreamType.Photo, "GrayscaleTransform.GrayscaleEffect", null);

MediaCapture 知道带有字符串 "GrayscaleTransform.GrayscaleEffect" 的 MFT.MediaCapture 如何仅使用此字符串引用 MFT?

the MediaCapture knows about the MFT with the string "GrayscaleTransform.GrayscaleEffect". How does the MediaCapture reference the MFT only with this string?

我需要知道这个过程,因为我正在做一个需要从图像(使用 WRL)创建视频的项目,我正在关注这个开发 WinRT 组件以创建视频文件使用媒体基金会.但在我将 IMFSample 写入 SinkWriter 之前,我需要它通过自定义的可激活 MFT 类传递它.如果我将可激活类 ID 从 C# 传递给 WRL 类,我是否能够引用自定义 MFT?基本 MFT 处理模型 描述使用 CLSID 引用 MFT.但是是否可以仅使用可激活的 classID 字符串来提取任何 CLSID?

I need to know the process because I am working on a project which requires creating video from images (using WRL) for which i am following this Developing a WinRT component to create a video file using Media Foundation. But before i write IMFSample to SinkWriter I need it to pass it through a custom activatable MFT class. If I pass the activatable class ID from C# to the WRL class will I be able to reference the custom MFT? Basic MFT Processing Model describes referencing an MFT using CLSID. But is it possible to extract any CLSID with just the activatable classID string?

总而言之,如何使用自定义 MFT 来处理 IMFSample 并使用 WRL 中的可激活 classID 字符串?

So to summarize, How can I use a custom MFT to process an IMFSample using the activatable classID string in side a WRL?

推荐答案

我们在 AddEffectAsync 中使用 Windows::Foundation::ActivateInstance 函数来创建 MoCOM 对象的新实例.

We use the Windows::Foundation::ActivateInstance function inside AddEffectAsync to create a new instance of the MoCOM object.

由于您想在 Media Foundation 拓扑之外使用 MFT,您需要对其进行配置以处理数据.这从获取流标识符、设置媒体类型和获取缓冲区要求开始.正确设置 MFT 后,您就可以开始处理样品了.

Since you want to use the MFT outside of a Media Foundation topology you will need to configure it to process the data. This starts with getting the stream identifiers, setting the media types and getting the buffer requirements. Once the MFT is properly setup you can then start processing the samples.

顺便说一句,MFT 专门设计为与框架无关.回到 DirectShow 时代,没有简单的方法可以在过滤器图形之外使用 DirectShow 过滤器.我们专门设计了 MFT 架构(基于源自 DSound 团队的 DMO 技术),使其易于设置和独立于拓扑管理器使用.

As an aside MFTs are specifically designed to be framework agnostic. Back in the DirectShow days there was no easy way to use DirectShow filters outside of the filter-graph. We specifically designed the MFT architecture (based on DMO technology that originated on the DSound team) to make them easy to setup and use independently of a topology manager.

激活实例函数

基本 MFT 处理模型

我希望这会有所帮助,

詹姆斯

这篇关于如何使用 WRL 中的可激活类 ID 字符串访问自定义 MFT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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