Partager via


CBasePin::AgreeMediaType

 
Microsoft DirectShow 9.0

CBasePin::AgreeMediaType

The AgreeMediaType method searches for a media type to make a pin connection.

Syntax

  virtual HRESULT AgreeMediaType(
    IPin *pReceivePin,
    const CMediaType *pmt
);

Parameters

pReceivePin

Pointer to the receiving pin's IPin interface.

pmt

Pointer to a CMediaType object that specifies a media type, or NULL.

Return Value

Returns an HRESULT value. Possible values include those in the following table.

Value Description
S_OK Success.
VFW_E_NO_ACCEPTABLE_TYPES No acceptable media type was found.

Remarks

If the pmt parameter is non-NULL and fully specifies a media type, this method attempts a connection using that media type. If the attempt fails, the method returns an error.

If the pmt parameter is NULL or specifies a partial media type, this method tries media types in the following order:

  1. The receiving pin's preferred media types.
  2. This pin's preferred media types.

Preferred media types are enumerated with the CBasePin::EnumMediaTypes method, and the resulting enumerator is passed to the CBasePin::TryMediaTypes method.

Requirements

**  Header:** Declared in Amfilter.h; include Streams.h.

**  Library:** Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

See Also