From 099cdbf019424b6096aebd45b8ca68bc29068e70 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 10 Jun 2014 22:48:11 +0200 Subject: demux_mf: remove global option variables --- demux/demux_mf.c | 12 ++++++------ demux/mf.c | 3 --- options/options.c | 13 ++++--------- options/options.h | 3 +++ 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/demux/demux_mf.c b/demux/demux_mf.c index 1284c7fd7f..fa5908c493 100644 --- a/demux/demux_mf.c +++ b/demux/demux_mf.c @@ -26,8 +26,8 @@ #include "osdep/io.h" #include "talloc.h" -#include "config.h" #include "common/msg.h" +#include "options/options.h" #include "stream/stream.h" #include "demux.h" @@ -142,11 +142,11 @@ static const struct { {0} }; -static const char *probe_format(mf_t *mf, enum demux_check check) +static const char *probe_format(mf_t *mf, char *type, enum demux_check check) { if (check > DEMUX_CHECK_REQUEST) return NULL; - char *type = mf_type; + char *org_type = type; if (!type || !type[0]) { char *p = strrchr(mf->names[0], '.'); if (p) @@ -157,7 +157,7 @@ static const char *probe_format(mf_t *mf, enum demux_check check) return type2format[i].codec; } if (check == DEMUX_CHECK_REQUEST) { - if (!mf_type) { + if (!org_type) { MP_ERR(mf, "file type was not set! (try --mf-type=ext)\n"); } else { MP_ERR(mf, "--mf-type set to an unknown codec!\n"); @@ -183,7 +183,7 @@ static int demux_open_mf(demuxer_t *demuxer, enum demux_check check) if (!mf || mf->nr_of_files < 1) goto error; - const char *codec = probe_format(mf, check); + const char *codec = probe_format(mf, demuxer->opts->mf_type, check); if (!codec) goto error; @@ -196,7 +196,7 @@ static int demux_open_mf(demuxer_t *demuxer, enum demux_check check) sh->codec = codec; sh_video->disp_w = 0; sh_video->disp_h = 0; - sh_video->fps = mf_fps; + sh_video->fps = demuxer->opts->mf_fps; mf->sh = sh_video; demuxer->priv = (void *)mf; diff --git a/demux/mf.c b/demux/mf.c index 173593f167..5edc98043a 100644 --- a/demux/mf.c +++ b/demux/mf.c @@ -34,9 +34,6 @@ #include "mf.h" -double mf_fps = 1.0; -char *mf_type = NULL; //"jpg"; - static void mf_add(mf_t *mf, const char *fname) { char *entry = talloc_strdup(mf, fname); diff --git a/options/options.c b/options/options.c index ef88cab829..b02be333d3 100644 --- a/options/options.c +++ b/options/options.c @@ -67,19 +67,11 @@ extern const struct m_sub_options sws_conf; extern const m_option_t lavfdopts_conf[]; -extern double mf_fps; -extern char * mf_type; 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; extern const struct m_obj_list ao_obj_list; -static const m_option_t mfopts_conf[]={ - {"fps", &mf_fps, CONF_TYPE_DOUBLE, 0, 0, 0, NULL}, - {"type", &mf_type, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {NULL, NULL, 0, 0, 0, 0, NULL} -}; - #define OPT_BASE_STRUCT struct MPOpts extern const struct m_sub_options image_writer_conf; @@ -222,7 +214,8 @@ const m_option_t mp_opts[] = { OPT_STRING("audio-demuxer", audio_demuxer_name, 0), OPT_STRING("sub-demuxer", sub_demuxer_name, 0), - {"mf", (void *) mfopts_conf, CONF_TYPE_SUBCONFIG, 0,0,0, NULL}, + OPT_DOUBLE("mf-fps", mf_fps, 0), + OPT_STRING("mf-type", mf_type, 0), #if HAVE_TV OPT_SUBSTRUCT("tv", tv_params, tv_params_conf, 0), #endif /* HAVE_TV */ @@ -654,6 +647,8 @@ const struct MPOpts mp_default_opts = { .dvd_angle = 1, + .mf_fps = 1.0, + .ad_lavc_param = { .ac3drc = 1., .downmix = 1, diff --git a/options/options.h b/options/options.h index cc57795446..dbddd52c4d 100644 --- a/options/options.h +++ b/options/options.h @@ -253,6 +253,9 @@ typedef struct MPOpts { int bluray_angle; char *bluray_device; + double mf_fps; + char *mf_type; + struct lavc_param { int fast; int show_all; -- cgit v1.2.3