[MPlayer-dev-eng] [PATCH] Proper flac bitrate

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Aug 25 15:18:06 CEST 2007


Hello,
On Sat, Aug 25, 2007 at 05:01:21PM +0400, Andrew Savchenko wrote:
[...]
> Original parameters are obtained at libmpdemux/demux_audio.c, but 
> samplerate and bitrate are incorrectly redefined later at 
> libmpcodecs/ad_ffmpeg.c:115; or to be more exact they are changed 
> to lavc fallback defaults, because of (WAVEFORMATEX*)wf structure 
> is undefined for FLAC streams.
> 
> So I defined wf data required for proper bitrate and track length 
> calculation at demux_audio.c, please review an attached patch.

Fixing ad_ffmpeg makes much more sense in my eyes. Does this patch work?

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpcodecs/ad_ffmpeg.c
===================================================================
--- libmpcodecs/ad_ffmpeg.c	(revision 24172)
+++ libmpcodecs/ad_ffmpeg.c	(working copy)
@@ -59,6 +59,8 @@
     lavc_context = avcodec_alloc_context();
     sh_audio->context=lavc_context;
 
+    lavc_context->sample_rate = sh_audio->samplerate;
+    lavc_context->bit_rate = sh_audio->i_bps * 8;
     if(sh_audio->wf){
 	lavc_context->channels = sh_audio->wf->nChannels;
 	lavc_context->sample_rate = sh_audio->wf->nSamplesPerSec;


More information about the MPlayer-dev-eng mailing list