IMFTranscodeSinkInfoProvider interface (mfidl.h)

Implemented by the transcode sink activation object.

The transcode sink activation object can be used to create any of the following file sinks:

  • 3GP file sink
  • MP3 file sink
  • MP4 file sink

Inheritance

The IMFTranscodeSinkInfoProvider interface inherits from the IUnknown interface. IMFTranscodeSinkInfoProvider also has these types of members:

Methods

The IMFTranscodeSinkInfoProvider interface has these methods.

 
IMFTranscodeSinkInfoProvider::GetSinkInfo

Gets the media types for the audio and video streams specified in the transcode profile.
IMFTranscodeSinkInfoProvider::SetOutputByteStream

Sets an output byte stream for the transcode media sink.
IMFTranscodeSinkInfoProvider::SetOutputFile

Sets the name of the encoded output file.
IMFTranscodeSinkInfoProvider::SetProfile

Sets the transcoding profile on the transcode sink activation object.

Remarks

To use this interface, perform the following steps:

  1. Call MFCreateTranscodeSinkActivate to create the transcode sink activation object.
  2. Query the activation object for the IMFTranscodeSinkInfoProvider interface.
  3. Call MFCreateTranscodeProfile to create a transcode profile.
  4. Set the MF_TRANSCODE_CONTAINERTYPE attribute on the transcode profile. The attribute must have one of the following values:
    • MFTranscodeContainerType_3GP
    • MFTranscodeContainerType_MP3
    • MFTranscodeContainerType_MPEG4
  5. Call IMFTranscodeProfile::SetVideoAttributes and IMFTranscodeProfile::SetAudioAttributes to specify the video and audio formats.
  6. Call IMFTranscodeSinkInfoProvider::SetProfile to set the transcode profile.
  7. Call one of the following methods (but not both) to specify the output file:
  8. Call IMFActivate::ActivateObject on the activation object to create the media sink.

Examples

// 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;
}

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header mfidl.h

See also

MFCreateTranscodeSinkActivate

Media Foundation Interfaces