diff --git a/options/m_config.c b/options/m_config.c index d9a3343ab7..2b873e765c 100644 --- a/options/m_config.c +++ b/options/m_config.c @@ -64,7 +64,7 @@ static int parse_include(struct m_config *config, struct bstr param, bool set, if (!set) return 1; char *filename = bstrdup0(NULL, param); - config->includefunc(config, filename, flags); + config->includefunc(config->includefunc_ctx, filename, flags); talloc_free(filename); return 1; } diff --git a/options/m_config.h b/options/m_config.h index 1f03a9abea..829fa90ba7 100644 --- a/options/m_config.h +++ b/options/m_config.h @@ -61,7 +61,8 @@ typedef struct m_config { bool use_profiles; bool is_toplevel; - int (*includefunc)(struct m_config *conf, char *filename, int flags); + int (*includefunc)(void *ctx, char *filename, int flags); + void *includefunc_ctx; void *optstruct; // struct mpopts or other } m_config_t; diff --git a/player/main.c b/player/main.c index 7ca64ed664..3dde2f6101 100644 --- a/player/main.c +++ b/player/main.c @@ -292,9 +292,10 @@ static void init_input(struct MPContext *mpctx) #endif } -static int cfg_include(struct m_config *conf, char *filename, int flags) +static int cfg_include(void *ctx, char *filename, int flags) { - return m_config_parse_config_file(conf, filename, flags); + struct MPContext *mpctx = ctx; + return m_config_parse_config_file(mpctx->mconfig, filename, flags); } static int mpv_main(int argc, char *argv[]) @@ -318,6 +319,7 @@ static int mpv_main(int argc, char *argv[]) &mp_default_opts, mp_opts); mpctx->opts = mpctx->mconfig->optstruct; mpctx->mconfig->includefunc = cfg_include; + mpctx->mconfig->includefunc_ctx = mpctx; mpctx->mconfig->use_profiles = true; mpctx->mconfig->is_toplevel = true;