Expand Minimize

MFCreateAggregateSource function

Creates a media source that aggregates a collection of media sources.

Syntax


HRESULT MFCreateAggregateSource(
  _In_   IMFCollection *pSourceCollection,
  _Out_  IMFMediaSource **ppAggSource
);

Parameters

pSourceCollection [in]

A pointer to the IMFCollection interface of the collection object that contains a list of media sources.

ppAggSource [out]

Receives a pointer to the IMFMediaSource interface of the aggregated media source. The caller must release the interface.

Return value

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return codeDescription
S_OK

The method succeeded.

E_INVALIDARG

The pSourceCollection collection does not contain any elements.

 

Remarks

The aggregated media source is useful for combining streams from separate media sources. For example, you can use it to combine a video capture source and an audio capture source.

Windows Phone 8.1: This API is supported.

Examples


HRESULT CreateAggregatedSource(
    IMFMediaSource *pSource1,
    IMFMediaSource *pSource2,
    IMFMediaSource **ppAggSource
    )
{
    *ppAggSource = NULL;

    IMFCollection *pCollection = NULL;

    HRESULT hr = MFCreateCollection(&pCollection);

    if (SUCCEEDED(hr))
    {
        hr = pCollection->AddElement(pSource1);
    }
    if (SUCCEEDED(hr))
    {
        hr = pCollection->AddElement(pSource2);
    }
    if (SUCCEEDED(hr))
    {
        hr = MFCreateAggregateSource(pCollection, ppAggSource);
    }
    SafeRelease(&pCollection);
    return hr;    
}


Requirements

Minimum supported client

Windows 7 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | Windows Store apps]

Header

Mfidl.h

Library

Mf.lib

DLL

Mf.dll

See also

Media Foundation Functions
IMFMediaSource

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.