3 #define MP_CMD_AUDIO_DELAY 1
6 #define MP_CMD_GRAB_FRAMES 4
7 #define MP_CMD_PLAY_TREE_STEP 5
8 #define MP_CMD_PLAY_TREE_UP_STEP 6
9 #define MP_CMD_PLAY_ALT_SRC_STEP 7
10 #define MP_CMD_SUB_DELAY 8
12 #define MP_CMD_VOLUME 10
13 #define MP_CMD_MIXER_USEMASTER 11
14 #define MP_CMD_CONTRAST 12
15 #define MP_CMD_BRIGHTNESS 13
17 #define MP_CMD_SATURATION 15
18 #define MP_CMD_FRAMEDROPPING 16
19 #define MP_CMD_TV_STEP_CHANNEL 17
20 #define MP_CMD_TV_STEP_NORM 18
21 #define MP_CMD_TV_STEP_CHANNEL_LIST 19
22 #define MP_CMD_VO_FULLSCREEN 20
23 #define MP_CMD_SUB_POS 21
24 #define MP_CMD_DVDNAV 22
25 #define MP_CMD_SCREENSHOT 23
26 #define MP_CMD_PANSCAN 24
27 #define MP_CMD_MUTE 25
28 #define MP_CMD_LOADFILE 26
29 #define MP_CMD_LOADLIST 27
30 #define MP_CMD_VF_CHANGE_RECTANGLE 28
31 #define MP_CMD_GAMMA 29
32 #define MP_CMD_SUB_VISIBILITY 30
33 // #define MP_CMD_VOBSUB_LANG 31 // combined with SUB_SELECT
34 #define MP_CMD_MENU 32
35 #define MP_CMD_SET_MENU 33
36 #define MP_CMD_GET_TIME_LENGTH 34
37 #define MP_CMD_GET_PERCENT_POS 35
38 #define MP_CMD_SUB_STEP 36
39 #define MP_CMD_TV_SET_CHANNEL 37
41 #define MP_CMD_EDL_MARK 38
43 #define MP_CMD_SUB_ALIGNMENT 39
44 #define MP_CMD_TV_LAST_CHANNEL 40
45 #define MP_CMD_OSD_SHOW_TEXT 41
46 #define MP_CMD_TV_SET_FREQ 42
47 #define MP_CMD_TV_SET_NORM 43
48 #define MP_CMD_TV_SET_BRIGHTNESS 44
49 #define MP_CMD_TV_SET_CONTRAST 45
50 #define MP_CMD_TV_SET_HUE 46
51 #define MP_CMD_TV_SET_SATURATION 47
52 #define MP_CMD_GET_VO_FULLSCREEN 48
53 #define MP_CMD_GET_SUB_VISIBILITY 49
54 #define MP_CMD_SUB_FORCED_ONLY 50
55 #define MP_CMD_VO_ONTOP 51
56 #define MP_CMD_SUB_SELECT 52
57 #define MP_CMD_VO_ROOTWIN 53
58 #define MP_CMD_SWITCH_VSYNC 54
59 #define MP_CMD_SWITCH_RATIO 55
60 #define MP_CMD_FRAME_STEP 56
61 #define MP_CMD_SPEED_INCR 57
62 #define MP_CMD_SPEED_MULT 58
63 #define MP_CMD_SPEED_SET 59
65 #define MP_CMD_SUB_LOG 61
66 #define MP_CMD_SWITCH_AUDIO 62
67 #define MP_CMD_GET_TIME_POS 63
68 #define MP_CMD_SUB_LOAD 64
69 #define MP_CMD_SUB_REMOVE 65
71 #define MP_CMD_GUI_EVENTS 5000
72 #define MP_CMD_GUI_LOADFILE 5001
73 #define MP_CMD_GUI_LOADSUBTITLE 5002
74 #define MP_CMD_GUI_ABOUT 5003
75 #define MP_CMD_GUI_PLAY 5004
76 #define MP_CMD_GUI_STOP 5005
77 #define MP_CMD_GUI_PLAYLIST 5006
78 #define MP_CMD_GUI_PREFERENCES 5007
79 #define MP_CMD_GUI_FULLSCREEN 5008
80 #define MP_CMD_GUI_SKINBROWSER 5009
82 #ifdef HAS_DVBIN_SUPPORT
83 #define MP_CMD_DVB_SET_CHANNEL 5101
86 #define MP_CMD_DVDNAV_EVENT 6000
88 #define MP_CMD_DVDNAV_UP 1
89 #define MP_CMD_DVDNAV_DOWN 2
90 #define MP_CMD_DVDNAV_LEFT 3
91 #define MP_CMD_DVDNAV_RIGHT 4
92 #define MP_CMD_DVDNAV_MENU 5
93 #define MP_CMD_DVDNAV_SELECT 6
96 #define MP_CMD_CHELP 7000
97 #define MP_CMD_CEXIT 7001
98 #define MP_CMD_CHIDE 7002
101 #define MP_CMD_ARG_INT 0
102 #define MP_CMD_ARG_FLOAT 1
103 #define MP_CMD_ARG_STRING 2
104 #define MP_CMD_ARG_VOID 3
106 #ifndef MP_CMD_MAX_ARGS
107 #define MP_CMD_MAX_ARGS 10
110 // Error codes for the drivers
112 // An error occurred but we can continue
113 #define MP_INPUT_ERROR -1
114 // A fatal error occurred, this driver should be removed
115 #define MP_INPUT_DEAD -2
116 // No input was available
117 #define MP_INPUT_NOTHING -3
119 // For the key's drivers, if possible you can send key up and key down
120 // events. Key up is the default, to send a key down you must use the
121 // OR operator between the key code and MP_KEY_DOWN.
122 #define MP_KEY_DOWN (1<<29)
123 // Use this when the key shouldn't be auto-repeated (like mouse buttons)
124 #define MP_NO_REPEAT_KEY (1<<28)
126 #ifndef MP_MAX_KEY_DOWN
127 #define MP_MAX_KEY_DOWN 32
130 typedef union mp_cmd_arg_value
{
135 } mp_cmd_arg_value_t
;
137 typedef struct mp_cmd_arg
{
139 mp_cmd_arg_value_t v
;
142 typedef struct mp_cmd
{
146 mp_cmd_arg_t args
[MP_CMD_MAX_ARGS
];
151 typedef struct mp_cmd_bind
{
152 int input
[MP_MAX_KEY_DOWN
+1];
156 typedef struct mp_key_name
{
161 // These typedefs are for the drivers. They are the functions used to retrieve
162 // the next key code or command.
164 // These functions should return the key code or one of the error codes
165 typedef int (*mp_key_func_t
)(int fd
);
166 // These functions should act like read but they must use our error code (if needed ;-)
167 typedef int (*mp_cmd_func_t
)(int fd
,char* dest
,int size
);
168 // These are used to close the driver
169 typedef void (*mp_close_func_t
)(int fd
);
171 // Set this to grab all incoming key codes
172 extern void (*mp_input_key_cb
)(int code
);
173 // Should return 1 if the command was processed
174 typedef int (*mp_input_cmd_filter
)(mp_cmd_t
* cmd
, int paused
, void* ctx
);
176 // This function adds a new key driver.
177 // The first arg is a file descriptor (use a negative value if you don't use any fd)
178 // The second arg tells if we use select on the fd to know if something is available.
179 // The third arg is optional. If null a default function wich reads an int from the
181 // The last arg can be NULL if nothing is needed to close the driver. The close
182 // function can be used
184 mp_input_add_cmd_fd(int fd
, int select
, mp_cmd_func_t read_func
, mp_close_func_t close_func
);
186 // This removes a cmd driver, you usually don't need to use it.
188 mp_input_rm_cmd_fd(int fd
);
190 // The args are the same as for the key's drivers. If you don't use any valid fd you MUST
193 mp_input_add_key_fd(int fd
, int select
, mp_key_func_t read_func
, mp_close_func_t close_func
);
195 // As for the cmd one you usually don't need this function.
197 mp_input_rm_key_fd(int fd
);
199 // This function can be used to put a command in the system again. It's used by libmpdemux
200 // when it performs a blocking operation to resend the command it received to the main
203 mp_input_queue_cmd(mp_cmd_t
* cmd
);
205 // This function retrieves the next available command waiting no more than time msec.
206 // If pause is true, the next input will always return a pause command.
208 mp_input_get_cmd(int time
, int paused
, int peek_only
);
211 mp_input_parse_cmd(char* str
);
213 /// These filters allow you to process the command before MPlayer.
214 /// If a filter returns a true value mp_input_get_cmd will return NULL.
216 mp_input_add_cmd_filter(mp_input_cmd_filter
, void* ctx
);
218 // After getting a command from mp_input_get_cmd you need to free it using this
221 mp_cmd_free(mp_cmd_t
* cmd
);
223 // This creates a copy of a command (used by the auto repeat stuff).
225 mp_cmd_clone(mp_cmd_t
* cmd
);
227 // When you create a new driver you should add it in these 2 functions.
232 mp_input_uninit(void);
234 // Interruptible usleep: (used by libmpdemux)
236 mp_input_check_interrupt(int time
);