MFCreateTranscodeTopology function (mfidl.h)

Creates a partial transcode topology.

The underlying topology builder creates a partial topology by connecting the required pipeline objects: source, encoder, and sink. The encoder and the sink are configured according to the settings specified by the caller in the transcode profile.

To create the transcode profile object, call the MFCreateTranscodeProfile function and set the required attributes by calling the appropriate the IMFTranscodeProfile methods.

The configured transcode profile is passed to the MFCreateTranscodeTopology function, which creates the transcode topology with the appropriate settings. The caller can then set this topology on the Media Session and start the session to begin the encoding process. When the Media Session ends, the transcoded file is generated.

Syntax

HRESULT MFCreateTranscodeTopology(
  [in]  IMFMediaSource      *pSrc,
  [in]  LPCWSTR             pwszOutputFilePath,
  [in]  IMFTranscodeProfile *pProfile,
  [out] IMFTopology         **ppTranscodeTopo
);

Parameters

[in] pSrc

A pointer to a media source that encapsulates the source file to be transcoded. The media source object exposes the IMFMediaSource interface and can be created by using the source resolver. For more information, see Using the Source Resolver.

[in] pwszOutputFilePath

A pointer to a null-terminated string that contains the name and path of the output file to be generated.

[in] pProfile

A pointer to the transcode profile that contains the configuration settings for the audio stream, the video stream, and the container to which the file is written. The transcode profile object exposes the IMFTranscodeProfile interface and must be created by calling the MFCreateTranscodeProfile function. After the object has been created the caller must provide the configuration settings by calling appropriate the IMFTranscodeProfile methods.

[out] ppTranscodeTopo

Receives a pointer to the IMFTopology interface of the transcode topology object. The caller must release the interface.

Return value

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK
The function call succeeded, and ppTranscodeTopo receives a pointer to the transcode topology.
E_INVALIDARG
pwszOutputFilePath contains invalid characters.
MF_E_MEDIA_SOURCE_NO_STREAMS_SELECTED
No streams are selected in the media source.
MF_E_TRANSCODE_NO_CONTAINERTYPE
The profile does not contain the MF_TRANSCODE_CONTAINERTYPE attribute.
MF_E_TRANSCODE_NO_MATCHING_ENCODER
For one or more streams, cannot find an encoder that accepts the media type given in the profile.
MF_E_TRANSCODE_PROFILE_NO_MATCHING_STREAMS
The profile does not specify a media type for any of the selected streams on the media source.

Remarks

For example code that uses this function, see the following topics:

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header mfidl.h
Library Mf.lib
DLL Mf.dll

See also

IMFTopology

Media Foundation Functions

Topologies

Transcode API