comparison m_property.h @ 17911:52f95509cd05

Add the new property API and implement a couple properties. Move the volume and mute command to the command to property bridge.
author albeu
date Wed, 22 Mar 2006 00:19:02 +0000
parents
children f9cb6fc1608a
comparison
equal deleted inserted replaced
17910:5ae29dc47c17 17911:52f95509cd05
1
2 // Get the current value
3 #define M_PROPERTY_GET 0
4 // Get a string representing the current value
5 #define M_PROPERTY_PRINT 1
6 // Set a new value
7 #define M_PROPERTY_SET 2
8 // Set a new value from a string
9 #define M_PROPERTY_PARSE 3
10 // Increment the property
11 #define M_PROPERTY_STEP_UP 4
12 // Decrement the property
13 #define M_PROPERTY_STEP_DOWN 5
14
15 // Return values for the control function
16 #define M_PROPERTY_OK 1
17 #define M_PROPERTY_ERROR 0
18 // Returned when the property can't be used, for ex something about
19 // the subs while playing audio only
20 #define M_PROPERTY_UNAVAILABLE -1
21 // Returned if the requested action is not implemented
22 #define M_PROPERTY_NOT_IMPLEMENTED -2
23 // Returned when asking for a property that doesn't exist
24 #define M_PROPERTY_UNKNOWN -3
25 // Returned when the action can't be done (like setting the volume when edl mute)
26 #define M_PROPERTY_DISABLED -4
27
28 typedef int(*m_property_ctrl_f)(m_option_t* prop,int action,void* arg);
29
30 int m_property_do(m_option_t* prop, int action, void* arg);
31
32 char* m_property_print(m_option_t* prop);
33
34 int m_property_parse(m_option_t* prop, char* txt);
35
36 char* m_properties_expand_string(m_option_t* prop_list,char* str);
37
38 #define M_PROPERTY_CLAMP(prop,val) do { \
39 if(((prop)->flags & M_OPT_MIN) && (val) < (prop)->min) \
40 (val) = (prop)->min; \
41 else if(((prop)->flags & M_OPT_MAX) && (val) > (prop)->max) \
42 (val) = (prop)->max; \
43 } while(0)
44
45 // Implement get
46 int m_property_int_ro(m_option_t* prop,int action,
47 void* arg,int var);
48
49 // Implement set, get and step up/down
50 int m_property_int_range(m_option_t* prop,int action,
51 void* arg,int* var);
52
53 // Same but cycle
54 int m_property_choice(m_option_t* prop,int action,
55 void* arg,int* var);
56
57 // Switch betwen min and max
58 int m_property_flag(m_option_t* prop,int action,
59 void* arg,int* var);
60
61 // Implement get, print
62 int m_property_float_ro(m_option_t* prop,int action,
63 void* arg,float var);
64
65 // Implement set, get and step up/down
66 int m_property_float_range(m_option_t* prop,int action,
67 void* arg,float* var);
68
69 // float with a print function which print the time in ms
70 int m_property_delay(m_option_t* prop,int action,
71 void* arg,float* var);
72
73 // Implement get, print
74 int m_property_double_ro(m_option_t* prop,int action,
75 void* arg,double var);
76
77 // get/print the string
78 int m_property_string_ro(m_option_t* prop,int action,void* arg, char* str);