Search code examples
c++ms-media-foundation

Does MFCreateAggregateSource make any guarantees about ordering?


If I create an aggregate media source in Windows Media Foundation using MFCreateAggregateSource, are the streams ordered in the same order as the sources in the collection passed to MFCreateAggregateSource? If not, is there any way to determine which actual source creates which stream?


Solution

  • The doubts could be cleared out by MSDN article for MFCreateAggregateSource explaining the order of aggregation, but it does not provide such details (at the moment).

    Those having experience with the API report that aggregation order is straightforward: the order of collection elements, and streams within individual sources.

    See more in cross-post on MSDN Forums:

    Example 1 :

    You have 3 Media Sources, A, B and C. Each source has only one stream. If you add them in alphabetical order to a collection, you will get 3 streams on the Aggregate Source.

    ->

    Stream 0 is Source A ( Stream 0 )

    Stream 1 is Source B ( Stream 0 )

    Stream 2 is Source C ( Stream 0 )

    Example 2 :

    Same Media Sources, but this time B has 2 streams. If you add the sources in alphabetical order to a collection, you will get 4 streams on the Aggregate Source.

    ->

    Stream 0 is Source A ( Stream 0 )

    Stream 1 is Source B ( Stream 0 )

    Stream 2 is Source B ( Stream 1 )

    Stream 3 is Source C ( Stream 0 )