IMFPMediaPlayer::SetVideoPosition Method

[This documentation is preliminary and is subject to change.]
Sets the position of the video.

Syntax

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

Parameters

  • pnrcSource [in]
    Pointer to an MFVideoNormalizedRect structure that specifies the source rectangle. This rectangle defines which portion of the video is displayed. It is specified in normalized coordinates, which are defined as follows:

    • The upper-left corner of the video image is (0, 0).
    • The lower-right corner of the video image is (1, 1).

    To display the entire image, set the source rectangle to {0, 0, 1, 1}. This is the default value.

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

  • prcDest [in]
    Pointer to a RECT structure that specifies the destination rectangle. This rectangle defines the position of the video within the application window. It is specified in pixels, relative to the window's client area. To fill the entire client area, set the destination rectangle to {0, 0, width, height}, where width and height are the dimensions of the window client area.

    By default, the destination rectangle equals the entire client area.

    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.

MF_E_INVALIDREQUEST

The current media item does not contain video.

MF_E_SHUTDOWN

The object's Shutdown method was called.

Remarks

At least one parameter must be non-NULL.

This method fails if no media item is currently set, or if the current media item does not contain video.

To set the video position before playback starts, call this method inside your event handler for the MFP_EVENT_TYPE_MEDIAITEM_SET event. For more information, see IMFPMediaPlayerCallback::OnMediaPlayerEvent.

Requirements

Client Requires Windows 7.
Header Declared in Mfplay.h.

See Also

IMFPMediaPlayer
Using MFPlay for Audio/Video Playback

Send comments about this topic to Microsoft

Build date: 4/3/2009