[Mplayer-cvslog] CVS: main/libmpdemux demux_audio.c, 1.25, 1.26 demuxer.c, 1.164, 1.165

Roberto Togni CVS syncmail at mplayerhq.hu
Thu Aug 12 14:36:10 CEST 2004


CVS change done by Roberto Togni CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv4825/libmpdemux

Modified Files:
	demux_audio.c demuxer.c 
Log Message:
DTS support via lavc and libdts
Patch by Aurelien Jacobs ( aurel at gnuage dot org )
dts in wav by me


Index: demux_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_audio.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- demux_audio.c	15 Apr 2004 20:48:27 -0000	1.25
+++ demux_audio.c	12 Aug 2004 12:36:08 -0000	1.26
@@ -206,6 +206,46 @@
     demuxer->movi_start = stream_tell(s);
     demuxer->movi_end = s->end_pos;
 //    printf("wav: %X .. %X\n",(int)demuxer->movi_start,(int)demuxer->movi_end);
+    // Check if it contains dts audio
+    if((w->wFormatTag == 0x01) && (w->nChannels == 2) && (w->nSamplesPerSec == 44100)) {
+	unsigned char buf[16384]; // vlc uses 16384*4 (4 dts frames)
+	unsigned int i;
+	stream_read(s, buf, sizeof(buf));
+	for (i = 0; i < sizeof(buf); i += 2) {
+	    // DTS, 14 bit, LE
+	    if((buf[i] == 0xff) && (buf[i+1] == 0x1f) && (buf[i+2] == 0x00) &&
+	       (buf[i+3] == 0xe8) && ((buf[i+4] & 0xfe) == 0xf0) && (buf[i+5] == 0x07)) {
+		sh_audio->format = 0x2001;
+		mp_msg(MSGT_DEMUX,MSGL_V,"[demux_audio] DTS audio in wav, 14 bit, LE\n");
+		break;
+	    }
+	    // DTS, 14 bit, BE
+	    if((buf[i] == 0x1f) && (buf[i+1] == 0xff) && (buf[i+2] == 0xe8) &&
+	       (buf[i+3] == 0x00) && (buf[i+4] == 0x07) && ((buf[i+5] & 0xfe) == 0xf0)) {
+		sh_audio->format = 0x2001;
+		mp_msg(MSGT_DEMUX,MSGL_V,"[demux_audio] DTS audio in wav, 14 bit, BE\n");
+		break;
+	    }
+	    // DTS, 16 bit, BE
+	    if((buf[i] == 0x7f) && (buf[i+1] == 0xfe) && (buf[i+2] == 0x80) &&
+	       (buf[i+3] == 0x01)) {
+		sh_audio->format = 0x2001;
+		mp_msg(MSGT_DEMUX,MSGL_V,"[demux_audio] DTS audio in wav, 16 bit, BE\n");
+		break;
+	    }
+	    // DTS, 16 bit, LE
+	    if((buf[i] == 0xfe) && (buf[i+1] == 0x7f) && (buf[i+2] == 0x01) &&
+	       (buf[i+3] == 0x80)) {
+		sh_audio->format = 0x2001;
+		mp_msg(MSGT_DEMUX,MSGL_V,"[demux_audio] DTS audio in wav, 16 bit, LE\n");
+		break;
+	    }
+	}
+	if (sh_audio->format == 0x2001)
+	    mp_msg(MSGT_DEMUX,MSGL_DBG2,"[demux_audio] DTS sync offset = %u\n", i);
+
+    }
+    stream_seek(s,demuxer->movi_start);
   } break;
   case fLaC:
 	    sh_audio->format = mmioFOURCC('f', 'L', 'a', 'C');

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -r1.164 -r1.165
--- demuxer.c	16 Jul 2004 20:31:17 -0000	1.164
+++ demuxer.c	12 Aug 2004 12:36:08 -0000	1.165
@@ -1308,7 +1308,8 @@
     switch(d_audio->id & 0xE0){  // 1110 0000 b  (high 3 bit: type  low 5: id)
       case 0x00: sh_audio->format=0x50;break; // mpeg
       case 0xA0: sh_audio->format=0x10001;break;  // dvd pcm
-      case 0x80: sh_audio->format=0x2000;break; // ac3
+      case 0x80: if((d_audio->id & 0xF8) == 0x88) sh_audio->format=0x2001;//dts
+                 else sh_audio->format=0x2000;break; // ac3
       default: sh_audio=NULL; // unknown type
     }
    }
@@ -1328,7 +1329,8 @@
     switch(d_audio->id & 0xE0){  // 1110 0000 b  (high 3 bit: type  low 5: id)
       case 0x00: sh_audio->format=0x50;break; // mpeg
       case 0xA0: sh_audio->format=0x10001;break;  // dvd pcm
-      case 0x80: sh_audio->format=0x2000;break; // ac3
+      case 0x80: if((d_audio->id & 0xF8) == 0x88) sh_audio->format=0x2001;//dts
+                 else sh_audio->format=0x2000;break; // ac3
       default: sh_audio=NULL; // unknown type
     }
    }




More information about the MPlayer-cvslog mailing list