Microsoft DirectX 9.0 |
Intelligent Connect is the mechanism the Filter Graph Manager uses to build filter graphs. It consists of several related algorithms that select filters and add them to the filter graph. For application programming, you rarely need to know the details of Intelligent Connect. Read this section if you are having trouble building a certain filter graph and want to troubleshoot the problem, or if you are writing your own filter and want to make it available for automatic graph building.
Intelligent Connect involves the following IGraphBuilder methods:
The Render method builds a subsection of a graph. It starts from an unconnected output pin and works downstream, adding new filters as needed. The starting filter must already be in the graph. At each step, the Render method searches for a filter that can connect to the previous filter. The stream can branch if a connecting filter has multiple output pins. The search stops when every stream has a renderer. If the Render method gets stuck, it might back up and try again, using a different set of filters.
To connect each output pin, the Render method does the following:
Each filter is registered with a merit, a numerical value that indicates how preferable the filter is, relative to other filters. The EnumMatchingFilters method returns filters in order of merit, with a minimum merit of MERIT_DO_NOT_USE + 1. It ignores filters with a merit of MERIT_DO_NOT_USE or less. Filters are also grouped into categories, defined by GUID. Categories themselves have merit, and the EnumMatchingFilters method ignores any category with a merit of MERIT_DO_NOT_USE or less, even if the filters in that category have higher merit values.
To summarize, the Render method tries filters in the following order:
The AddSourceFilter method adds a source filter that can render a specified file. First it looks in the registry and matches against the protocol (such as http://
), the file extension, or a set of predetermined check bytes, which are bytes at particular offsets in the file that match certain patterns. For details, see Registering a Custom File Type. Assuming that the method locates an appropriate source filter, it then creates an instance of that filter, adds it to the graph, and calls the filter's IFileSourceFilter::Load method with the file name.
The RenderFile method builds a default playback graph from a file name. Internally, this method uses AddSourceFilter to locate the correct source filter, and Render to build the rest of the graph.
The Connect method connects and output pin to an input pin. This method adds intermediate filters if needed, using a variation of the algorithm described for the Render method:
See Also