synced with 1.231
[mplayer/glamo.git] / m_property.h
blobdc3e436cf6a7254a23a2fbb5373d4ad9d0f456bf
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
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
28 typedef int(*m_property_ctrl_f)(m_option_t* prop,int action,void* arg);
30 int m_property_do(m_option_t* prop, int action, void* arg);
32 char* m_property_print(m_option_t* prop);
34 int m_property_parse(m_option_t* prop, char* txt);
36 void m_properties_print_help_list(m_option_t* list);
38 char* m_properties_expand_string(m_option_t* prop_list,char* str);
40 #define M_PROPERTY_CLAMP(prop,val) do { \
41 if(((prop)->flags & M_OPT_MIN) && (val) < (prop)->min) \
42 (val) = (prop)->min; \
43 else if(((prop)->flags & M_OPT_MAX) && (val) > (prop)->max) \
44 (val) = (prop)->max; \
45 } while(0)
47 // Implement get
48 int m_property_int_ro(m_option_t* prop,int action,
49 void* arg,int var);
51 // Implement set, get and step up/down
52 int m_property_int_range(m_option_t* prop,int action,
53 void* arg,int* var);
55 // Same but cycle
56 int m_property_choice(m_option_t* prop,int action,
57 void* arg,int* var);
59 // Switch betwen min and max
60 int m_property_flag(m_option_t* prop,int action,
61 void* arg,int* var);
63 // Implement get, print
64 int m_property_float_ro(m_option_t* prop,int action,
65 void* arg,float var);
67 // Implement set, get and step up/down
68 int m_property_float_range(m_option_t* prop,int action,
69 void* arg,float* var);
71 // float with a print function which print the time in ms
72 int m_property_delay(m_option_t* prop,int action,
73 void* arg,float* var);
75 // Implement get, print
76 int m_property_double_ro(m_option_t* prop,int action,
77 void* arg,double var);
79 // get/print the string
80 int m_property_string_ro(m_option_t* prop,int action,void* arg, char* str);