Skip to content

Latest commit

 

History

History
92 lines (54 loc) · 2.53 KB

cmediatype-setformat.md

File metadata and controls

92 lines (54 loc) · 2.53 KB
description ms.assetid title ms.topic ms.date topic_type api_name api_type api_location ms.custom
The SetFormat method initializes the format block.
71f1c3d4-9c45-4124-8560-378c8f66e710
CMediaType.SetFormat method (Mtype.h)
reference
4/26/2023
APIRef
kbSyntax
CMediaType.SetFormat
COM
Strmbase.lib
Strmbase.dll
Strmbasd.lib
Strmbasd.dll
UpdateFrequency5

CMediaType.SetFormat method

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The SetFormat method initializes the format block.

Syntax

BOOL SetFormat(
   BYTE  *pFormat,
   ULONG length
);

Parameters

pFormat

Pointer to a block of memory that contains the format block.

length

Length of the format block, in bytes.

Return value

Returns TRUE if successful, or FALSE if an error occurred.

Remarks

This method allocates memory for the format block and copies the buffer specified by pFormat into the new format block. If the media type already contains a format block, the old one is released. The method also sets the cbFormat member of the AM_MEDIA_TYPE structure.

To set the format type, call the CMediaType::SetFormatType method.

Requirements

Requirement Value
Header
Mtype.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CMediaType Class