From b9a3579ec980dfb01d0b952bf0b859ecdf62d7ea Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sat, 18 Dec 2010 08:02:48 +0200 Subject: 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). --- m_option.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'm_option.h') 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) { -- cgit v1.2.3