Share via


IGraphBuilder::AddSourceFilter (Compact 2013)

3/26/2014

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 IBaseFilter interface on the filter that was added.

Return Value

Returns an HRESULT value.

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::AddFilter method to add a renderer of your choice, and then use the IGraphBuilder::Connect method to connect the two filters. The IBaseFilter interface exposed by the source filter is returned in the ppFilter parameter, and the reference is already added by the IUnknown::AddRef method. The lpwstrFilterName parameter 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::Render on 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::RenderFile method adds the same source filter.

Requirements

Header

dshow.h

Library

Strmiids.lib

See Also

Reference

IGraphBuilder Interface