changeset 13427:9d0b052c4f74

setting samplesize to 2 in decoders where neccessary. Needed because initialization of sh_audio was moved from dec_audio to demuxer.c, and some demuxers set samplesize incorrect or to 0.
author reimar
date Tue, 21 Sep 2004 20:34:47 +0000
parents 0f92ad66bbb5
children d1cdcd974606
files libmpcodecs/ad_acm.c libmpcodecs/ad_alaw.c libmpcodecs/ad_dk3adpcm.c libmpcodecs/ad_dmo.c libmpcodecs/ad_dshow.c libmpcodecs/ad_faad.c libmpcodecs/ad_ffmpeg.c libmpcodecs/ad_imaadpcm.c libmpcodecs/ad_liba52.c libmpcodecs/ad_libmad.c libmpcodecs/ad_mp3lib.c libmpcodecs/ad_msadpcm.c libmpcodecs/ad_msgsm.c
diffstat 13 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_acm.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_acm.c	Tue Sep 21 20:34:47 2004 +0000
@@ -127,6 +127,7 @@
     sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
     sh_audio->channels=priv->o_wf->nChannels;
     sh_audio->samplerate=priv->o_wf->nSamplesPerSec;
+    sh_audio->samplesize=2;
 
     mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/ACM audio codec init OK!\n");
     return 1;
--- a/libmpcodecs/ad_alaw.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_alaw.c	Tue Sep 21 20:34:47 2004 +0000
@@ -25,6 +25,7 @@
   sh_audio->channels=sh_audio->wf->nChannels;
   sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
   sh_audio->i_bps=sh_audio->channels*sh_audio->samplerate;
+  sh_audio->samplesize=2;
   return 1;
 }
 
--- a/libmpcodecs/ad_dk3adpcm.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_dk3adpcm.c	Tue Sep 21 20:34:47 2004 +0000
@@ -84,6 +84,7 @@
   sh_audio->samplerate = sh_audio->wf->nSamplesPerSec;
   sh_audio->i_bps =
     (sh_audio->ds->ss_mul * sh_audio->samplerate) / sh_audio->ds->ss_div;
+  sh_audio->samplesize=2;
   return 1;
 }
 
--- a/libmpcodecs/ad_dmo.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_dmo.c	Tue Sep 21 20:34:47 2004 +0000
@@ -43,6 +43,7 @@
     sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
     sh_audio->channels=chans;
     sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
+    sh_audio->samplesize=2;
     sh_audio->audio_in_minsize=4*sh_audio->wf->nBlockAlign;
     if(sh_audio->audio_in_minsize<8192) sh_audio->audio_in_minsize=8192;
     sh_audio->audio_out_minsize=4*16384;
--- a/libmpcodecs/ad_dshow.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_dshow.c	Tue Sep 21 20:34:47 2004 +0000
@@ -39,6 +39,7 @@
     sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
     sh_audio->channels=sh_audio->wf->nChannels;
     sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
+    sh_audio->samplesize=2;
     sh_audio->audio_in_minsize=2*sh_audio->wf->nBlockAlign;
     if(sh_audio->audio_in_minsize<8192) sh_audio->audio_in_minsize=8192;
     sh_audio->audio_out_minsize=16384;
--- a/libmpcodecs/ad_faad.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_faad.c	Tue Sep 21 20:34:47 2004 +0000
@@ -71,11 +71,11 @@
     /* XXX: FAAD support FLOAT output, how do we handle
       * that (FAAD_FMT_FLOAT)? ::atmos
       */
