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

zo came camezo at gmail.com
Tue Nov 21 19:32:25 CET 2006


Hi

> This does:
> track->a_formattag = mmioFOURCC('T', 'T', 'A', '1')
I revised it according to your indication.

> Not sure about what?
I am not sure why tta played well.
It may be related to your thought.
I withdraw my patch if you think that somebody should modify decoder
not demuxer.
-------------- next part --------------
Index: libmpdemux/matroska.h
===================================================================
--- libmpdemux/matroska.h	(revision 21135)
+++ 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 21135)
+++ 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 = mmioFOURCC('T', 'T', 'A', '1');
+        }
       else if (track->private_size >= sizeof (real_audio_v4_props_t))
         {
           if (!strcmp(track->codec_id, MKV_A_REAL28))
@@ -2307,6 +2311,30 @@
       dp->flags = 0;
       ds_add_packet (demuxer->audio, dp);
     }
+  else if (track->a_formattag == mmioFOURCC('T', 'T', 'A', '1')) /* TTA */
+    {
+      /* Create TTA Header. wFormatTag = 0x77A1 */
+      enum { TTAH_FORMAT=0, TTAH_AFORMAT=4, TTAH_CHANNELS=6, TTAH_BPS=8,
+      TTAH_SFREQ=10, TTAH_SLEN=14, TTAH_CRC=18, TTAH_SEEKTABLE=22,
+      TTAH_SEEKTABLE2=26, TTAH_SIZE=30 };
+      sh_a->wf->nAvgBytesPerSec = sh_a->channels * sh_a->samplerate*2;
+      sh_a->wf->nBlockAlign = sh_a->wf->nAvgBytesPerSec;
+      sh_a->wf->cbSize = TTAH_SIZE; /* need over 30 */
+      sh_a->wf = realloc (sh_a->wf,
+                          sizeof (WAVEFORMATEX) + sh_a->wf->cbSize);
+#define TTAH_SET16(a,b) {uint16_t w16=le2me_16(b); memcpy((char *)(sh_a->wf + 1)+(a),&w16,2);}
+#define TTAH_SET32(a,b) {uint32_t w32=le2me_32(b); memcpy((char *)(sh_a->wf + 1)+(a),&w32,4);}
+      memcpy((char *)(sh_a->wf + 1)+TTAH_FORMAT,&(sh_a->format),4);
+#define FORMAT_INT 1
+      TTAH_SET16(TTAH_AFORMAT,FORMAT_INT);
+      TTAH_SET16(TTAH_CHANNELS,track->a_channels);
+      TTAH_SET16(TTAH_BPS,track->a_bps);
+      TTAH_SET32(TTAH_SFREQ,track->a_sfreq);
+      TTAH_SET32(TTAH_SLEN,(uint32_t)ceil(mkv_d->duration * track->a_sfreq));
+      TTAH_SET32(TTAH_CRC,0); /*dummy*/
+      TTAH_SET32(TTAH_SEEKTABLE,0); /*dummy*/
+      TTAH_SET32(TTAH_SEEKTABLE2,0); /*dummy*/
+    }
   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