diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-12-18 08:02:48 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-12-18 11:59:09 +0200 |
commit | b9a3579ec980dfb01d0b952bf0b859ecdf62d7ea (patch) | |
tree | 9f90d981a92bb6cfb79e5feed1b3b9bfde9ab3b0 /m_option.h | |
parent | 7e366113f75c696ae2b32f5faa5f80ec3fca96b8 (diff) | |
download | mpv-b9a3579ec980dfb01d0b952bf0b859ecdf62d7ea.tar.bz2 mpv-b9a3579ec980dfb01d0b952bf0b859ecdf62d7ea.tar.xz |
commands: add generic option -> property wrapper
Add mp_property_generic_option(), a property function that can be used
for generic option-based properties that do not require any action
beyond manipulating the value of the option variable. Currently it
directly implements GET and SET, plus STEP_UP for "choice" options
only. Use it to add a property for -pts-association-mode (not
particularly useful in normal use, but serves as a test).
Diffstat (limited to 'm_option.h')
-rw-r--r-- | m_option.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/m_option.h b/m_option.h index ed2b30de75..05d5751ceb 100644 --- a/m_option.h +++ b/m_option.h @@ -493,6 +493,12 @@ struct m_option { */ const m_option_t* m_option_list_find(const m_option_t* list,const char* name); +static inline void *m_option_get_ptr(const struct m_option *opt, + void *optstruct) +{ + return opt->new ? (char *) optstruct + opt->offset : opt->p; +} + /// Helper to parse options, see \ref m_option_type::parse. inline static int m_option_parse(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { |