[MPlayer-dev-eng] [PATCH] To Play TTA in MKA

zo came camezo at gmail.com
Mon Nov 20 16:37:17 CET 2006


Sorry, I try again...
-------------- next part --------------
Index: libmpdemux/matroska.h
===================================================================
--- libmpdemux/matroska.h	(revision 21097)
+++ libmpdemux/matroska.h	(working copy)
@@ -35,6 +35,7 @@
 #define MKV_A_QDMC       "A_QUICKTIME/QDMC"
 #define MKV_A_QDMC2      "A_QUICKTIME/QDM2"
 #define MKV_A_FLAC       "A_FLAC"
+#define MKV_A_TTA        "A_TTA1"
 
 #define MKV_V_MSCOMP     "V_MS/VFW/FOURCC"
 #define MKV_V_REALV10    "V_REAL/RV10"
Index: libmpdemux/demux_mkv.c
===================================================================
--- libmpdemux/demux_mkv.c	(revision 21097)
+++ libmpdemux/demux_mkv.c	(working copy)
@@ -2068,6 +2068,10 @@
             }
           track->a_formattag = mmioFOURCC ('f', 'L', 'a', 'C');
         }
+      else if (!strcmp(track->codec_id, MKV_A_TTA))
+        {
+		track->a_formattag = 0x77A1;
+        }
       else if (track->private_size >= sizeof (real_audio_v4_props_t))
         {
           if (!strcmp(track->codec_id, MKV_A_REAL28))
@@ -2307,6 +2311,37 @@
       dp->flags = 0;
       ds_add_packet (demuxer->audio, dp);
     }
+  else if (track->a_formattag == 0x77A1)  /* TTA */
+    {
+      /* Create TTA Header. not sure */
+      struct __attribute__((__packed__)) {
+        char format[4];
+        uint16_t aformat;
+        uint16_t channels;
+        uint16_t bps;
+        uint32_t sfreq;
+        uint32_t slen;
+        uint32_t crc; /*dummy*/
+        uint32_t seektable[2]; /*dummy*/
+      } tta_head; /* need sizeof >= 30 */
+      sh_a->wf->nAvgBytesPerSec = sh_a->channels * sh_a->samplerate*2;
+      sh_a->wf->nBlockAlign = sh_a->wf->nAvgBytesPerSec;
+      sh_a->format = mmioFOURCC('T', 'T', 'A', '1');
+      sh_a->wf->cbSize = sizeof(tta_head);
+      sh_a->wf = realloc (sh_a->wf,
+                          sizeof (WAVEFORMATEX) + sh_a->wf->cbSize);
+      memcpy(&tta_head.format[0],(char *)&(sh_a->format),4);
+#define FORMAT_INT 1
+      tta_head.aformat = le2me_16(FORMAT_INT);
+      tta_head.channels = le2me_16(track->a_channels);
+      tta_head.bps = le2me_16(track->a_bps);
+      tta_head.sfreq = le2me_32((uint32_t)(track->a_sfreq));
+      tta_head.slen = le2me_32((uint32_t)(mkv_d->duration * track->a_sfreq));
+      tta_head.crc = le2me_32(0);
+      tta_head.seektable[0] = le2me_32(0);
+      tta_head.seektable[1] = le2me_32(0);
+      memcpy((char *)(sh_a->wf + 1),(char *)&tta_head,sh_a->wf->cbSize);
+    }
   else if (!track->ms_compat || (track->private_size < sizeof(WAVEFORMATEX)))
     {
       free_sh_audio(demuxer, track->tnum);


More information about the MPlayer-dev-eng mailing list