Section6---Pull Model

本文探讨了在DirectShow中拉取模型的工作原理及其在文件播放场景中的典型应用。介绍了AsyncFileSource和AVISplitter如何通过IAsyncReader接口进行交互,实现数据的有效读取和处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Pull Model

In the IMemInputPin interface, the upstream filter determines what data to send, and it pushes the data to the downstream filter. For some filters, a pull model is more appropriate. Here, the downstream filter requests data from the upstream filter. Samples still travel downstream, from output pin to input pin, but the downstream filter initiates the data flow. This type of connection uses the IAsyncReader interface.

The typical use for the pull model is in file playback. For example, in an AVI playback graph, the Async File Source filter performs generic file reading operations and delivers the data as a byte stream, with no format information. The AVI Splitter filter reads the AVI headers and parses the stream into video and audio samples. The AVI Splitter can determine what data it needs better than the Async File Source filter, and therefore it uses IAsyncReader instead of IMemInputPin.

To request data from the output pin, the input pin calls one of the following methods:

The first method is asynchronous, to support multiple overlapped reads. The others are synchronous.

In theory, any filter can support IAsyncReader, but in practice it is designed for source filters that connect to parser filters. The parser acts very much like a source filter in the push model. When it pauses, it creates a streaming thread that pulls data from the IAsyncReader connection and pushes it downstream. The output pins use IMemInputPin, and the rest of the graph uses the standard push model.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值