[MPlayer-cvslog] CVS: main/libmpdemux muxer_lavf.c, 1.17, 1.18 muxer.h, 1.16, 1.17

Michael Niedermayer CVS syncmail at mplayerhq.hu
Wed Jan 25 02:17:59 CET 2006


CVS change done by Michael Niedermayer CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv23800/libmpdemux

Modified Files:
	muxer_lavf.c muxer.h 
Log Message:
pass vbv_size & max_rate from encoder to muxer over muxer_stream_t (if this is wrong/silly/10000000l then dont hesitate to flame / reverse)
make a few things like mux_rate, mux_max_delay, ... user settable
fixed buffer underflow errors when muxing to mpeg-ps


Index: muxer_lavf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/muxer_lavf.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- muxer_lavf.c	24 Jan 2006 23:55:43 -0000	1.17
+++ muxer_lavf.c	25 Jan 2006 01:17:57 -0000	1.18
@@ -43,10 +43,19 @@
 
 static char *conf_format = NULL;
 static int conf_allow_lavf = 0;
+static int mux_rate= 0;
+static int mux_packet_size= 0;
+static float mux_preload= 0.5;
+static float mux_max_delay= 0.7;
 
 m_option_t lavfopts_conf[] = {
 	{"format", &(conf_format), CONF_TYPE_STRING, 0, 0, 0, NULL},
 	{"i_certify_that_my_video_stream_does_not_use_b_frames", &conf_allow_lavf, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+	{"muxrate", &mux_rate, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
+	{"packetsize", &mux_packet_size, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
+	{"preload", &mux_preload, CONF_TYPE_FLOAT, CONF_RANGE, 0, INT_MAX, NULL},
+	{"delay", &mux_max_delay, CONF_TYPE_FLOAT, CONF_RANGE, 0, INT_MAX, NULL},
+
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
 
@@ -173,12 +182,16 @@
 	ctx = &(spriv->avstream->codec);
 #endif
 	
+        if(stream->wf && stream->wf->nAvgBytesPerSec)
+            ctx->bit_rate = stream->wf->nAvgBytesPerSec * 8;
+        ctx->rc_buffer_size= stream->vbv_size;
+        ctx->rc_max_rate= stream->max_rate;
+
 	if(stream->type == MUXER_TYPE_AUDIO)
 	{
 		ctx->codec_id = codec_get_wav_id(stream->wf->wFormatTag); 
 		ctx->codec_tag = codec_get_wav_tag(ctx->codec_id);
 		mp_msg(MSGT_MUXER, MSGL_INFO, "AUDIO CODEC ID: %x, TAG: %x\n", ctx->codec_id, (uint32_t) ctx->codec_tag);
-		ctx->bit_rate = stream->wf->nAvgBytesPerSec * 8;
 		ctx->sample_rate = stream->wf->nSamplesPerSec;
 //                mp_msg(MSGT_MUXER, MSGL_INFO, "stream->h.dwSampleSize: %d\n", stream->h.dwSampleSize);
 		ctx->channels = stream->wf->nChannels;
@@ -353,7 +366,11 @@
 		mp_msg(MSGT_MUXER, MSGL_FATAL, "Invalid output format parameters\n");
 		goto fail;
 	}
-	
+	priv->oc->packet_size= mux_packet_size;
+        priv->oc->mux_rate= mux_rate;
+        priv->oc->preload= (int)(mux_preload*AV_TIME_BASE);
+        priv->oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);
+
 	register_protocol(&mp_protocol);
 
 	if(url_fopen(&priv->oc->pb, mp_filename, URL_WRONLY))

Index: muxer.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/muxer.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- muxer.h	21 Nov 2005 22:53:14 -0000	1.16
+++ muxer.h	25 Jan 2006 01:17:57 -0000	1.17
@@ -43,6 +43,9 @@
   // muxer of that stream
   struct muxer_t *muxer;
   void *priv; // private stream specific data stored by the muxer
+
+  int vbv_size;
+  int max_rate;
 } muxer_stream_t;
 
 typedef struct {




More information about the MPlayer-cvslog mailing list