Microsoft DirectX 8.1 (C++)

IFilterGraph::AddFilter

The AddFilter method adds a filter to the graph and gives it a name.

Syntax

HRESULT AddFilter(
  IBaseFilter *pFilter,
  LPCWSTR pName
);

Parameters

pFilter

[in] Pointer to the filter to add to the graph.

pName

[in] Pointer to the name of the filter.

Return Value

Returns an HRESULT value. Possible values include the following.

Value Description
S_OK Success.
VFW_S_DUPLICATE_NAME Successfully added a filter with a duplicate name.
E_FAIL Failure.
E_OUTOFMEMORY Insufficient memory.
E_POINTER Null pointer argument.
VFW_E_CERTIFICATION_FAILURE Use of this filter is restricted by a software key.
VFW_E_DUPLICATE_NAME Failed to add a filter with a duplicate name.

Remarks

The name of the filter can be NULL, in which case the filter graph manager will generate a name. If the name is not NULL and is not unique, this method will modify the name in an attempt to generate a new unique name. If this is successful, this method returns VFW_S_DUPLICATE_NAME. If it cannot generate a unique name, it returns VFW_E_DUPLICATE_NAME.

AddFilter calls the filter's IBaseFilter::JoinFilterGraph method to inform the filter that it has been added. AddFilter must be called before attempting to use the IGraphBuilder::Connect, IFilterGraph::ConnectDirect, or IGraphBuilder::Render method to connect or render pins belonging to the added filter.

See Also