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

This method adds a source filter to the filter graph for a specific file.

Syntax

HRESULT AddSourceFilter(
  LPCWSTR 
lpwstrFileName,
  LPCWSTR 
lpwstrFilterName,
  IbaseFilter** 
ppFilter 
);

Parameters

lpwstrFileName

[in] Pointer to the file.

lpwstrFilterName

[in] Name to give the source filter when it is added.

ppFilter

[out] Pointer to an IBaseFilterinterface on the filter that was added.

Return Value

Returns an HRESULTvalue.

Remarks

This method allows you to obtain and retain more control over building the rest of the graph. For example, you can use the IFilterGraph::AddFiltermethod to add a renderer of your choice, and then use the IGraphBuilder::Connectmethod to connect the two filters. The IBaseFilterinterface exposed by the source filter is returned in the ppFilterparameter, and the reference is already added by the IUnknown::AddRefmethod. The lpwstrFilterNameparameter is used to allow the filter to be identified by this name in this filter graph. For more information, see FindFilterByName.

It is the application's responsibility to find the output pin of the added source filter in order to build the rest of the filter graph, which can be done by calling IGraphBuilder::Renderon the output pin, to build the entire filter graph automatically, or by adding and connecting filters individually. Note that, when adding filters individually, the asynchronous file reader source filter and the URL moniker source filter do not parse the data, so the output pins of these source filters can be connected only to a parser filter, such as the MPEG splitter filter.

Note that the IGraphBuilder::RenderFilemethod adds the same source filter.

Requirements

Windows Embedded CE Windows CE 2.12 and later
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later
Note Microsoft DirectShow applications and DirectShow filters have different include file and Library requirements
For more information, see Setting Up the Build Environment,
Version 2.12 requires DXPAK 1.0 or later

See Also