Microsoft DirectX 8.1 (C++)

Step 1. Query for Stream Information

First, query the DMO for the number of streams it supports and the preferred media types for each stream. To retrieve the number of input streams and output streams, call the IMediaObject::GetStreamCount method.

For each stream, the DMO ranks its preferred media types in order of preference and assigns each type an index, starting from zero. To retrieve a preferred media type for a particular stream, call the IMediaObject::GetInputType method or IMediaObject::GetOutputType method. Specify a stream number and a media-type index. To enumerate all the media types on a stream, use a loop that increments the media-type index until the method returns DMO_E_NO_MORE_ITEMS, as shown in the following pseudo-code:

DWORD cInputs, cOutputs, type = 0
DMO_MEDIA_TYPE mt

pDMO->GetStreamCount(&cInputs, &cOutputs)

for (DWORD i = 0; i < cInputs; i++)
{
    while (pDMO->GetInputType(i, type, &mt) != DMO_E_NO_MORE_ITEMS)
    {
        if ( this media type is one you want )
            break
        MoFreeMediaType(&mt)
        type++
    }
}

The GetInputType and GetOutputType methods return a DMO_MEDIA_TYPE structure with the media type. The following structure members are relevant:

The application must call the MoFreeMediaType function to free the pbFormat member.