Microsoft DirectX 9.0

Step 3. Support Media Type Negotiation

When two pins connect, they must agree on a media type for the connection. The media type describes the format of the data. Without the media type, a filter might deliver one kind of data, only to have another filter treat it as something else.

The basic mechanism for negotiating media types is the IPin::ReceiveConnection method. The output pin calls this method on the input pin with a proposed media type. The input pin accepts the connection or rejects it. If it rejects the connection, the output pin can try another media type. If no suitable types are found, the connection fails. Optionally, the input pin can advertise a list of types that it prefers, through the IPin::EnumMediaTypes method. The output pin can use this list when it proposes media types, although it does not have to.

The CTransformFilter class implements a general framework for this process, as follows:

The three CTransformFilter methods listed previously are pure virtual methods, so your derived class must implement them. None of these methods belongs to a COM interface; they are simply part of the implementation provided by the base classes.

The following sections describe each method in more detail:

See Also