Microsoft DirectX 9.0

ICaptureGraphBuilder2::FindInterface

The FindInterface method searches the graph for a specified interface, starting from a specified filter. You can restrict the search to a section of the graph upstream or downstream of the filter, or restrict it to a particular pin category or media type.

Syntax

HRESULT FindInterface(
  const GUID *pCategory,
  const GUID *pType,
  IBaseFilter *pf,
  REFIID riid,
  void **ppint
);

Parameters

pCategory

[in] Pointer to a GUID that specifies the search criteria. See Remarks for more information. The following values are possible:

See Remarks for more information.

pType

[in] Pointer to a GUID that specifies the major media type of an output pin, or NULL.

pf

[in] Pointer to the IBaseFilter interface of the filter. The method begins searching from this filter.

riid

[in] Interface identifier (IID) of the interface to locate.

ppint

[out] Address of a variable that receives the interface pointer. Be sure to release the retrieved interface pointer when you are done with the interface.

Return Values

Returns an HRESULT value. Possible values include the following.

Return code Description
S_OK Success.
E_FAIL Failure.
E_NOINTERFACE No such interface supported.
E_POINTER NULL pointer argument.

Remarks

In a capture graph, various filters and pins might expose interfaces for setting properties such as compression parameters (IAMVideoCompression) or stream formats (IAMStreamConfig). Depending on the capture device, other useful interfaces might include IAMCrossbar, which routes analog signals, or IAMTVTuner, which controls a TV tuner device. You can use this method to find an interface, without writing special code that traverses the graph.

Important   Do not call this method to obtain an IVideoWindow interface pointer. Always query the filter graph manager for this interface. Otherwise, the filter graph manager will not respond correctly to changes in screen resolution and other events.

If the pCategory parameter is NULL, this method searches the entire graph for the requested interface. Starting from the filter specified by the pf parameter, it queries the following objects in the graph.

You can restrict the search by setting the pCategory and pType parameters, as follows:

Pin categories are useful for finding pin interfaces on capture filters. For example, a capture filter might have separate pins for capture and preview. If you specify a pin category, you should also specify the media type, to make certain the method selects the correct filter and pin.

Some video capture filters have a video port pin (PIN_CATEGORY_VIDEOPORT) instead of a preview pin. If you specify PIN_CATEGORY_PREVIEW and MEDIATYPE_Video, the method treats any video port pins as preview pins. Your application does not have to test for this possibility.

Supporting Filters. If a capture device uses a Windows Driver Model (WDM) driver, the graph may require certain filters upstream from the WDM Video Capture filter, such as a TV Tuner filter or an Analog Video Crossbar filter. If your graph requires any of these WDM filters, this method automatically inserts them into the graph. The method queries the input pins on the capture filter to determine what mediums they support, and connects them to matching filters.

See Also