Compartir a través de


IMFVideoMixerControl::SetStreamOutputRect method (evr.h)

[The component described on this page, Enhanced Video Renderer, is a legacy feature. It has been superseded by the Simple Video Renderer (SVR) exposed through the MediaPlayer and IMFMediaEngine components. To play video content you should send data into one of these components and allow them to instantiate the new video renderer. These components have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer or the lower level IMFMediaEngine APIs to play video media in Windows instead of the EVR, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

Sets the position of a video stream within the composition rectangle.

Syntax

HRESULT SetStreamOutputRect(
  [in] DWORD                       dwStreamID,
  [in] const MFVideoNormalizedRect *pnrcOutput
);

Parameters

[in] dwStreamID

Identifier of the stream. For the EVR media sink, the stream identifier is defined when the IMFMediaSink::AddStreamSink method is called. For the DirectShow EVR filter, the stream identifier corresponds to the pin index. The reference stream is always stream 0.

[in] pnrcOutput

Pointer to an MFVideoNormalizedRect structure that defines the bounding rectangle for the video stream.

Return value

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

Return code Description
S_OK
The method succeeded.
E_INVALIDARG
The coordinates of the bounding rectangle given in pnrcOutput are not valid.
MF_E_INVALIDSTREAMNUMBER
Invalid stream identifier.

Remarks

The mixer draws each video stream inside a bounding rectangle that is specified relative to the final video image. This bounding rectangle is given in normalized coordinates. For more information, see MFVideoNormalizedRect structure.

The coordinates of the bounding rectangle must fall within the range [0.0, 1.0]. Also, the X and Y coordinates of the upper-left corner cannot exceed the X and Y coordinates of the lower-right corner. In other words, the bounding rectangle must fit entirely within the composition rectangle and cannot be flipped vertically or horizontally.

The following diagram shows how the EVR mixes substreams.

Diagram showing an image, then that image inside a larger output rectangle, then a portion of the image in a source rectangle The output rectangle for the stream is specified by calling SetStreamOutputRect. The source rectangle is specified by calling IMFVideoDisplayControl::SetVideoPosition. The mixer applies the output rectangle first, when it mixes the streams into a single bounding rectangle. This bounding rectangle is called composition space. Then the presenter applies the source rectangle to the composited image.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header evr.h
Library Strmiids.lib

See also

Enhanced Video Renderer

IMFVideoMixerControl