diff options
author | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-05-29 21:49:39 +0000 |
---|---|---|
committer | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-05-29 21:49:39 +0000 |
commit | 1654c2bd80110fea2c2665b1a8499c7ee8eefd2a (patch) | |
tree | 57f1732b5ba774613f939ca84744348620838574 /m_property.h | |
parent | 7c583588b9e746e6dd3c93ccd3b051591505e68d (diff) | |
download | mpv-1654c2bd80110fea2c2665b1a8499c7ee8eefd2a.tar.bz2 mpv-1654c2bd80110fea2c2665b1a8499c7ee8eefd2a.tar.xz |
Rework the property API to allow sub properties such as
metadata/title, etc.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23411 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'm_property.h')
-rw-r--r-- | m_property.h | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/m_property.h b/m_property.h index f022fdd1bf..2d29507f68 100644 --- a/m_property.h +++ b/m_property.h @@ -48,6 +48,32 @@ */ #define M_PROPERTY_STEP_DOWN 5 +/// Get a string containg a parsable representation. +/** Set the variable to a newly allocated string or NULL. + * \param arg Pointer to a char* variable. + */ +#define M_PROPERTY_TO_STRING 6 + +/// Pass down an action to a sub-property. +#define M_PROPERTY_KEY_ACTION 7 + +/// Get a m_option describing the property. +#define M_PROPERTY_GET_TYPE 8 + +///@} + +/// \defgroup PropertyActionsArg Property actions argument type +/// \ingroup Properties +/// \brief Types used as action argument. +///@{ + +/// Argument for \ref M_PROPERTY_KEY_ACTION +typedef struct { + const char* key; + int action; + void* arg; +} m_property_action_t; + ///@} /// \defgroup PropertyActionsReturn Property actions return code @@ -81,25 +107,14 @@ typedef int(*m_property_ctrl_f)(m_option_t* prop,int action,void* arg,void *ctx); /// Do an action on a property. -/** \param prop The property. +/** \param prop_list The list of properties. + * \param prop The path of the property. * \param action See \ref PropertyActions. * \param arg Argument, usually a pointer to the data type used by the property. * \return See \ref PropertyActionsReturn. */ -int m_property_do(m_option_t* prop, int action, void* arg, void *ctx); - -/// Print the current value of a property. -/** \param prop The property. - * \return A newly allocated string with the current value or NULL on error. - */ -char* m_property_print(m_option_t* prop, void *ctx); - -/// Set a property. -/** \param prop The property. - * \param txt The value to set. - * \return 1 on success, 0 on error. - */ -int m_property_parse(m_option_t* prop, char* txt, void *ctx); +int m_property_do(m_option_t* prop_list, const char* prop, + int action, void* arg, void *ctx); /// Print a list of properties. void m_properties_print_help_list(m_option_t* list); @@ -119,12 +134,12 @@ char* m_properties_expand_string(m_option_t* prop_list,char* str, void *ctx); // Helpers to use MPlayer's properties -/// Get an MPlayer property. -m_option_t* mp_property_find(const char* name); - /// Do an action with an MPlayer property. 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. |