changeset 19360:d4d72e5eea07

pass average bitrate from encoder to (lavf) muxer this fixes some problems with muxing mp4 files for the psp
author michael
date Thu, 10 Aug 2006 21:48:41 +0000
parents 06e9e957ceca
children f38f0b2e3aa3
files libmpcodecs/ae_lavc.c libmpcodecs/ve_lavc.c libmpdemux/muxer.h libmpdemux/muxer_lavf.c
diffstat 4 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ae_lavc.c	Thu Aug 10 21:08:49 2006 +0000
+++ b/libmpcodecs/ae_lavc.c	Thu Aug 10 21:48:41 2006 +0000
@@ -38,6 +38,7 @@
 	mux_a->wf->nChannels = lavc_actx->channels;
 	mux_a->wf->nSamplesPerSec = lavc_actx->sample_rate;
 	mux_a->wf->nAvgBytesPerSec = (lavc_actx->bit_rate / 8);
+        mux_a->avg_rate= lavc_actx->bit_rate;
 	mux_a->h.dwRate = mux_a->wf->nAvgBytesPerSec;
 	if(lavc_actx->block_align)
 		mux_a->h.dwSampleSize = mux_a->h.dwScale = lavc_actx->block_align;
--- a/libmpcodecs/ve_lavc.c	Thu Aug 10 21:08:49 2006 +0000
+++ b/libmpcodecs/ve_lavc.c	Thu Aug 10 21:48:41 2006 +0000
@@ -331,7 +331,7 @@
     else
 	lavc_venc_context->bit_rate = 800000; /* default */
 
-    //mux_v->wf->nAvgBytesPerSec= lavc_venc_context->bit_rate/8;
+    mux_v->avg_rate= lavc_venc_context->bit_rate;
 
     lavc_venc_context->bit_rate_tolerance= lavc_param_vrate_tolerance*1000;
     lavc_venc_context->time_base= (AVRational){mux_v->h.dwScale, mux_v->h.dwRate};
--- a/libmpdemux/muxer.h	Thu Aug 10 21:08:49 2006 +0000
+++ b/libmpdemux/muxer.h	Thu Aug 10 21:48:41 2006 +0000
@@ -48,6 +48,7 @@
 
   int vbv_size;
   int max_rate;
+  int avg_rate;
 } muxer_stream_t;
 
 typedef struct {
--- a/libmpdemux/muxer_lavf.c	Thu Aug 10 21:08:49 2006 +0000
+++ b/libmpdemux/muxer_lavf.c	Thu Aug 10 21:48:41 2006 +0000
@@ -185,7 +185,8 @@
 	
 	ctx = spriv->avstream->codec;
 
-        if(stream->wf && stream->wf->nAvgBytesPerSec)
+        ctx->bit_rate= stream->avg_rate;
+        if(stream->wf && stream->wf->nAvgBytesPerSec && !ctx->bit_rate)
             ctx->bit_rate = stream->wf->nAvgBytesPerSec * 8;
         ctx->rc_buffer_size= stream->vbv_size;
         ctx->rc_max_rate= stream->max_rate;