IMFVideoDisplayControl::SetVideoPosition method

Sets the source and destination rectangles for the video.

Syntax

HRESULT SetVideoPosition(
  const MFVideoNormalizedRect *pnrcSource,
  const LPRECT                prcDest
);

Parameters

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.

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
S_OK
The method succeeded.
E_POINTER
At least one parameter must be non-NULL.
MF_E_SHUTDOWN
The video renderer has been shut down.

Remarks

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.

Requirements

   
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

IMFVideoDisplayControl

Using the Video Display Controls