mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 20:27:23 +00:00
m_config: add a special define to access main config
Passing NULL to mp_get_config_group() returns the main option struct. This is just a dumb hack to deal with inconsistencies caused by legacy things (as I'll claim), and will probably be changed in the future. So before littering the whole code base with hard to find NULL parameters, require using callers an easy to find separate define.
This commit is contained in:
parent
fb22bf2317
commit
fe6b2f9103
@ -517,7 +517,7 @@ void build_ordered_chapter_timeline(struct timeline *tl)
|
|||||||
.global = tl->global,
|
.global = tl->global,
|
||||||
.tl = tl,
|
.tl = tl,
|
||||||
.demuxer = demuxer,
|
.demuxer = demuxer,
|
||||||
.opts = mp_get_config_group(ctx, tl->global, NULL),
|
.opts = mp_get_config_group(ctx, tl->global, GLOBAL_CONFIG),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!ctx->opts->ordered_chapters || !demuxer->access_references) {
|
if (!ctx->opts->ordered_chapters || !demuxer->access_references) {
|
||||||
|
@ -278,15 +278,17 @@ struct m_config_cache {
|
|||||||
void *wakeup_cb_ctx;
|
void *wakeup_cb_ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define GLOBAL_CONFIG NULL
|
||||||
|
|
||||||
// Create a mirror copy from the global options.
|
// Create a mirror copy from the global options.
|
||||||
// Keep in mind that a m_config_cache object is not thread-safe; it merely
|
// Keep in mind that a m_config_cache object is not thread-safe; it merely
|
||||||
// provides thread-safe access to the global options. All API functions for
|
// provides thread-safe access to the global options. All API functions for
|
||||||
// the same m_config_cache object must synchronized, unless otherwise noted.
|
// the same m_config_cache object must synchronized, unless otherwise noted.
|
||||||
// ta_parent: parent for the returned allocation
|
// ta_parent: parent for the returned allocation
|
||||||
// global: option data source
|
// global: option data source
|
||||||
// group: the option group to return. This can be NULL for the global option
|
// group: the option group to return. This can be GLOBAL_CONFIG for the global
|
||||||
// struct (MPOpts), or m_sub_options used in a certain OPT_SUBSTRUCT()
|
// option struct (MPOpts), or m_sub_options used in a certain
|
||||||
// item.
|
// OPT_SUBSTRUCT() item.
|
||||||
struct m_config_cache *m_config_cache_alloc(void *ta_parent,
|
struct m_config_cache *m_config_cache_alloc(void *ta_parent,
|
||||||
struct mpv_global *global,
|
struct mpv_global *global,
|
||||||
const struct m_sub_options *group);
|
const struct m_sub_options *group);
|
||||||
@ -317,7 +319,7 @@ bool m_config_cache_update(struct m_config_cache *cache);
|
|||||||
// Like m_config_cache_alloc(), but return the struct (m_config_cache->opts)
|
// Like m_config_cache_alloc(), but return the struct (m_config_cache->opts)
|
||||||
// directly, with no way to update the config. Basically this returns a copy
|
// directly, with no way to update the config. Basically this returns a copy
|
||||||
// with a snapshot of the current option values.
|
// with a snapshot of the current option values.
|
||||||
// group==NULL is a special case, and always returns the root group.
|
// group==GLOBAL_CONFIG is a special case, and always returns the root group.
|
||||||
void *mp_get_config_group(void *ta_parent, struct mpv_global *global,
|
void *mp_get_config_group(void *ta_parent, struct mpv_global *global,
|
||||||
const struct m_sub_options *group);
|
const struct m_sub_options *group);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user