Share via


IMediaSample::SetMediaType

 
Microsoft DirectShow 9.0

IMediaSample::SetMediaType

The SetMediaType method sets the media type for the sample.

Syntax

  HRESULT SetMediaType(
  AM_MEDIA_TYPE *pMediaType
);

Parameters

pMediaType

Pointer to an AM_MEDIA_TYPE structure that specifies the media type.

Return Values

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

Return code Description
S_OK Success
E_OUTOFMEMORY Insufficient memory

Remarks

By default, every sample has the same media type as the previous sample. (The pin connection determines the original media type.) Call this method to make limited changes to the media type, such as changing the palette. To make a significant change to the media type, the pins might need to reconnect and renegotiate the media type.

Requirements

Header: Declared in Strmif.h; include Dshow.h.

Library: Use Strmiids.lib.

See Also