[Mplayer-cvslog] CVS: main/libmpcodecs ad_dvdpcm.c,1.4,1.5

Arpi of Ize arpi at mplayerhq.hu
Wed Oct 9 00:56:46 CEST 2002


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv8051

Modified Files:
	ad_dvdpcm.c 
Log Message:
parse samplerate & channels from LPCM header


Index: ad_dvdpcm.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_dvdpcm.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ad_dvdpcm.c	31 Aug 2002 13:09:23 -0000	1.4
+++ ad_dvdpcm.c	8 Oct 2002 22:56:43 -0000	1.5
@@ -19,11 +19,23 @@
 static int init(sh_audio_t *sh)
 {
 /* DVD PCM Audio:*/
-    sh->channels=2;
-    sh->samplerate=48000;
-    sh->i_bps=2*2*48000;
-/*    sh_audio->pcm_bswap=1;*/
-  return 1;
+    if(sh->codecdata_len==3){
+	// we have LPCM header:
+	unsigned char h=sh->codecdata[1];
+	sh->channels=1+(h&7);
+	switch((h>>4)&3){
+	case 0: sh->samplerate=48000;break;
+	case 1: sh->samplerate=96000;break;
+	case 2: sh->samplerate=44100;break;
+	case 3: sh->samplerate=32000;break;
+	}
+    } else {
+	// use defaults:
+	sh->channels=2;
+	sh->samplerate=48000;
+    }
+    sh->i_bps=2*sh->channels*sh->samplerate;
+    return 1;
 }
 
 static int preinit(sh_audio_t *sh)




More information about the MPlayer-cvslog mailing list