Search code examples
c++winapiaudiomp3directshow

DirectShow media subtype for MP3?


What the media subtype for MP3 in DirectShow, equal MEDIASUBTYPE_MP3 or ... ?

pMediaType->SetType(&MEDIATYPE_Audio);
pMediaType->SetSubtype(&MEDIASUBTYPE_MP3);

But MEDIASUBTYPE_MP3 not exists.


Solution

  • MEDIASUBTYPE_MP3 is not defined as an identifier even though WMMEDIASUBTYPE_MP3 is.

    The subtype is generic FourCC subtype of type 0x55:

    // 00000055-0000-0010-8000-00AA00389B71            WMMEDIASUBTYPE_MP3 
    EXTERN_GUID(WMMEDIASUBTYPE_MP3, 
    0x00000055, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); 
    

    0x55 is coming from:

    #define  WAVE_FORMAT_MPEGLAYER3                 0x0055 /* ISO/MPEG Layer3 Format Tag */
    

    When in doubt, use GraphStudioNext to render a relevant file and review the media types:

    enter image description here