MF_TOPOLOGY_STATIC_PLAYBACK_OPTIMIZATIONS屬性

啟用影片管線中的靜態優化。

資料類型

UINT32

取得/設定

若要取得這個屬性,請呼叫 IMFAttributes::GetUINT32

若要設定此屬性,請呼叫 IMFAttributes::SetUINT32

適用於

IMFTopology

備註

在載入拓撲之前,請先設定此屬性。 如果屬性為 TRUE,拓撲載入器會先嘗試優化管線,再開始播放。

如果您設定此屬性,則也應該設定下列屬性:

此屬性的 GUID 常數是從 mfuuid.lib 匯出。

範例

HRESULT SetPlaybackOptimizations(IMFTopology *pTopology, HWND hwnd)
{
    HRESULT hr = pTopology->SetUINT32(
        MF_TOPOLOGY_STATIC_PLAYBACK_OPTIMIZATIONS, TRUE);

    if (FAILED(hr))
    {
        return hr;
    }

    HMONITOR hCurrentMon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY);

    if (hCurrentMon)
    {
        MONITORINFO MonitorInfo = {0};
        MonitorInfo.cbSize = sizeof(MONITORINFO);

        BOOL fSucceeded = GetMonitorInfo(hCurrentMon, &MonitorInfo);

        if (fSucceeded )
        {
            const RECT& rcMonitor = MonitorInfo.rcMonitor;

            LONG width = rcMonitor.right - rcMonitor.left;
            LONG height = rcMonitor.bottom - rcMonitor.top;

            hr = MFSetAttributeSize(
                pTopology, 
                MF_TOPOLOGY_PLAYBACK_MAX_DIMS, 
                (UINT32)width, (UINT32)height
                );

            if (FAILED(hr))
            {
                goto done;
            }

            HDC hdc = GetDC(hwnd);

            hr = MFSetAttributeRatio(
                pTopology,
                MF_TOPOLOGY_PLAYBACK_FRAMERATE,
                GetDeviceCaps(hdc, VREFRESH), 1
                );

            ReleaseDC(hwnd, hdc);
        }
    }
done:
    return hr;
}

規格需求

需求
最低支援的用戶端
Windows 7 [僅限傳統型應用程式]
最低支援的伺服器
Windows Server 2008 R2 [僅限傳統型應用程式]
標頭
Mfidl.h

另請參閱

媒體基礎屬性的字母順序清單

拓撲屬性

影片品質管制