VIDEO_ZOOM_RECT attribute

Specifies the source rectangle for video mixer of the Enhanced Video Renderer (EVR). The source rectangle is the portion of the video frame that the mixer blits to the destination surface.

Data type

Byte array

Remarks

The value of this attribute is an MFVideoNormalizedRect structure.

The source rectangle is defined relative to a normalized coordinate system, in which the entire video frame occupies a rectangle with coordinates {0, 0, 1, 1}. The source rectangle must fit within the video frame; the coordinates of the source rectangle have a range of (0...1).

The standard EVR presenter sets this attribute on the mixer. To set the attribute, do the following:

  1. Call IMFTransform::GetAttributes on the mixer, to get the mixer's attribute store.
  2. Call IMFAttributes::SetBlob to set the VIDEO_ZOOM_RECT attribute on the mixer. The value is an MFVideoNormalizedRect structure.

In a custom EVR presenter, you can use this attribute to implement the IMFVideoDisplayControl::SetVideoPosition method. For more information, see Source and Destination Rectangles.

The GUID constant for this attribute is exported from strmiids.lib.

Examples

The following example sets the source rectangle on the mixer.

HRESULT SetMixerSourceRect(IMFTransform *pMixer, const MFVideoNormalizedRect& nrcSource)
{
    if (pMixer == NULL)
    {
        return E_POINTER;
    }

    IMFAttributes *pAttributes = NULL;

    HRESULT hr = pMixer->GetAttributes(&pAttributes);
    if (SUCCEEDED(hr))
    {
        hr = pAttributes->SetBlob(VIDEO_ZOOM_RECT, (const UINT8*)&nrcSource, sizeof(nrcSource));
        pAttributes->Release();
    }
    return hr;
}

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
Header
Evr.h

See also

Alphabetical List of Media Foundation Attributes

Enhanced Video Renderer Attributes

How to Write an EVR Presenter

IMFAttributes::GetBlob

IMFAttributes::SetBlob