changeset 34539:88bd2174f616

Set muxrate and preload via AVDictionary.
author reimar
date Sat, 28 Jan 2012 12:57:58 +0000
parents 4b2275e890ac
children 2b07cfa69882
files libmpdemux/muxer_lavf.c
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/muxer_lavf.c	Sat Jan 28 12:52:23 2012 +0000
+++ b/libmpdemux/muxer_lavf.c	Sat Jan 28 12:57:58 2012 +0000
@@ -281,9 +281,20 @@
 static void write_header(muxer_t *muxer)
 {
 	muxer_priv_t *priv = muxer->priv;
+	AVDictionary *opts = NULL;
+	char tmpstr[50];
 
 	mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingHeader);
-	avformat_write_header(priv->oc, NULL);
+	if (mux_rate) {
+		snprintf(tmpstr, sizeof(tmpstr), "%i", mux_rate);
+		av_dict_set(&opts, "muxrate", tmpstr, 0);
+	}
+	if (mux_preload) {
+		snprintf(tmpstr, sizeof(tmpstr), "%i", (int)(mux_preload * AV_TIME_BASE));
+		av_dict_set(&opts, "preload", tmpstr, 0);
+	}
+	avformat_write_header(priv->oc, &opts);
+	av_dict_free(&opts);
 	muxer->cont_write_header = NULL;
 }
 
@@ -355,8 +366,6 @@
 
 
 	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);
         if (info_name)
             av_dict_set(&priv->oc->metadata, "title",     info_name,      0);