From 8a7704ea8928f0a7342757e89c64f022a21cdef8 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Tue, 19 Sep 2023 16:51:43 -0500 Subject: stream_bluray: move --bluray-device to stream_bluray_opts Similar to the previous commit. There's no reason for --bluray-device to be in MPOpts. Make a specific subopt for stream_bluray and use that instead so we can remove the mp_read_option_raw call. --- stream/stream_bluray.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'stream/stream_bluray.c') diff --git a/stream/stream_bluray.c b/stream/stream_bluray.c index 19e99a458b..7771375aa2 100644 --- a/stream/stream_bluray.c +++ b/stream/stream_bluray.c @@ -73,6 +73,20 @@ #define AACS_ERROR_MMC_FAILURE -7 /* MMC failed */ #define AACS_ERROR_NO_DK -8 /* no matching device key */ + +struct bluray_opts { + char *bluray_device; +}; + +#define OPT_BASE_STRUCT struct bluray_opts +const struct m_sub_options stream_bluray_conf = { + .opts = (const struct m_option[]) { + {"device", OPT_STRING(bluray_device), .flags = M_OPT_FILE}, + {0}, + }, + .size = sizeof(struct bluray_opts), +}; + struct bluray_priv_s { BLURAY *bd; BLURAY_TITLE_INFO *title_info; @@ -86,6 +100,8 @@ struct bluray_priv_s { char *cfg_device; bool use_nav; + struct bluray_opts *opts; + struct m_config_cache *opts_cache; }; static void destruct(struct bluray_priv_s *priv) @@ -377,8 +393,7 @@ static int bluray_stream_open_internal(stream_t *s) if (b->cfg_device && b->cfg_device[0]) { device = b->cfg_device; } else { - mp_read_option_raw(s->global, "bluray-device", &m_option_type_string, - &device); + device = b->opts->bluray_device; } if (!device || !device[0]) { @@ -466,6 +481,12 @@ static int bluray_stream_open(stream_t *s) struct bluray_priv_s *b = talloc_zero(s, struct bluray_priv_s); s->priv = b; + struct m_config_cache *opts_cache = + m_config_cache_alloc(s, s->global, &stream_bluray_conf); + + b->opts_cache = opts_cache; + b->opts = opts_cache->opts; + b->use_nav = s->info == &stream_info_bdnav; bstr title, bdevice, rest = { .len = 0 }; -- cgit v1.2.3