[MPlayer-dev-eng] [PATCH]ffmp3 inited sample_rate problem

qwen dux qwendu at gmail.com
Fri Mar 17 04:01:14 CET 2006


hi,
There was a error when mplayer played some movies with mp3 audio
codec.themovie has 41khz audio sample_rate,mp3lib and libmad decode
normal,but ffmp3
decode 32khz by mistake.I found there is #if 1 in line 112 of the
ad_ffmpeg.c,the audio sample_rate(lavc_context->sample_rate) may be
rewritten on  decode_audio function, so I modified the code as follows:

Index: ad_ffmpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_ffmpeg.c,v
retrieving revision 1.22
diff -u -r1.22 ad_ffmpeg.c
--- ad_ffmpeg.c 31 Jan 2006 23:36:12 -0000      1.22
+++ ad_ffmpeg.c 17 Mar 2006 02:58:18 -0000
@@ -109,15 +109,14 @@
    x=decode_audio(sh_audio,sh_audio->a_buffer,1,sh_audio->a_buffer_size);
    if(x>0) sh_audio->a_buffer_len=x;

-#if 1
   sh_audio->channels=lavc_context->channels;
   sh_audio->samplerate=lavc_context->sample_rate;
   sh_audio->i_bps=lavc_context->bit_rate/8;
-#else
-  sh_audio->channels=sh_audio->wf->nChannels;
-  sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
-  sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
-#endif
+  if(sh_audio->wf){
+      sh_audio->channels=sh_audio->wf->nChannels;
+      sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
+      sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
+  }
   sh_audio->samplesize=2;
   return 1;
 }

Any comments or suggestions will be welcome!



More information about the MPlayer-dev-eng mailing list