changeset 11482:a6b69309a791

Support for FLAC in Matroska written in the MS compatibility mode.
author mosu
date Sun, 16 Nov 2003 19:24:43 +0000
parents 64298443e494
children 462b97f8746f
files libmpdemux/demux_mkv.cpp
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.cpp	Sun Nov 16 16:31:06 2003 +0000
+++ b/libmpdemux/demux_mkv.cpp	Sun Nov 16 19:24:43 2003 +0000
@@ -2355,7 +2355,8 @@
 
       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 @@
       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);