Share via


IMFTranscodeSinkInfoProvider 介面 (mfidl.h)

由轉碼接收啟用物件實作。

轉碼接收啟用物件可用來建立下列任何檔案接收:

  • 3GP 檔案接收
  • MP3 檔案接收
  • MP4 檔案接收

繼承

IMFTranscodeSinkInfoProvider 介面繼承自 IUnknown 介面。 IMFTranscodeSinkInfoProvider 也有下列類型的成員:

方法

IMFTranscodeSinkInfoProvider 介面具有這些方法。

 
IMFTranscodeSinkInfoProvider::GetSinkInfo

取得轉碼配置檔中指定的音訊和視訊數據流媒體類型。
IMFTranscodeSinkInfoProvider::SetOutputByteStream

設定轉碼媒體接收的輸出位元組數據流。
IMFTranscodeSinkInfoProvider::SetOutputFile

設定編碼輸出檔的名稱。
IMFTranscodeSinkInfoProvider::SetProfile

在轉碼接收啟用物件上設定轉碼配置檔。

備註

若要使用此介面,請執行下列步驟:

  1. 呼叫 MFCreateTranscodeSinkActivate 以建立轉碼接收啟用物件。
  2. 查詢 IMFTranscodeSinkInfoProvider 介面的啟用物件。
  3. 呼叫 MFCreateTranscodeProfile 以建立轉碼配置檔。
  4. 在轉碼配置檔上 設定MF_TRANSCODE_CONTAINERTYPE 屬性。 屬性必須具有下列其中一個值:
    • MFTranscodeContainerType_3GP
    • MFTranscodeContainerType_MP3
    • MFTranscodeContainerType_MPEG4
  5. 呼叫 IMFTranscodeProfile::SetVideoAttributesIMFTranscodeProfile::SetAudioAttributes 以指定視訊和音訊格式。
  6. 呼叫 IMFTranscodeSinkInfoProvider::SetProfile 來設定轉碼配置檔。
  7. 呼叫下列其中一種方法 (,但不呼叫兩者) 來指定輸出檔:
  8. 在啟用物件上呼叫 IMFActivate::ActivateObject 以建立媒體接收。

範例

// Creates an activation object for the generic transcode sink.

HRESULT CreateTranscodeSinkActivate(
    REFGUID         guidContainerType,
    IMFAttributes   *pVideoAttributes,
    IMFAttributes   *pAudioAttributes,
    IMFActivate     *pByteStreamActivate, 
    IMFActivate     **ppSinkActivate
    )
{
    IMFActivate* pSinkActivate = NULL;
    IMFTranscodeSinkInfoProvider* pSinkInfoProvider = NULL;
    IMFTranscodeProfile* pProfile = NULL;
    IMFAttributes* pContainerAttributes = NULL;

    HRESULT hr = MFCreateAttributes(&pContainerAttributes, 1);
    if (FAILED(hr))
    {
        goto done;
    }

    // Create the transcode profile.
    hr = MFCreateTranscodeProfile(&pProfile);
    if (FAILED(hr))
    {
        goto done;
    }

    // Set the profile attributes.

    hr = pContainerAttributes->SetGUID(MF_TRANSCODE_CONTAINERTYPE, guidContainerType);
    if (FAILED(hr))
    {
        goto done;
    }

    hr = pProfile->SetContainerAttributes(pContainerAttributes);
    if (FAILED(hr))
    {
        goto done;
    }

    if (pVideoAttributes)
    {
        hr = pProfile->SetVideoAttributes(pVideoAttributes);
        if (FAILED(hr))
        {
            goto done;
        }
    }

    if (pAudioAttributes)
    {
        hr = pProfile->SetAudioAttributes(pAudioAttributes);
        if (FAILED(hr))
        {
            goto done;
        }
    }

    // Create the transcode sink activation object.
    hr = MFCreateTranscodeSinkActivate(&pSinkActivate);
    if (FAILED(hr))
    {
        goto done;
    }

    hr = pSinkActivate->QueryInterface(IID_PPV_ARGS(&pSinkInfoProvider));
    if (FAILED(hr))
    {
        goto done;
    }

    // Set the output byte stream.
    hr = pSinkInfoProvider->SetOutputByteStream(pByteStreamActivate);
    if (FAILED(hr))
    {
        goto done;
    }

    // Set the transcode profile.
    hr = pSinkInfoProvider->SetProfile(pProfile);
    if (FAILED(hr))
    {
        goto done;
    }

    // Return the activation object to the caller.
    *ppSinkActivate = pSinkActivate;
    (*ppSinkActivate)->AddRef();

done:
    SafeRelease(&pProfile);
    SafeRelease(&pSinkInfoProvider);
    SafeRelease(&pSinkActivate);
    SafeRelease(&pContainerAttributes);
    return hr;
}

規格需求

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

另請參閱

MFCreateTranscodeSinkActivate

媒體基礎介面