comparison libmpdemux/demux_lavf.c @ 26696:53b6cf6b971d

AVOption support for lavf demuxing
author michael
date Sat, 10 May 2008 19:29:38 +0000
parents 38b8096cae32
children 0c1db5fd3f79
comparison
equal deleted inserted replaced
26695:1af41774481b 26696:53b6cf6b971d
22 #include <limits.h> 22 #include <limits.h>
23 23
24 #include "config.h" 24 #include "config.h"
25 #include "mp_msg.h" 25 #include "mp_msg.h"
26 #include "help_mp.h" 26 #include "help_mp.h"
27 #include "av_opts.h"
27 28
28 #include "stream/stream.h" 29 #include "stream/stream.h"
29 #include "demuxer.h" 30 #include "demuxer.h"
30 #include "stheader.h" 31 #include "stheader.h"
31 #include "m_option.h" 32 #include "m_option.h"
47 static unsigned int opt_probesize = 0; 48 static unsigned int opt_probesize = 0;
48 static unsigned int opt_analyzeduration = 0; 49 static unsigned int opt_analyzeduration = 0;
49 static char *opt_format; 50 static char *opt_format;
50 static char *opt_cryptokey; 51 static char *opt_cryptokey;
51 extern int ts_prog; 52 extern int ts_prog;
53 static char *opt_avopt = NULL;
52 54
53 const m_option_t lavfdopts_conf[] = { 55 const m_option_t lavfdopts_conf[] = {
54 {"probesize", &(opt_probesize), CONF_TYPE_INT, CONF_RANGE, 32, INT_MAX, NULL}, 56 {"probesize", &(opt_probesize), CONF_TYPE_INT, CONF_RANGE, 32, INT_MAX, NULL},
55 {"format", &(opt_format), CONF_TYPE_STRING, 0, 0, 0, NULL}, 57 {"format", &(opt_format), CONF_TYPE_STRING, 0, 0, 0, NULL},
56 {"analyzeduration", &(opt_analyzeduration), CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL}, 58 {"analyzeduration", &(opt_analyzeduration), CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
57 {"cryptokey", &(opt_cryptokey), CONF_TYPE_STRING, 0, 0, 0, NULL}, 59 {"cryptokey", &(opt_cryptokey), CONF_TYPE_STRING, 0, 0, 0, NULL},
60 {"o", &opt_avopt, CONF_TYPE_STRING, 0, 0, 0, NULL},
58 {NULL, NULL, 0, 0, 0, 0, NULL} 61 {NULL, NULL, 0, 0, 0, 0, NULL}
59 }; 62 };
60 63
61 #define BIO_BUFFER_SIZE 32768 64 #define BIO_BUFFER_SIZE 32768
62 65
433 if(opt_analyzeduration) { 436 if(opt_analyzeduration) {
434 opt = av_set_int(avfc, "analyzeduration", opt_analyzeduration * AV_TIME_BASE); 437 opt = av_set_int(avfc, "analyzeduration", opt_analyzeduration * AV_TIME_BASE);
435 if(!opt) mp_msg(MSGT_HEADER,MSGL_ERR, "demux_lavf, couldn't set option analyzeduration to %u\n", opt_analyzeduration); 438 if(!opt) mp_msg(MSGT_HEADER,MSGL_ERR, "demux_lavf, couldn't set option analyzeduration to %u\n", opt_analyzeduration);
436 } 439 }
437 440
441 if(opt_avopt){
442 if(parse_avopts(avfc, opt_avopt) < 0){
443 mp_msg(MSGT_HEADER,MSGL_ERR, "Your options /%s/ look like gibberish to me pal\n", opt_avopt);
444 return NULL;
445 }
446 }
447
438 if(demuxer->stream->url) 448 if(demuxer->stream->url)
439 strncpy(mp_filename + 3, demuxer->stream->url, sizeof(mp_filename)-3); 449 strncpy(mp_filename + 3, demuxer->stream->url, sizeof(mp_filename)-3);
440 else 450 else
441 strncpy(mp_filename + 3, "foobar.dummy", sizeof(mp_filename)-3); 451 strncpy(mp_filename + 3, "foobar.dummy", sizeof(mp_filename)-3);
442 452