Share via


IAMStreamConfig::SetFormat (Windows CE 5.0)

Send Feedback

This method sets the audio or video stream's format.

HRESULT SetFormat(AM_MEDIA_TYPE* pmt);

Parameters

Return Values

Returns an HRESULT value that depends on the implementation of the interface.

Remarks

A call to this method will fail if the pin is streaming.

If your output pin is not connected and you can connect it with this media type, return S_OK from this method and start enumerating the specified media type as follows. Specify this format as format number zero in the CTransformOutputPin::GetMediaType function's iPosition parameter. You can offer and accept only this type to ensure that the pins will use this format for the connection when it occurs.

If your output pin is already connected and you can provide this type, then reconnect your pin. If the other pin cannot accept the media type, fail this call and leave your connection alone.

Passing in NULL as a parameter value can cause some filters to set their default format and forget a previous format you have given it with this method.

The frame rate at which your filter should produce data is determined by the AvgTimePerFrame field of VIDEOINFOHEADER of the media type your output pin is connected with. You may not be able to capture at any arbitrary frame rate, but only certain rates. If your pin is connected with a media type that asks for a frame rate you cannot provide, you should provide frames at the next lowest frame rate possible. For example, if your media type has AvgTimePerFrame=333333 (approximately 1/30 of a second, meaning 30 frames per second) and you can only capture 29.97 or 35 frames per second, you should provide frames at 29.97 frames per second, because that is the closest value lower than 30 that you can provide. You can provide a higher frame rate than asked if the frame rate you provide does not create frame durations more than 1 microsecond shorter than requested, because AvgTimePerFrame may simply have rounding errors. If the AvgTimePerFrame field is 0, you can supply frames at any default frame rate that you want.

Requirements

DirectShow applications and DirectShow filters have different include file and link library requirements. See Setting Up the Build Environment for more information.

Pocket PC: Windows Mobile 5.0 and later
Smartphone: Windows Mobile 5.0 and later
OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.
Header:

See Also

CTransformOutputPin::GetMediaType | AM_MEDIA_TYPE | VIDEOINFOHEADER

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.