comparison libmpdemux/muxer_lavf.c @ 26695:1af41774481b

AVOptions support for lavf muxing.
author michael
date Sat, 10 May 2008 19:22:41 +0000
parents 8aaa8fadc36c
children b5e7063ffade
comparison
equal deleted inserted replaced
26694:75ec8833185c 26695:1af41774481b
8 #include "mp_msg.h" 8 #include "mp_msg.h"
9 #include "help_mp.h" 9 #include "help_mp.h"
10 10
11 #include "aviheader.h" 11 #include "aviheader.h"
12 #include "ms_hdr.h" 12 #include "ms_hdr.h"
13 #include "av_opts.h"
13 14
14 #include "stream/stream.h" 15 #include "stream/stream.h"
15 #include "muxer.h" 16 #include "muxer.h"
16 #include "demuxer.h" 17 #include "demuxer.h"
17 #include "stheader.h" 18 #include "stheader.h"
48 static char *conf_format = NULL; 49 static char *conf_format = NULL;
49 static int mux_rate= 0; 50 static int mux_rate= 0;
50 static int mux_packet_size= 0; 51 static int mux_packet_size= 0;
51 static float mux_preload= 0.5; 52 static float mux_preload= 0.5;
52 static float mux_max_delay= 0.7; 53 static float mux_max_delay= 0.7;
54 static char *mux_avopt = NULL;
53 55
54 m_option_t lavfopts_conf[] = { 56 m_option_t lavfopts_conf[] = {
55 {"format", &(conf_format), CONF_TYPE_STRING, 0, 0, 0, NULL}, 57 {"format", &(conf_format), CONF_TYPE_STRING, 0, 0, 0, NULL},
56 {"muxrate", &mux_rate, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL}, 58 {"muxrate", &mux_rate, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
57 {"packetsize", &mux_packet_size, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL}, 59 {"packetsize", &mux_packet_size, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
58 {"preload", &mux_preload, CONF_TYPE_FLOAT, CONF_RANGE, 0, INT_MAX, NULL}, 60 {"preload", &mux_preload, CONF_TYPE_FLOAT, CONF_RANGE, 0, INT_MAX, NULL},
59 {"delay", &mux_max_delay, CONF_TYPE_FLOAT, CONF_RANGE, 0, INT_MAX, NULL}, 61 {"delay", &mux_max_delay, CONF_TYPE_FLOAT, CONF_RANGE, 0, INT_MAX, NULL},
62 {"o", &mux_avopt, CONF_TYPE_STRING, 0, 0, 0, NULL},
60 63
61 {NULL, NULL, 0, 0, 0, 0, NULL} 64 {NULL, NULL, 0, 0, 0, 0, NULL}
62 }; 65 };
63 66
64 static muxer_t *priv_data; // This should be transmitted to mp_open() through the filename 67 static muxer_t *priv_data; // This should be transmitted to mp_open() through the filename
390 av_strlcpy(priv->oc->genre , info_genre, sizeof(priv->oc->genre )); 393 av_strlcpy(priv->oc->genre , info_genre, sizeof(priv->oc->genre ));
391 if (info_copyright) 394 if (info_copyright)
392 av_strlcpy(priv->oc->copyright, info_copyright, sizeof(priv->oc->copyright)); 395 av_strlcpy(priv->oc->copyright, info_copyright, sizeof(priv->oc->copyright));
393 if (info_comment) 396 if (info_comment)
394 av_strlcpy(priv->oc->comment , info_comment, sizeof(priv->oc->comment )); 397 av_strlcpy(priv->oc->comment , info_comment, sizeof(priv->oc->comment ));
398
399 if(mux_avopt){
400 if(parse_avopts(priv->oc, mux_avopt) < 0){
401 mp_msg(MSGT_MUXER,MSGL_ERR, "Your options /%s/ look like gibberish to me pal\n", mux_avopt);
402 goto fail;
403 }
404 }
405
395 register_protocol(&mp_protocol); 406 register_protocol(&mp_protocol);
396 407
397 priv_data= muxer; 408 priv_data= muxer;
398 if(url_fopen(&priv->oc->pb, mp_filename, URL_WRONLY)) 409 if(url_fopen(&priv->oc->pb, mp_filename, URL_WRONLY))
399 { 410 {