-    if(sh->samplesize)
       switch(sh->samplesize){
 	case 1: // 8Bit
 	  mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: 8Bit samplesize not supported by FAAD, assuming 16Bit!\n");
 	default:
+	  sh->samplesize=2;
 	case 2: // 16Bit
 	  faac_conf->outputFormat = FAAD_FMT_16BIT;
 	  break;
@@ -123,6 +123,7 @@
     mp_msg(MSGT_DECAUDIO,MSGL_V,"FAAD: Negotiated samplerate: %dHz  channels: %d\n", faac_samplerate, faac_channels);
     sh->channels = faac_channels;
     sh->samplerate = faac_samplerate;
+    sh->samplesize=2;
     //sh->o_bps = sh->samplesize*faac_channels*faac_samplerate;
     if(!sh->i_bps) {
       mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: compressed input bitrate missing, assuming 128kbit/s!\n");
--- a/libmpcodecs/ad_ffmpeg.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_ffmpeg.c	Tue Sep 21 20:34:47 2004 +0000
@@ -110,6 +110,7 @@
   sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
   sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
 #endif
+  sh_audio->samplesize=2;
   return 1;
 }
 
--- a/libmpcodecs/ad_imaadpcm.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_imaadpcm.c	Tue Sep 21 20:34:47 2004 +0000
@@ -111,6 +111,7 @@
   /* decodes 34 byte -> 64 short*/
   sh_audio->i_bps = 
     (sh_audio->ds->ss_mul * sh_audio->samplerate) / sh_audio->ds->ss_div;
+  sh_audio->samplesize=2;
 
   return 1;
 }
--- a/libmpcodecs/ad_liba52.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_liba52.c	Tue Sep 21 20:34:47 2004 +0000
@@ -67,6 +67,7 @@
     mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"a52: len=%d  flags=0x%X  %d Hz %d bit/s\n",length,flags,sample_rate,bit_rate);
     sh_audio->samplerate=sample_rate;
     sh_audio->i_bps=bit_rate/8;
+    sh_audio->samplesize=2;
     demux_read_data(sh_audio->ds,sh_audio->a_in_buffer+8,length-8);
     if(sh_audio->format!=0x2000)
 	swab(sh_audio->a_in_buffer+8,sh_audio->a_in_buffer+8,length-8);
--- a/libmpcodecs/ad_libmad.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_libmad.c	Tue Sep 21 20:34:47 2004 +0000
@@ -88,6 +88,7 @@
   sh->channels=(this->frame.header.mode == MAD_MODE_SINGLE_CHANNEL) ? 1 : 2;
   sh->samplerate=this->frame.header.samplerate;
   sh->i_bps=this->frame.header.bitrate/8;
+  sh_audio->samplesize=2;
   
   return 1;
 }
--- a/libmpcodecs/ad_mp3lib.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_mp3lib.c	Tue Sep 21 20:34:47 2004 +0000
@@ -50,6 +50,7 @@
   sh->a_buffer_len=MP3_DecodeFrame(sh->a_buffer,-1);
   if(!sh->a_buffer_len) return 0; // unsupported layer/format
   sh->channels=2; // hack
+  sh->samplesize=2;
   sh->samplerate=MP3_samplerate;
   sh->i_bps=MP3_bitrate*(1000/8);
   MP3_PrintHeader();
--- a/libmpcodecs/ad_msadpcm.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_msadpcm.c	Tue Sep 21 20:34:47 2004 +0000
@@ -78,6 +78,7 @@
   sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
   sh_audio->i_bps = sh_audio->wf->nBlockAlign *
     (sh_audio->channels*sh_audio->samplerate) / sh_audio->ds->ss_div;
+  sh_audio->samplesize=2;
 
   return 1;
 }
--- a/libmpcodecs/ad_msgsm.c	Tue Sep 21 19:50:54 2004 +0000
+++ b/libmpcodecs/ad_msgsm.c	Tue Sep 21 20:34:47 2004 +0000
@@ -25,6 +25,7 @@
   GSM_Init();
   sh_audio->channels=sh_audio->wf->nChannels;
   sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
+  sh_audio->samplesize=2;
   // decodes 65 byte -> 320 short
   // 1 sec: sh_audio->channels*sh_audio->samplerate  samples
   // 1 frame: 320 samples