audio - Directshow筛选器如何交换媒体样本?

标签 audio directshow audio-streaming visual-c++-2010 audio-processing

有人知道DirectShow过滤器如何交换媒体样本吗?

我们知道源过滤器抓取样本(来自MIC或Live),并将其传递到图形中的下一个过滤器。

显然我想知道过滤器如何将样本传递给另一个过滤器?

是否有已知的模式?

如果我决定在没有任何第三方组件的情况下实现音频处理过滤器,
是否可以使用多生产者/消费者队列来实现媒体样本交换?

假设源过滤器F1是媒体捕获过滤器,过滤器F2是DSP过滤器。

F1写入Multi Producer / Consumer队列,如果有可用样本,F2消耗F1排队的捕获样本。有它自己的线程)。
有什么更好的办法吗?

*EDIT : our solution must looks like Publisher Subscriber pattern , but i think this not suitable for media processing.



非常感谢你

最佳答案

MSDN在Overview of Data Flow in DirectShow中提供了非常详细的描述。您需要整篇文章,以下是有关过滤器之间专门交换数据的摘录:

[...] Whenever a filter needs to fill a buffer with data, it requests a sample from the allocator by calling IMemAllocator::GetBuffer. If the allocator has any samples that are not currently in use by another filter, the GetBuffer method returns immediately with a pointer to the sample. If all of the allocator's samples are in use, the method blocks until a sample becomes available. When the method does return a sample, the filter puts data into the buffer, sets the appropriate flags on the sample (typically including a time stamp), and delivers the sample downstream. [...]

关于audio - Directshow筛选器如何交换媒体样本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24851868/

相关文章:

flash - 如何使用http播放wave文件?

c++ - 是什么导致 pMoniker->BindToObject 返回 800700c1

java - 如何使用套接字编程在两个 android 手机之间创建实时音频流..?

node.js - 使用 Node js 进行 MP3 文件直播

c# - 无法在 IGraphBuilder.RenderFile 中使用 COM 异常播放 MP3 文件

mongodb - 如何为Web应用程序托管音频文件

c++ - 如何使用ffmpeg c++从视频中提取音频

python - 如何访问音频输出以在 python 3 中进行分析

actionscript-3 - 为什么不播放此嵌入式声音文件?

c++ - DirectShow - 选择视频设备