annotate m_property.h @ 19910:8e3785c20752

show in the osd the number of the button selected by the mouse
author nicodvb
date Tue, 19 Sep 2006 22:44:19 +0000
parents 2ec2301183cd
children a5e5b0c45c03
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
1
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
2 /// \defgroup Properties
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
3 ///
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
4 /// Properties provide an interface to query and set the state of various
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
5 /// things in MPlayer. The API is based on the \ref Options API like the
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
6 /// \ref Config, but instead of using variables, properties use an ioctl like
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
7 /// function. The function is used to perform various actions like get and set
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
8 /// (see \ref PropertyActions).
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
9 ///@{
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
10
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
11 /// \file
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
12
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
13 /// \defgroup PropertyActions Property actions
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
14 /// \ingroup Properties
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
15 ///@{
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
16
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
17 /// Get the current value.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
18 /** \param arg Pointer to a variable of the right type.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
19 */
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
20 #define M_PROPERTY_GET 0
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
21
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
22 /// Get a string representing the current value.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
23 /** Set the variable to a newly allocated string or NULL.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
24 * \param arg Pointer to a char* variable.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
25 */
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
26 #define M_PROPERTY_PRINT 1
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
27
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
28 /// Set a new value.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
29 /** The variable is updated to the value actually set.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
30 * \param arg Pointer to a variable of the right type.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
31 */
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
32 #define M_PROPERTY_SET 2
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
33
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
34 /// Set a new value from a string.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
35 /** \param arg String containing the value.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
36 */
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
37 #define M_PROPERTY_PARSE 3
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
38
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
39 /// Increment the current value.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
40 /** The sign of the argument is also taken into account if applicable.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
41 * \param arg Pointer to a variable of the right type or NULL.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
42 */
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
43 #define M_PROPERTY_STEP_UP 4
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
44
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
45 /// Decrement the current value.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
46 /** The sign of the argument is also taken into account if applicable.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
47 * \param arg Pointer to a variable of the right type or NULL.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
48 */
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
49 #define M_PROPERTY_STEP_DOWN 5
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
50
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
51 ///@}
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
52
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
53 /// \defgroup PropertyActionsReturn Property actions return code
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
54 /// \ingroup Properties
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
55 /// \brief Return values for the control function.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
56 ///@{
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
57
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
58 /// Returned on success.
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
59 #define M_PROPERTY_OK 1
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
60
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
61 /// Returned on error.
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
62 #define M_PROPERTY_ERROR 0
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
63
18283
67d35fe89c8d Fix most of the mistakes pointed out by Diego.
albeu
parents: 18258
diff changeset
64 /// \brief Returned when the property can't be used, for example something about
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
65 /// the subs while playing audio only
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
66 #define M_PROPERTY_UNAVAILABLE -1
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
67
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
68 /// Returned if the requested action is not implemented.
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
69 #define M_PROPERTY_NOT_IMPLEMENTED -2
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
70
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
71 /// Returned when asking for a property that doesn't exist.
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
72 #define M_PROPERTY_UNKNOWN -3
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
73
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
74 /// Returned when the action can't be done (like setting the volume when edl mute).
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
75 #define M_PROPERTY_DISABLED -4
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
76
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
77 ///@}
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
78
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
79 /// \ingroup Properties
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
80 /// \brief Property action callback.
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
81 typedef int(*m_property_ctrl_f)(m_option_t* prop,int action,void* arg);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
82
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
83 /// Do an action on a property.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
84 /** \param prop The property.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
85 * \param action See \ref PropertyActions.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
86 * \param arg Argument, usually a pointer to the data type used by the property.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
87 * \return See \ref PropertyActionsReturn.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
88 */
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
89 int m_property_do(m_option_t* prop, int action, void* arg);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
90
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
91 /// Print the current value of a property.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
92 /** \param prop The property.
18283
67d35fe89c8d Fix most of the mistakes pointed out by Diego.
albeu
parents: 18258
diff changeset
93 * \return A newly allocated string with the current value or NULL on error.
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
94 */
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
95 char* m_property_print(m_option_t* prop);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
96
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
97 /// Set a property.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
98 /** \param prop The property.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
99 * \param txt The value to set.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
100 * \return 1 on success, 0 on error.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
101 */
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
102 int m_property_parse(m_option_t* prop, char* txt);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
103
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
104 /// Print a list of properties.
17914
f9cb6fc1608a Add an option to list the properties: -list-properties
albeu
parents: 17911
diff changeset
105 void m_properties_print_help_list(m_option_t* list);
f9cb6fc1608a Add an option to list the properties: -list-properties
albeu
parents: 17911
diff changeset
106
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
107 /// Expand a property string.
18283
67d35fe89c8d Fix most of the mistakes pointed out by Diego.
albeu
parents: 18258
diff changeset
108 /** This function allows to print strings containing property values.
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
109 * ${NAME} is expanded to the value of property NAME or an empty
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
110 * string in case of error. $(NAME:STR) expand STR only if the property
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
111 * NAME is available.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
112 *
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
113 * \param prop_list An array of \ref m_option describing the available
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
114 * properties.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
115 * \param str The string to expand.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
116 * \return The newly allocated expanded string.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
117 */
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
118 char* m_properties_expand_string(m_option_t* prop_list,char* str);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
119
18189
faa148210f2b Add the declarations for mp_property_find/do.
albeu
parents: 17914
diff changeset
120 // Helpers to use MPlayer's properties
faa148210f2b Add the declarations for mp_property_find/do.
albeu
parents: 17914
diff changeset
121
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
122 /// Get an MPlayer property.
19053
75327b24e06f marks several string parameters as const, as they are not modified inside the function, Patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents: 18283
diff changeset
123 m_option_t* mp_property_find(const char* name);
18189
faa148210f2b Add the declarations for mp_property_find/do.
albeu
parents: 17914
diff changeset
124
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
125 /// Do an action with an MPlayer property.
19104
2ec2301183cd marks several read-only string parameters which aren't modified inside the called function as const. Patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents: 19053
diff changeset
126 int mp_property_do(const char* name,int action, void* val);
18189
faa148210f2b Add the declarations for mp_property_find/do.
albeu
parents: 17914
diff changeset
127
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
128 /// \defgroup PropertyImplHelper Property implementation helpers
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
129 /// \ingroup Properties
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
130 /// \brief Helper functions for common property types.
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
131 ///@{
18189
faa148210f2b Add the declarations for mp_property_find/do.
albeu
parents: 17914
diff changeset
132
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
133 /// Clamp a value according to \ref m_option::min and \ref m_option::max.
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
134 #define M_PROPERTY_CLAMP(prop,val) do { \
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
135 if(((prop)->flags & M_OPT_MIN) && (val) < (prop)->min) \
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
136 (val) = (prop)->min; \
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
137 else if(((prop)->flags & M_OPT_MAX) && (val) > (prop)->max) \
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
138 (val) = (prop)->max; \
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
139 } while(0)
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
140
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
141 /// Implement get.
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
142 int m_property_int_ro(m_option_t* prop,int action,
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
143 void* arg,int var);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
144
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
145 /// Implement set, get and step up/down.
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
146 int m_property_int_range(m_option_t* prop,int action,
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
147 void* arg,int* var);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
148
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
149 /// Same as m_property_int_range but cycle.
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
150 int m_property_choice(m_option_t* prop,int action,
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
151 void* arg,int* var);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
152
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
153 /// Switch betwen min and max.
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
154 int m_property_flag(m_option_t* prop,int action,
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
155 void* arg,int* var);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
156
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
157 /// Implement get, print.
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
158 int m_property_float_ro(m_option_t* prop,int action,
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
159 void* arg,float var);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
160
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
161 /// Implement set, get and step up/down
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
162 int m_property_float_range(m_option_t* prop,int action,
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
163 void* arg,float* var);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
164
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
165 /// float with a print function which print the time in ms
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
166 int m_property_delay(m_option_t* prop,int action,
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
167 void* arg,float* var);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
168
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
169 /// Implement get, print
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
170 int m_property_double_ro(m_option_t* prop,int action,
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
171 void* arg,double var);
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
172
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
173 /// get/print the string
17911
52f95509cd05 Add the new property API and implement a couple properties.
albeu
parents:
diff changeset
174 int m_property_string_ro(m_option_t* prop,int action,void* arg, char* str);
18258
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
175
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
176 ///@}
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
177
96568be4bfdc Doxygen attack!
albeu
parents: 18189
diff changeset
178 ///@}