IMFTranscodeSinkInfoProvider interface

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

Members

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

Methods

The IMFTranscodeSinkInfoProvider interface has these methods.

MethodDescription
GetSinkInfo

Gets the audio stream and the video stream attributes specified in the transcode profile.

SetOutputByteStream

Sets the output byte stream for the transcode media sink.

SetOutputFile

Sets the name of the output file to which the media sink writes the transcoded content.

SetProfile

Sets the specified transcode profile that contains the configuration settings for the audio stream, the video stream, and the container to which the file is written.

 

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

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Mfidl.h

See also

Media Foundation Interfaces
MFCreateTranscodeSinkActivate

 

 

Community Additions

ADD
Show:
© 2014 Microsoft