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
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 // Helpers to use MPlayer's properties
42 m_option_t
* mp_property_find(char* name
);
44 int mp_property_do(char* name
,int action
, void* val
);
46 // Helpers for property implementations
48 #define M_PROPERTY_CLAMP(prop,val) do { \
49 if(((prop)->flags & M_OPT_MIN) && (val) < (prop)->min) \
50 (val) = (prop)->min; \
51 else if(((prop)->flags & M_OPT_MAX) && (val) > (prop)->max) \
52 (val) = (prop)->max; \
56 int m_property_int_ro(m_option_t
* prop
,int action
,
59 // Implement set, get and step up/down
60 int m_property_int_range(m_option_t
* prop
,int action
,
64 int m_property_choice(m_option_t
* prop
,int action
,
67 // Switch betwen min and max
68 int m_property_flag(m_option_t
* prop
,int action
,
71 // Implement get, print
72 int m_property_float_ro(m_option_t
* prop
,int action
,
75 // Implement set, get and step up/down
76 int m_property_float_range(m_option_t
* prop
,int action
,
77 void* arg
,float* var
);
79 // float with a print function which print the time in ms
80 int m_property_delay(m_option_t
* prop
,int action
,
81 void* arg
,float* var
);
83 // Implement get, print
84 int m_property_double_ro(m_option_t
* prop
,int action
,
85 void* arg
,double var
);
87 // get/print the string
88 int m_property_string_ro(m_option_t
* prop
,int action
,void* arg
, char* str
);