diff options
author | wm4 <wm4@nowhere> | 2012-09-18 20:07:24 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-10-12 10:10:31 +0200 |
commit | dec53f760e12254e4baa4f7cee59010b3b10b6be (patch) | |
tree | 41edc95ce49dca2a7188bc88f9a7a9eb2964963c /m_property.h | |
parent | 28f43ce9a9d543fccb10aaf574282c349408946f (diff) | |
download | mpv-dec53f760e12254e4baa4f7cee59010b3b10b6be.tar.bz2 mpv-dec53f760e12254e4baa4f7cee59010b3b10b6be.tar.xz |
commands: add more property-option bridge uses, rename some options
Make more properties use the property-to-option bridge to reduce code
size and to enforce consistency. Some options are renamed to the same
as the properties (the property names are better in all cases).
Do some other minor cleanups. One bigger issue was memory management of
strings: M_PROPERTY_TO_STRING assumed the strings were statically
allocated, and no dynamic allocations could be returned. Fix this in
case the need for such properties arises in the future. Get rid of
m_property_string_ro(), because it's not always clear that the "action"
parameter is M_PROPERTY_SET and the string argument will be used.
Diffstat (limited to 'm_property.h')
-rw-r--r-- | m_property.h | 41 |
1 files changed, 5 insertions, 36 deletions
diff --git a/m_property.h b/m_property.h index eba61a1619..cca624b6db 100644 --- a/m_property.h +++ b/m_property.h @@ -154,42 +154,11 @@ int mp_property_do(const char* name,int action, void* val, void *ctx); /// Get the value of a property as a string suitable for display in an UI. char* mp_property_print(const char *name, void* ctx); -/// \defgroup PropertyImplHelper Property implementation helpers -/// \ingroup Properties -/// \brief Helper functions for common property types. -///@{ - -/// Implement get. -int m_property_int_ro(const m_option_t* prop,int action, - void* arg,int var); - -/// Implement set, get and step up/down. -int m_property_int_range(const m_option_t* prop,int action, - void* arg,int* var); - -int m_property_flag_ro(const m_option_t* prop,int action, - void* arg,int var); - -/// Switch betwen min and max. -int m_property_flag(const m_option_t* prop,int action, - void* arg,int* var); - -/// Implement get, print. -int m_property_float_ro(const m_option_t* prop,int action, - void* arg,float var); - -/// Implement set, get and step up/down -int m_property_float_range(const m_option_t* prop,int action, - void* arg,float* var); - -/// Implement get, print -int m_property_double_ro(const m_option_t* prop,int action, - void* arg,double var); - -/// get/print the string -int m_property_string_ro(const m_option_t* prop,int action,void* arg, char* str); - -///@} +int m_property_int_ro(const m_option_t* prop, int action, void* arg, int var); +int m_property_float_ro(const m_option_t* prop, int action, void* arg, + float var); +int m_property_double_ro(const m_option_t* prop, int action, void* arg, + double var); ///@} |