Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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 Interfacemethods:

The IGraphBuilder::Rendermethod 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 IGraphBuilder::Rendermethod 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 IGraphBuilder::Rendermethod gets stuck, it might back up and try again, using a different set of filters.

To connect each output pin, the IGraphBuilder::Rendermethod does the following:

  1. The Filter Graph Manager tries to use filters that are cached in memory, if any. Throughout the Intelligent Connect process, the Filter Graph Manager may cache filters from earlier steps in the process.

  2. If the filter graph contains any filters with unconnected input pins, the Filter Graph Manager tries them next. You can force the IGraphBuilder::Rendermethod to try a particular filter by adding that filter to the graph before calling IGraphBuilder::Render.

  3. Finally, the Filter Graph Manager searches the registry, using the IFilterMapper::EnumMatchingFiltersmethod. It tries to match the output pin's preferred media types against media types listed in the registry.

Each filter is registered with a merit, a numerical value that indicates how preferable the filter is, relative to other filters. The IFilterMapper::EnumMatchingFiltersmethod 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 IFilterMapper::EnumMatchingFiltersmethod 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 Rendermethod tries filters in the following order:

  1. Try cached filters.

  2. Try filters in the graph.

  3. Look up filters in the registry.

The IGraphBuilder::AddSourceFiltermethod 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.

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::Loadmethod with the file name.

The IGraphBuilder::RenderFilemethod builds a default playback graph from a file name. Internally, this method uses IGraphBuilder::AddSourceFilterto locate the correct source filter, and IGraphBuilder::Renderto build the rest of the graph.

The IGraphBuilder::Connectmethod connects and output pin to an input pin. This method adds intermediate filters if needed, using a variation of the algorithm described for the IGraphBuilder::Rendermethod:

  1. Try a direct connection between the filters, with no intermediate filters.

  2. Try cached filters.

  3. Try filters in the graph.

  4. Look up filters in the registry.

See Also