IMFSourceReaderEx::SetNativeMediaType method (mfreadwrite.h)
Sets the native media type for a stream on the media source.
Syntax
HRESULT SetNativeMediaType(
[in] DWORD dwStreamIndex,
[in] IMFMediaType *pMediaType,
[out] DWORD *pdwStreamFlags
);
Parameters
[in] dwStreamIndex
[in] pMediaType
A pointer to the IMFMediaType interface of the media type.
[out] pdwStreamFlags
Receives a bitwise OR of zero or more of the following flags.
Value | Meaning |
---|---|
|
All effects were removed from the stream. |
|
The current output type changed. |
Return value
This method can return one of these values.
Return code | Description |
---|---|
|
Success. |
|
Invalid request. |
|
The dwStreamIndex parameter is invalid. |
Remarks
This method sets the output type that is produced by the media source. Unlike the IMFSourceReader::SetCurrentMediaType method, this method does not insert any decoders, video processors, or other transforms. The media source must support the specified media type natively. To get a list of supported types from the media source, call IMFSourceReader::GetNativeMediaType.
In asynchronous mode, this method fails if a sample request is pending. In that case, wait for the OnReadSample callback to be invoked before calling the method. For more information about using the Source Reader in asynchronous mode, see IMFSourceReader::ReadSample.
This method can trigger a change in the output format for the stream. If so, the MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED flag is returned in the pdwStreamFlags parameter. The method might also cause the Source Reader to remove any effects that were added by the IMFSourceReaderEx::AddTransformForStream method. If this occurs, the MF_SOURCE_READERF_ALLEFFECTSREMOVED flag is returned in pdwStreamFlags.
This method is useful with audio and video capture devices, because a device might support several output formats. This method enables the application to choose the device format before decoders and other transforms are added.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 8 [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2012 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | mfreadwrite.h |