DirectShow 的自定义 TS 多文件源过滤器

发布于 2024-11-02 06:34:33 字数 333 浏览 2 评论 0原文

我在编写自定义 DS 源过滤器来播放转储到多个文件的 TS 流时遇到问题。 [编辑:重点是从这些单独的文件中重新播放连续流]

首先,我尝试修改异步文件示例:不行 - 数据“拉”模型似乎将所有控制逻辑放在分离器过滤器中,因此我无法不要欺骗它相信我有一个“连续”的流。

然后尝试修改 PushSource 桌面示例:看来我们必须以这种方式照顾 MPEG 解复用器来创建其输出引脚,自己解析数据以获取 ID 等。我设法让 GraphStudio 自动连接一些东西(使用奇怪的 DTV) -DVD 解码器),但尽管源过滤器将正确的数据推送到下游,但它不会播放任何内容。

有没有人在这方面有经验可以提供帮助/建议?

I'm having problems writing a custom DS source filter to play a TS stream that was dumped to multiple files. [ed: The point being to re-play a continuous stream from these separate files]

First I tried modifying the Async file sample: no go - the data 'pull' model seems to put all the controlling logic in the splitter filter so I couldn't trick it into believing I have a 'continuous' stream.

So then tried modifying the PushSource desktop sample: it appears we have to babysit the MPEG demuxer this way to create its output pin, parsing data myself to get IDs etc. I managed to get GraphStudio to auto-wire up something (using a strange DTV-DVD decoder) but it doesn't play anything despite the source filter pushing the right data downstream.

Does anyone have experience in this area to help/suggest anything?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

娇纵 2024-11-09 06:34:33

您现在找到解决问题的方法了吗?

我正在编写一个类似的 DirectShow 过滤器,目前仅用于播放一个文件,但我认为修改它以播放多个文件应该不是问题。

我从“推送源位图”过滤器开始构建了这个过滤器,但我必须对其进行大量更改。

我还必须使用我编写的应用程序构建图表(因此不使用GraphEdit),将“Mpeg-2 De多路复用器”连接到新过滤器,添加一个 < strong>PSI 输出(映射到 PID 0 = PAT)和连接到的“MPEG-2 部分和表过滤器”这个PSI输出。

之后,我使用“MPEG-2 部分和表过滤器”来读取PAT 表以及其中定义的PMT PID。接下来,我还将所有 PMT PID 映射到相同的“MPEG-2 部分和表过滤器”,并解析了 PMT 表以了解基本流PID和媒体类型,接下来我根据这些信息创建了一个视频输出和一个音频输出(可能有多个音频+视频流,但在当前步骤中我只保留了第一个)。请注意,这需要暂时运行部分图以便能够解析表,然后停止它以便能够创建视频和音频输出引脚(具有正确的媒体类型)并连接解码器和渲染器。

除此之外,我还有一个您可能会感兴趣的信息:似乎在连接时,“Mpeg-2 解复用器”会在图形中搜索公开“IBDA_NetworkProvider< /strong>”接口,如果找到,它会使用 IBDA_NetworkProvider::RegisterDeviceFilter 方法将自身注册到该接口。

我认为您可以使用它来检测“Mpeg-2 De多路复用器”过滤器插入图表中的情况(通过从过滤器中公开“IBDA_NetworkProvider”接口),然后尝试从您的源过滤器中进行上述操作,从而允许在GraphEdit中使用您的过滤器,并期望“Mpeg-2解复用器”从此过滤器中进行婴儿监护,而无需担心构建一个应用程序来执行这些操作。

银杏

Have you found a solution to your problem, now?

I am writing a similar DirectShow filter, currently for playing only one file, but I think that modifying it for playing several files should not be a problem.

I built this filter starting from the "Push Source Bitmap" filter, but I had to make a lot of changes on it.

I also had to build the graph using an application that I wrote (so not using GraphEdit), connect the "Mpeg-2 Demultiplexer" to the new filter, add one PSI output (mapped to PID 0 = PAT) and the "MPEG-2 Sections and Tables Filter" connected to this PSI output.

After that, I used the "MPEG-2 Sections and Tables Filter" for reading the PAT table and the PMT PIDs defined inside it. Next, I mapped also all PMT PIDs to the same "MPEG-2 Sections and Tables Filter", and I parsed the PMT tables for knowing Elementary Streams PIDs and media types, and next I created one video output and one audio output based on these informations (there may be more than one audio + video streams, but at the current step I retain only the first one). Note that this needs to run the partial graph temporarily in order to be able to parse tables, and after to stop it in order to be able to create the video and audio output pins (with the proper media types) and connect decoders and renderers.

In addition to that, I have an information that I you could find interesting: it appears that when connected, the "Mpeg-2 Demultiplexer" searchs the graph for a filter exposing the "IBDA_NetworkProvider" interface, and if found, it registers itself to it using the IBDA_NetworkProvider::RegisterDeviceFilter method.

I think that you could use this for detecting the "Mpeg-2 Demultiplexer" filter insertion into the graph (by exposing the "IBDA_NetworkProvider" interface from your filter), and try to make the above operations from your source filter, thus allowing to use your filter inside GraphEdit and expect the "Mpeg-2 Demultiplexer" to be baby-sat from this filter without worrying to build an application around for doing these operations.

Gingko

微暖i 2024-11-09 06:34:33

我创建了一个读取网络流的 TS 源过滤器。所以这也是连续的,但与从文件读取的区别在于,网络流会自动为我提供正确的速度。所以我认为你应该能够使用类似的方法。

我的过滤器基于 de dx sdk 中的 FBall 示例。

该过滤器派生自CSourceIFileSourceFilterIAMFilterMiscFlagsISpecifyPropertyPages。输出引脚仅源自CSourceStream

如果您在解码音频/视频时遇到问题,也许首先尝试简单的 mpeg-2 流,例如来自 DVB 源的流。并确保您安装了解码器并且它接受该格式。 (例如 ffdshow 默认情况下关闭 mpeg2 解码)。

I created a TS source filter which reads a network stream. So that is continuous too, but I difference to reading from a file is, that a network stream automatically gives me the correct speed. So I think you should be able to use a similar approach.

I have based my filter on the FBall example from de dx sdk.

The filter derives from CSource, IFileSourceFilter, IAMFilterMiscFlags and ISpecifyPropertyPages. The output pin derives just from CSourceStream.

If you have problems decoding the audio/video, maybe first try a simple mpeg-2 stream, for example from a DVB source. And make sure you have a decoder installed and it accepts that format. (for example ffdshow has mpeg2 decoding turned off by default).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文