From c36b3d52c0b7ef630cfa176dc199a2579e5fd791 Mon Sep 17 00:00:00 2001 From: mosu Date: Sun, 16 Nov 2003 19:24:43 +0000 Subject: [PATCH] Support for FLAC in Matroska written in the MS compatibility mode. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11483 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_mkv.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libmpdemux/demux_mkv.cpp b/libmpdemux/demux_mkv.cpp index a9d5fbb30e..747b98db42 100644 --- a/libmpdemux/demux_mkv.cpp +++ b/libmpdemux/demux_mkv.cpp @@ -2355,7 +2355,8 @@ extern "C" int demux_mkv_open(demuxer_t *demuxer) { track->realmedia = true; - } else if (!strcmp(track->codec_id, MKV_A_FLAC)) { + } else if (!strcmp(track->codec_id, MKV_A_FLAC) || + (track->a_formattag == 0xf1ac)) { free(sh_a->wf); sh_a->wf = NULL; @@ -2364,8 +2365,16 @@ extern "C" int demux_mkv_open(demuxer_t *demuxer) { dp->pts = 0; dp->flags = 0; ds_add_packet(demuxer->audio, dp); - dp = new_demux_packet(track->private_size); - memcpy(dp->buffer, track->private_data, track->private_size); + if (track->a_formattag == mmioFOURCC('f', 'L', 'a', 'C')) { + dp = new_demux_packet(track->private_size); + memcpy(dp->buffer, track->private_data, track->private_size); + } else { + sh_a->format = mmioFOURCC('f', 'L', 'a', 'C'); + dp = new_demux_packet(track->private_size - sizeof(WAVEFORMATEX)); + memcpy(dp->buffer, (unsigned char *)track->private_data + + sizeof(WAVEFORMATEX), track->private_size - + sizeof(WAVEFORMATEX)); + } dp->pts = 0; dp->flags = 0; ds_add_packet(demuxer->audio, dp);