IMFVideoDisplayControl::SetVideoPosition method (evr.h)

Sets the source and destination rectangles for the video.


HRESULT SetVideoPosition(
  [in] const MFVideoNormalizedRect *pnrcSource,
  [in] const LPRECT                prcDest


[in] pnrcSource

Pointer to an MFVideoNormalizedRect structure that specifies the source rectangle. This parameter can be NULL. If this parameter is NULL, the source rectangle does not change.

[in] prcDest

Specifies the destination rectangle. This parameter can be NULL. If this parameter is NULL, the destination rectangle does not change.

Return value

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

Return code Description
The method succeeded.
At least one parameter must be non-NULL.
The video renderer has been shut down.


The source rectangle defines which portion of the video is displayed. It is specified in normalized coordinates. For more information, see MFVideoNormalizedRect structure. To display the entire video image, set the source rectangle to {0, 0, 1, 1}. The default source rectangle is {0, 0, 1, 1}.

The destination rectangle defines a rectangle within the clipping window where the video appears. It is specified in pixels, relative to the client area of the window. To fill the entire window, set the destination rectangle to {0, 0, width, height}, where width and height are dimensions of the window client area. The default destination rectangle is {0, 0, 0, 0}.

To update just one of these rectangles, set the other parameter to NULL. You can set pnrcSource or prcDest to NULL, but not both.

Before setting the destination rectangle (prcDest), you must set the video window by calling IMFVideoDisplayControl::SetVideoWindow. (For the Media Foundation version of the EVR, you can also provide the video window in the MFCreateVideoRendererActivate function.) If no video window was provided, SetVideoPosition returns E_POINTER.


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


Using the Video Display Controls