changeset 13236:97a6f049c9f8

first attempt to make 24-bit PCM DVDs work
author reimar
date Fri, 03 Sep 2004 10:50:03 +0000
parents bc7cb8cf36b2
children f85c105bfeaa
files libmpcodecs/ad_dvdpcm.c
diffstat 1 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_dvdpcm.c	Fri Sep 03 00:08:58 2004 +0000
+++ b/libmpcodecs/ad_dvdpcm.c	Fri Sep 03 10:50:03 2004 +0000
@@ -4,6 +4,7 @@
 
 #include "config.h"
 #include "ad_internal.h"
+#include "../libaf/af_format.h"
 
 static ad_info_t info = 
 {
@@ -29,12 +30,28 @@
 	case 2: sh->samplerate=44100;break;
 	case 3: sh->samplerate=32000;break;
 	}
+	switch ((h >> 6) & 3) {
+	  case 0:
+	    sh->sample_format = AFMT_S16_BE;
+	    sh->samplesize = 2;
+	    break;
+	  case 2: 
+	    sh->sample_format = AFMT_AF_FLAGS | AF_FORMAT_I |
+	                         AF_FORMAT_BE | AF_FORMAT_US;
+	    sh->samplesize = 3;
+	    break;
+	  default:
+	    sh->sample_format = AFMT_S16_BE;
+	    sh->samplesize = 2;
+	}
     } else {
 	// use defaults:
 	sh->channels=2;
 	sh->samplerate=48000;
+	sh->sample_format = AFMT_S16_BE;
+	sh->samplesize = 2;
     }
-    sh->i_bps=2*sh->channels*sh->samplerate;
+    sh->i_bps = sh->samplesize * sh->channels * sh->samplerate;
     return 1;
 }
 
@@ -66,12 +83,5 @@
 {
   int j,len;
   len=demux_read_data(sh_audio->ds,buf,(minlen+3)&(~3));
-#ifndef WORDS_BIGENDIAN
-  for(j=0;j<len;j+=2){
-    char x=buf[j];
-    buf[j]=buf[j+1];
-    buf[j+1]=x;
-  }
-#endif
   return len;
 }