summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-06-11 01:46:20 +0200
committerwm4 <wm4@nowhere>2014-06-11 01:46:20 +0200
commit654930aa47e10c07aa0399f515a8dd04d34efa3a (patch)
treed973ad7cac448ea9546ce5097a642dd1ff20234c
parent7f7aa03eda33c10264d72a674e6e7eadff052254 (diff)
downloadmpv-654930aa47e10c07aa0399f515a8dd04d34efa3a.tar.bz2
mpv-654930aa47e10c07aa0399f515a8dd04d34efa3a.tar.xz
demux_lavf: make option struct local
Similar to previous commits.
-rw-r--r--demux/demux_lavf.c50
-rw-r--r--options/options.c8
-rw-r--r--options/options.h13
3 files changed, 37 insertions, 34 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 4fb1ee3cb3..58b6c75483 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -57,25 +57,43 @@
#define INITIAL_PROBE_SIZE STREAM_BUFFER_SIZE
#define PROBE_BUF_SIZE FFMIN(STREAM_MAX_BUFFER_SIZE, 2 * 1024 * 1024)
-#define OPT_BASE_STRUCT struct MPOpts
// Should correspond to IO_BUFFER_SIZE in libavformat/aviobuf.c (not public)
// libavformat (almost) always reads data in blocks of this size.
#define BIO_BUFFER_SIZE 32768
-const m_option_t lavfdopts_conf[] = {
- OPT_INTRANGE("probesize", lavfdopts.probesize, 0, 32, INT_MAX),
- OPT_STRING("format", lavfdopts.format, 0),
- OPT_FLOATRANGE("analyzeduration", lavfdopts.analyzeduration, 0, 0, 3600),
- OPT_INTRANGE("buffersize", lavfdopts.buffersize, 0, 1, 10 * 1024 * 1024,
- OPTDEF_INT(BIO_BUFFER_SIZE)),
- OPT_FLAG("allow-mimetype", lavfdopts.allow_mimetype, 0),
- OPT_INTRANGE("probescore", lavfdopts.probescore, 0, 0, 100),
- OPT_STRING("cryptokey", lavfdopts.cryptokey, 0),
- OPT_CHOICE("genpts-mode", lavfdopts.genptsmode, 0,
- ({"lavf", 1}, {"no", 0})),
- OPT_STRING("o", lavfdopts.avopt, 0),
- {NULL, NULL, 0, 0, 0, 0, NULL}
+#define OPT_BASE_STRUCT struct demux_lavf_opts
+struct demux_lavf_opts {
+ int probesize;
+ int probescore;
+ float analyzeduration;
+ int buffersize;
+ int allow_mimetype;
+ char *format;
+ char *cryptokey;
+ char *avopt;
+ int genptsmode;
+};
+
+const struct m_sub_options demux_lavf_conf = {
+ .opts = (const m_option_t[]) {
+ OPT_INTRANGE("probesize", probesize, 0, 32, INT_MAX),
+ OPT_STRING("format", format, 0),
+ OPT_FLOATRANGE("analyzeduration", analyzeduration, 0, 0, 3600),
+ OPT_INTRANGE("buffersize", buffersize, 0, 1, 10 * 1024 * 1024,
+ OPTDEF_INT(BIO_BUFFER_SIZE)),
+ OPT_FLAG("allow-mimetype", allow_mimetype, 0),
+ OPT_INTRANGE("probescore", probescore, 0, 0, 100),
+ OPT_STRING("cryptokey", cryptokey, 0),
+ OPT_CHOICE("genpts-mode", genptsmode, 0,
+ ({"lavf", 1}, {"no", 0})),
+ OPT_STRING("o", avopt, 0),
+ {0}
+ },
+ .size = sizeof(struct demux_lavf_opts),
+ .defaults = &(const struct demux_lavf_opts){
+ .allow_mimetype = 1,
+ },
};
#define MAX_PKT_QUEUE 50
@@ -200,7 +218,7 @@ static const char *const prefixes[] =
static int lavf_check_file(demuxer_t *demuxer, enum demux_check check)
{
struct MPOpts *opts = demuxer->opts;
- struct lavfdopts *lavfdopts = &opts->lavfdopts;
+ struct demux_lavf_opts *lavfdopts = opts->demux_lavf;
struct stream *s = demuxer->stream;
lavf_priv_t *priv;
@@ -604,7 +622,7 @@ static void update_metadata(demuxer_t *demuxer, AVPacket *pkt)
static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check)
{
struct MPOpts *opts = demuxer->opts;
- struct lavfdopts *lavfdopts = &opts->lavfdopts;
+ struct demux_lavf_opts *lavfdopts = opts->demux_lavf;
AVFormatContext *avfc;
AVDictionaryEntry *t = NULL;
float analyze_duration = 0;
diff --git a/options/options.c b/options/options.c
index 3875a38c89..c494a23dd3 100644
--- a/options/options.c
+++ b/options/options.c
@@ -62,11 +62,10 @@ extern const struct m_sub_options stream_dvb_conf;
extern const struct m_sub_options sws_conf;
extern const struct m_sub_options demux_rawaudio_conf;
extern const struct m_sub_options demux_rawvideo_conf;
+extern const struct m_sub_options demux_lavf_conf;
extern const struct m_sub_options vd_lavc_conf;
extern const struct m_sub_options ad_lavc_conf;
-extern const m_option_t lavfdopts_conf[];
-
extern const struct m_obj_list vf_obj_list;
extern const struct m_obj_list af_obj_list;
extern const struct m_obj_list vo_obj_list;
@@ -279,7 +278,7 @@ const m_option_t mp_opts[] = {
OPT_SUBSTRUCT("vd-lavc", vd_lavc_params, vd_lavc_conf, 0),
OPT_SUBSTRUCT("ad-lavc", ad_lavc_params, ad_lavc_conf, 0),
- {"demuxer-lavf", (void *) lavfdopts_conf, CONF_TYPE_SUBCONFIG},
+ OPT_SUBSTRUCT("demuxer-lavf", demux_lavf, demux_lavf_conf, 0),
OPT_SUBSTRUCT("demuxer-rawaudio", demux_rawaudio, demux_rawaudio_conf, 0),
OPT_SUBSTRUCT("demuxer-rawvideo", demux_rawvideo, demux_rawvideo_conf, 0),
@@ -646,9 +645,6 @@ const struct MPOpts mp_default_opts = {
.mf_fps = 1.0,
- .lavfdopts = {
- .allow_mimetype = 1,
- },
.input = {
.key_fifo_size = 7,
.doubleclick_time = 300,
diff --git a/options/options.h b/options/options.h
index f6e330d8c7..b87c64ed17 100644
--- a/options/options.h
+++ b/options/options.h
@@ -258,22 +258,11 @@ typedef struct MPOpts {
struct demux_rawaudio_opts *demux_rawaudio;
struct demux_rawvideo_opts *demux_rawvideo;
+ struct demux_lavf_opts *demux_lavf;
struct vd_lavc_params *vd_lavc_params;
struct ad_lavc_params *ad_lavc_params;
- struct lavfdopts {
- int probesize;
- int probescore;
- float analyzeduration;
- int buffersize;
- int allow_mimetype;
- char *format;
- char *cryptokey;
- char *avopt;
- int genptsmode;
- } lavfdopts;
-
struct input_conf {
char *config_file;
int doubleclick_time;