From d4d8b3a4fcf8d50af9cef9766cfefc5538be28f4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 6 Sep 2016 20:09:56 +0200 Subject: demux: do not access global options Don't access MPOpts directly, and always use the new m_config.h functions for accessing them in a thread-safe way. The goal is eventually removing the mpv_global.opts field, and the demuxer/stream-layer specific hack that copies MPOpts to deal with thread-safety issues. This moves around a lot of options. For one, we often change the physical storage location of options to make them more localized, but these changes are not user-visible (or should not be). For shared options on the other hand it's better to do messy direct access, which is worrying as in that somehow renaming an option or changing its type would break code reading them manually, without causing a compilation error. --- demux/demux_mf.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'demux/demux_mf.c') diff --git a/demux/demux_mf.c b/demux/demux_mf.c index 20b948630c..4abd394317 100644 --- a/demux/demux_mf.c +++ b/demux/demux_mf.c @@ -27,6 +27,7 @@ #include "mpv_talloc.h" #include "common/msg.h" #include "options/options.h" +#include "options/m_config.h" #include "options/path.h" #include "misc/ctype.h" @@ -304,10 +305,15 @@ static int demux_open_mf(demuxer_t *demuxer, enum demux_check check) if (!mf || mf->nr_of_files < 1) goto error; - char *force_type = demuxer->opts->mf_type; + double mf_fps; + char *mf_type; + mp_read_option_raw(demuxer->global, "mf-fps", &m_option_type_double, &mf_fps); + mp_read_option_raw(demuxer->global, "mf-type", &m_option_type_string, &mf_type); + const char *codec = mp_map_mimetype_to_video_codec(demuxer->stream->mime_type); - if (!codec || (force_type && force_type[0])) - codec = probe_format(mf, force_type, check); + if (!codec || (mf_type && mf_type[0])) + codec = probe_format(mf, mf_type, check); + talloc_free(mf_type); if (!codec) goto error; @@ -320,7 +326,7 @@ static int demux_open_mf(demuxer_t *demuxer, enum demux_check check) c->codec = codec; c->disp_w = 0; c->disp_h = 0; - c->fps = demuxer->opts->mf_fps; + c->fps = mf_fps; c->reliable_fps = true; demux_add_sh_stream(demuxer, sh); -- cgit v1.2.3