# HG changeset patch # User tack # Date 1266848852 0 # Node ID 6ca16928b1cc1463de4f1b25ba4b7c537664c173 # Parent b20827f16dd060508b13b8c00f29308e92242635 Get the proper codec id when a WAVE_FORMAT_EXTENSIBLE extension exists in a wave file. diff -r b20827f16dd0 -r 6ca16928b1cc libmpdemux/aviprint.c --- a/libmpdemux/aviprint.c Mon Feb 22 14:24:53 2010 +0000 +++ b/libmpdemux/aviprint.c Mon Feb 22 14:27:32 2010 +0000 @@ -89,6 +89,12 @@ mp_msg(MSGT_HEADER, verbose_level, "mp3.nFramesPerBlock=%d\n",h2->nFramesPerBlock); mp_msg(MSGT_HEADER, verbose_level, "mp3.nCodecDelay=%d\n",h2->nCodecDelay); } + else if (h->wFormatTag == 0xfffe && h->cbSize >= 22) { + WAVEFORMATEXTENSIBLE *h2 = (WAVEFORMATEXTENSIBLE *)h; + mp_msg(MSGT_HEADER, verbose_level, "ex.wValidBitsPerSample=%d\n", h2->wValidBitsPerSample); + mp_msg(MSGT_HEADER, verbose_level, "ex.dwChannelMask=0x%X\n", h2->dwChannelMask); + mp_msg(MSGT_HEADER, verbose_level, "ex.SubFormat=%d (0x%X)\n", h2->SubFormat, h2->SubFormat); + } else if (h->cbSize > 0) { int i; diff -r b20827f16dd0 -r 6ca16928b1cc libmpdemux/demux_audio.c --- a/libmpdemux/demux_audio.c Mon Feb 22 14:24:53 2010 +0000 +++ b/libmpdemux/demux_audio.c Mon Feb 22 14:27:32 2010 +0000 @@ -416,6 +416,8 @@ } stream_read(s,(char*)((char*)(w)+sizeof(WAVEFORMATEX)),w->cbSize); l -= w->cbSize; + if (w->wFormatTag & 0xfffe && w->cbSize >= 22) + sh_audio->format = ((WAVEFORMATEXTENSIBLE *)w)->SubFormat; } if( mp_msg_test(MSGT_DEMUX,MSGL_V) ) print_wave_header(w, MSGL_V); diff -r b20827f16dd0 -r 6ca16928b1cc libmpdemux/ms_hdr.h --- a/libmpdemux/ms_hdr.h Mon Feb 22 14:24:53 2010 +0000 +++ b/libmpdemux/ms_hdr.h Mon Feb 22 14:27:32 2010 +0000 @@ -34,6 +34,17 @@ } WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX; #endif /* _WAVEFORMATEX_ */ +#ifndef _WAVEFORMATEXTENSIBLE_ +#define _WAVEFORMATEXTENSIBLE_ +typedef struct __attribute__((__packed__)) _WAVEFORMATEXTENSIBLE { + WAVEFORMATEX wf; + unsigned short wValidBitsPerSample; + unsigned int dwChannelMask; + unsigned int SubFormat; // Only interested in first 32 bits of guid + unsigned int _guid_remainder[3]; +} WAVEFORMATEXTENSIBLE; +#endif /* _WAVEFORMATEXTENSIBLE_ */ + #ifndef _MPEGLAYER3WAVEFORMAT_ #define _MPEGLAYER3WAVEFORMAT_ typedef struct __attribute__((__packed__)) mpeglayer3waveformat_tag {