天天看点

[DirectShow] 005 - About the Filter Graph Manager

<!-- @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"Cambria Math"; panose-1:0 0 0 0 0 0 0 0 0 0; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:宋体; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-font-kerning:1.0pt;} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {mso-style-noshow:yes; mso-style-priority:99; color:purple; mso-themecolor:followedhyperlink; text-decoration:underline; text-underline:single;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:42.55pt; mso-footer-margin:49.6pt; mso-paper-source:0; layout-grid:15.6pt;} div.Section1 {page:Section1;} -->

The Filter Graph Manager is a COM object that controls the filters in a filter graph. It performs many functions, including the following:

Coordinating state changes among the filters.

Establishing a reference clock .

Communicating events back to the application.

Providing methods for applications to build the filter graph.

Filter Graph Manager 是一个 COM 对象,是 filter graph 中控制 filters 的对象。它执行许多功能,包括:

调整一类 filters 的状态变化。

建立一个引用时钟。

返回事件给应用程序。

提供方法给应用程序生成 filter graph 。

Each of these functions is described briefly here. Details can be found elsewhere in the documentation.

State changes. State changes within filters must occur in a particular order. Therefore, the application does not issue state-change commands directly to the filters. Instead, it gives a single command to the Filter Graph Manager, which distributes the command to each of the filters. Seeking works in a similar fashion: The application gives a seek command to the Filter Graph Manager, which distributes it to the filters.

Reference clock. All of the filters in the graph use the same clock, called a reference clock. The reference clock ensures that all the streams are synchronized. The time at which a video frame or audio sample should be rendered is called the presentation time. The presentation time is measured relative to the reference clock. The Filter Graph Manager chooses a reference clock, usually either the clock on the sound card, or the system clock.

Graph events. The Filter Graph Manager uses an event queue to inform the application of events that occur in the filter graph. This mechanism is similar to a Windows message loop.

Graph-building methods. The Filter Graph Manager provides methods for the application to add filters to the graph, connect filters to other filters, and disconnect filters.

State changes. filters 内的状态变化必须发生在特殊的命令中。因此,应用程序不直接像 filters 发送状态转化命令。而是给 Filter Graph Manager 一个单独的命令,由 Filter Graph Manager 给每一个 filters 分发命令。

Reference clock. graph 中的所有 filter 都使用相同的时钟,这个时钟叫做 reference clock. referrence 确保所有的流同步。 The time at which a video frame or audio sample should be rendered is called the presentation time. The presentation time is measured relative to the reference clock. Filter Graph Manager 选择声卡时钟或者系统时钟作为 reference clock 。

Graph events. Filter Graph Manager 使用事件队列通知接收 filter graph 中产生消息的应用程序。这个机制类似 Windows 的消息循环。

Graph-building methods. Filter Graph Manager 为应用程序提供了添加 filter 到 graph ,连接两个 filter ,断开 filter 连接的方法。

One function the Filter Graph Manager does not handle is moving data from one filter to the next. This is done by the filters themselves, through their pin connections. Processing always happens on a separate thread.

有一个功能是 Filter Graph Manage 没有处理的,那就是把数据从一个 filter 移动到下一个。这是由 filter 通过 pin 的连接来完成。处理过程总是发生在一个分离线程。

继续阅读