Microsoft DirectX 8.0

IFilterGraph2 Interface

This interface extends the IFilterGraph and IGraphBuilder interfaces, which contain methods for building filter graphs.

The filter graph manager implements this interface. Applications can use it when building graphs, to take advantage of the additional methods it provides.

IFilterGraph2 adds two methods to IFilterGraph and IGraphBuilder.

Methods in Vtable Order

IUnknown methodsDescription
QueryInterface Retrieves pointers to supported interfaces.
AddRef Increments the reference count.
Release Decrements the reference count.
IFilterGraph methodsDescription
AddFilterAdds a filter to the graph and gives it a name.
RemoveFilterRemoves a filter from the graph.
EnumFiltersProvides an enumerator for all filters in the graph.
FindFilterByNameFinds a filter that was added with a specified name.
ConnectDirectConnects two pins directly (without intervening filters).
ReconnectBreaks the existing pin connection and reconnects it to the same pin.
DisconnectDisconnects a specified pin.
SetDefaultSyncSourceSets the default synchronization source (a clock).
IGraphBuilder methodsDescription
ConnectConnects two pins. If they do not connect directly, this method connects them with intervening transforms.
RenderAdds a chain of filters to a specified output pin to render it.
RenderFileBuilds a filter graph that renders the specified file.
AddSourceFilterAdds a source filter to the filter graph for a specific file. The IGraphBuilder::RenderFile method calls this to find the source filter.
SetLogFileSets the file for logging actions taken when attempting to perform an operation.
AbortRequests that the graph builder return as soon as possible from its current task.
ShouldOperationContinueQueries whether the current operation should continue.
IFilterGraph2 methodsDescription
AddSourceFilterForMoniker Adds a source filter based on a moniker.
ReconnectEx Breaks the existing pin connection and reconnects it to the same pin, using a specified media type.

IFilterGraph2::AddSourceFilterForMoniker

IFilterGraph2 Interface

Adds a source filter based on a moniker. For example, you can obtain a moniker for a system device, such as a video capture device, and add a video capture filter for that device. (For more information about system device monikers, see ICreateDevEnum.)

Syntax

HRESULT AddSourceFilterForMoniker(
  IMoniker *pMoniker,
  IBindCtx *pCtx,
  LPCWSTR lpcwstrFilterName,
  IBaseFilter **ppFilter );

Parameters

pMoniker
[in] Pointer to an IMoniker interface.
pCtx
[in] Pointer to an IBindCtx bind context interface.
lpcwstrFilterName
[in] Pointer to the filter's name.
ppFilter
[out] Address of a pointer to an IBaseFilter interface.

Return Value

If the method succeeds, the return value is one of the following values.

S_OKSuccess.
VFW_S_DUPLICATE_NAMESuccessfully added a filter with a duplicate name.

If the method fails, the return value may be one of the following error values.

E_FAILFailure.
E_OUTOFMEMORYInsufficient memory.
VFW_E_DUPLICATE_NAMEFailed to add a filter with a duplicate name.
VFW_E_CANNOT_LOAD_SOURCE_FILTERThe source filter for could not be loaded.
VFW_E_UNKNOWN_FILE_TYPEThe media type of this file is not recognized.

Remarks

When adding a source filter for the given moniker to the graph, the COM IMoniker::BindToStorage member function will query for an IStream interface. If this fails, IMoniker::BindToObject will try to retrieve an IBaseFilter interface.

IFilterGraph2::ReconnectEx

IFilterGraph2 Interface

Breaks the existing pin connection and reconnects it to the same pin, using a specified media type.

Syntax

HRESULT ReconnectEx(

  IPin *ppin,
  const AM_MEDIA_TYPE *pmt );

Parameters

ppin
[in] Pointer to the pin to disconnect and reconnect.
pmt
[in] Pointer to the media type to reconnect with. Specify NULL to use the existing media type.

Return Value

S_OKSuccess.
S_FALSEPin was not connected. No error.

If the method fails, the return value may be one of the following error values.

E_FAIL Failure.
E_POINTER Null pointer argument.
VFW_E_NOT_STOPPEDThe filter is not stopped, but it does not support reconnection while in a running state.

Remarks

Like the IFilterGraph::Reconnect method, the ReconnectEx method schedules a reconnection of the pin with the pin it is currently connected to. By specifying a media type when this method is called, the pins don't have to check what type they were originally connected with or enumerate possible new types. This makes the reconnection more likely to succeed.

See Also

IFilterGraph::Reconnect