在DirectShow之外使用DirectShow过滤器? [英] Using DirectShow filters outside DirectShow?

查看:121
本文介绍了在DirectShow之外使用DirectShow过滤器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在与Windows Media Foundation打交道.但是,由于Microsoft H.264解码器存在一些问题,并且缺少一些自定义格式的解码器,我想知道是否有可能直接使用CLSID实例化DirectShow解码器,并围绕它构建一个代理来暴露IMFTransform获得Media Foundation的解码器.所以这是我的问题:

我可以直接实例化Directshow过滤器(最好是解码器)并将其用于解码(即放置一些压缩帧并获得未压缩的帧)以创建MFT吗?

我知道如何使用其CLSID实例化过滤器本身.但是,我不知道如何使用实际的解码功能.

任何想法,提示,链接将不胜感激.谢谢,

J.

解决方案

(免责声明:我从未真正做到这一点,但是我认为没有技术原因无法做到这一点.所以YMMV)

如果解码器是DMO过滤器,那么会容易得多-您可以通过 IMediaBuffer .但这是一个非常基本的界面,因此我认为您在实现它方面不会有太多麻烦.这是基本实现. >

对于常规的DirectShow过滤器,实际上要困难得多,因为大多数DirectShow过滤器实际上取决于是否有可用的外部图形(例如:所有的DirectShow事件类型都假定该图形存在) .如果您真的想单独使用一个DShow过滤器,则可能需要包装整个过滤器图,然后使用一个自定义源过滤器来馈送样本.您可以使用样本采集器(或一个自定义渲染过滤器)来将样本从图表中抽出并暴露给应用程序的其余部分. (一种疯狂的想法甚至是将此图包装在DMO过滤器实现中,然后使用IMediaObject与之对话-但是,这可能很棘手)

幸运的是,大多数解码器往往被实现为DMO过滤器,因此我认为很可能只使用IMediaObject.

I'm currently dealing with Windows Media Foundation. However, due to some problems with the Microsoft H.264 decoder and some missing decoders for custom format, I'd like to know if it would be possible to instantiate a DirectShow Decoder directly using CLSID, and build a proxy around it that exposes IMFTransform to get a decoder for Media Foundation. So here is my question:

Can i instantiate a Directshow filter (preferrably decoders) directly and use them for decoding (i.e. put some compressed frames and get uncompressed ones) to create a MFT?

I know how to instantiate the filter itself using its CLSID. However, I have no clue how to use the actual decoding functionality.

Any ideas, hints, links whatever will be appreciated. Thanks,

J.

解决方案

(disclaimer: I have never actually done this, but I see no technical reason it cannot be done. So YMMV)

If the decoder is a DMO filter, then it'll be a lot easier--you can talk to it through IMediaObject. This isn't really much different from how DirectShow uses DMOs; it simply wraps the DMO with another transform filter that handles the media type negotiation and sample passing, but there's nothing really stopping you from doing this in your own application.

There's one catch: for IMediaObject::ProcessInput and IMediaObject::ProcessOutput, you'll need your own buffer class that implements IMediaBuffer. But it's a pretty basic interface, so I don't think you'll have too much trouble implementing it. Here's a basic implementation.

For regular directshow filters, it's actually going to be a lot more difficult, because most DirectShow filters really depend on there being an external graph available (case in point: all of the directshow eventing sort of presumes the existence of this graph). If you really want to use a single DShow filter standalone, you'd probably have to wrap the entire filter graph, and then have a custom source filter to feed samples in. You could use the sample grabber (or a custom render filter) to yank samples out of the graph and expose to the rest of the application. (one sort of crazy idea would even be to wrap this graph in a DMO filter implementation, and then use IMediaObject to talk to it--this might be tricky, however)

Luckily most decoders tend to be implemented as DMO filters, so I think there's a strong likelihood that you can just use IMediaObject.

这篇关于在DirectShow之外使用DirectShow过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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