comparison libmpdemux/muxer_lavf.c @ 34539:88bd2174f616

Set muxrate and preload via AVDictionary.
author reimar
date Sat, 28 Jan 2012 12:57:58 +0000
parents 4b2275e890ac
children 2b07cfa69882
comparison
equal deleted inserted replaced
34538:4b2275e890ac 34539:88bd2174f616
279 279
280 280
281 static void write_header(muxer_t *muxer) 281 static void write_header(muxer_t *muxer)
282 { 282 {
283 muxer_priv_t *priv = muxer->priv; 283 muxer_priv_t *priv = muxer->priv;
284 AVDictionary *opts = NULL;
285 char tmpstr[50];
284 286
285 mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingHeader); 287 mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingHeader);
286 avformat_write_header(priv->oc, NULL); 288 if (mux_rate) {
289 snprintf(tmpstr, sizeof(tmpstr), "%i", mux_rate);
290 av_dict_set(&opts, "muxrate", tmpstr, 0);
291 }
292 if (mux_preload) {
293 snprintf(tmpstr, sizeof(tmpstr), "%i", (int)(mux_preload * AV_TIME_BASE));
294 av_dict_set(&opts, "preload", tmpstr, 0);
295 }
296 avformat_write_header(priv->oc, &opts);
297 av_dict_free(&opts);
287 muxer->cont_write_header = NULL; 298 muxer->cont_write_header = NULL;
288 } 299 }
289 300
290 301
291 static void write_trailer(muxer_t *muxer) 302 static void write_trailer(muxer_t *muxer)
353 } 364 }
354 priv->oc->oformat = fmt; 365 priv->oc->oformat = fmt;
355 366
356 367
357 priv->oc->packet_size= mux_packet_size; 368 priv->oc->packet_size= mux_packet_size;
358 priv->oc->mux_rate= mux_rate;
359 priv->oc->preload= (int)(mux_preload*AV_TIME_BASE);
360 priv->oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE); 369 priv->oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);
361 if (info_name) 370 if (info_name)
362 av_dict_set(&priv->oc->metadata, "title", info_name, 0); 371 av_dict_set(&priv->oc->metadata, "title", info_name, 0);
363 if (info_artist) 372 if (info_artist)
364 av_dict_set(&priv->oc->metadata, "author", info_artist, 0); 373 av_dict_set(&priv->oc->metadata, "author", info_artist, 0);