comparison libmpdemux/demux_lavf.c @ 24635:0ad5adc5f363

analyzeduration option for lavf demuxer
author henry
date Sat, 29 Sep 2007 07:55:43 +0000
parents 221ad386f6e4
children 46dbc2e8c800
comparison
equal deleted inserted replaced
24634:221ad386f6e4 24635:0ad5adc5f363
45 45
46 #define PROBE_BUF_SIZE 2048 46 #define PROBE_BUF_SIZE 2048
47 47
48 extern char *audio_lang; 48 extern char *audio_lang;
49 static unsigned int opt_probesize = 0; 49 static unsigned int opt_probesize = 0;
50 static unsigned int opt_analyzeduration = 0;
50 static char *opt_format; 51 static char *opt_format;
51 52
52 m_option_t lavfdopts_conf[] = { 53 m_option_t lavfdopts_conf[] = {
53 {"probesize", &(opt_probesize), CONF_TYPE_INT, CONF_RANGE, 32, INT_MAX, NULL}, 54 {"probesize", &(opt_probesize), CONF_TYPE_INT, CONF_RANGE, 32, INT_MAX, NULL},
54 {"format", &(opt_format), CONF_TYPE_STRING, 0, 0, 0, NULL}, 55 {"format", &(opt_format), CONF_TYPE_STRING, 0, 0, 0, NULL},
56 {"analyzeduration", &(opt_analyzeduration), CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
55 {NULL, NULL, 0, 0, 0, 0, NULL} 57 {NULL, NULL, 0, 0, 0, 0, NULL}
56 }; 58 };
57 59
58 60
59 typedef struct lavf_priv_t{ 61 typedef struct lavf_priv_t{
270 272
271 ap.prealloced_context = 1; 273 ap.prealloced_context = 1;
272 if(opt_probesize) { 274 if(opt_probesize) {
273 opt = av_set_int(avfc, "probesize", opt_probesize); 275 opt = av_set_int(avfc, "probesize", opt_probesize);
274 if(!opt) mp_msg(MSGT_HEADER,MSGL_ERR, "demux_lavf, couldn't set option probesize to %u\n", opt_probesize); 276 if(!opt) mp_msg(MSGT_HEADER,MSGL_ERR, "demux_lavf, couldn't set option probesize to %u\n", opt_probesize);
277 }
278 if(opt_analyzeduration) {
279 opt = av_set_int(avfc, "analyzeduration", opt_analyzeduration * AV_TIME_BASE);
280 if(!opt) mp_msg(MSGT_HEADER,MSGL_ERR, "demux_lavf, couldn't set option analyzeduration to %u\n", opt_analyzeduration);
275 } 281 }
276 282
277 if(demuxer->stream->url) 283 if(demuxer->stream->url)
278 strncpy(mp_filename + 3, demuxer->stream->url, sizeof(mp_filename)-3); 284 strncpy(mp_filename + 3, demuxer->stream->url, sizeof(mp_filename)-3);
279 else 285 else