3 #define MP_CMD_AUDIO_DELAY 1
6 // #define MP_CMD_GRAB_FRAMES 4 // was a no-op command for years
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
40 #define MP_CMD_EDL_MARK 38
41 #define MP_CMD_SUB_ALIGNMENT 39
42 #define MP_CMD_TV_LAST_CHANNEL 40
43 #define MP_CMD_OSD_SHOW_TEXT 41
44 #define MP_CMD_TV_SET_FREQ 42
45 #define MP_CMD_TV_SET_NORM 43
46 #define MP_CMD_TV_SET_BRIGHTNESS 44
47 #define MP_CMD_TV_SET_CONTRAST 45
48 #define MP_CMD_TV_SET_HUE 46
49 #define MP_CMD_TV_SET_SATURATION 47
50 #define MP_CMD_GET_VO_FULLSCREEN 48
51 #define MP_CMD_GET_SUB_VISIBILITY 49
52 #define MP_CMD_SUB_FORCED_ONLY 50
53 #define MP_CMD_VO_ONTOP 51
54 #define MP_CMD_SUB_SELECT 52
55 #define MP_CMD_VO_ROOTWIN 53
56 #define MP_CMD_SWITCH_VSYNC 54
57 #define MP_CMD_SWITCH_RATIO 55
58 #define MP_CMD_FRAME_STEP 56
59 #define MP_CMD_SPEED_INCR 57
60 #define MP_CMD_SPEED_MULT 58
61 #define MP_CMD_SPEED_SET 59
63 #define MP_CMD_SUB_LOG 61
64 #define MP_CMD_SWITCH_AUDIO 62
65 #define MP_CMD_GET_TIME_POS 63
66 #define MP_CMD_SUB_LOAD 64
67 #define MP_CMD_SUB_REMOVE 65
68 #define MP_CMD_KEYDOWN_EVENTS 66
69 #define MP_CMD_VO_BORDER 67
70 #define MP_CMD_SET_PROPERTY 68
71 #define MP_CMD_GET_PROPERTY 69
72 #define MP_CMD_OSD_SHOW_PROPERTY_TEXT 70
73 #define MP_CMD_SEEK_CHAPTER 71
74 #define MP_CMD_FILE_FILTER 72
75 #define MP_CMD_GET_FILENAME 73
76 #define MP_CMD_GET_VIDEO_CODEC 74
77 #define MP_CMD_GET_VIDEO_BITRATE 75
78 #define MP_CMD_GET_VIDEO_RESOLUTION 76
79 #define MP_CMD_GET_AUDIO_CODEC 77
80 #define MP_CMD_GET_AUDIO_BITRATE 78
81 #define MP_CMD_GET_AUDIO_SAMPLES 79
82 #define MP_CMD_GET_META_TITLE 80
83 #define MP_CMD_GET_META_ARTIST 81
84 #define MP_CMD_GET_META_ALBUM 82
85 #define MP_CMD_GET_META_YEAR 83
86 #define MP_CMD_GET_META_COMMENT 84
87 #define MP_CMD_GET_META_TRACK 85
88 #define MP_CMD_GET_META_GENRE 86
89 #define MP_CMD_RADIO_STEP_CHANNEL 87
90 #define MP_CMD_RADIO_SET_CHANNEL 88
91 #define MP_CMD_RADIO_SET_FREQ 89
92 #define MP_CMD_SET_MOUSE_POS 90
93 #define MP_CMD_STEP_PROPERTY 91
94 #define MP_CMD_RADIO_STEP_FREQ 92
95 #define MP_CMD_TV_STEP_FREQ 93
96 #define MP_CMD_LOOP 94
97 #define MP_CMD_BALANCE 96
98 #define MP_CMD_SUB_SCALE 97
99 #define MP_CMD_TV_TELETEXT_ADD_DEC 98
100 #define MP_CMD_TV_TELETEXT_GO_LINK 99
101 #define MP_CMD_TV_START_SCAN 100
102 #define MP_CMD_SUB_SOURCE 101
103 #define MP_CMD_SUB_FILE 102
104 #define MP_CMD_SUB_VOB 103
105 #define MP_CMD_SUB_DEMUX 104
107 #define MP_CMD_GUI_EVENTS 5000
108 #define MP_CMD_GUI_LOADFILE 5001
109 #define MP_CMD_GUI_LOADSUBTITLE 5002
110 #define MP_CMD_GUI_ABOUT 5003
111 #define MP_CMD_GUI_PLAY 5004
112 #define MP_CMD_GUI_STOP 5005
113 #define MP_CMD_GUI_PLAYLIST 5006
114 #define MP_CMD_GUI_PREFERENCES 5007
115 #define MP_CMD_GUI_FULLSCREEN 5008
116 #define MP_CMD_GUI_SKINBROWSER 5009
118 #ifdef HAS_DVBIN_SUPPORT
119 #define MP_CMD_DVB_SET_CHANNEL 5101
122 #define MP_CMD_DVDNAV_UP 1
123 #define MP_CMD_DVDNAV_DOWN 2
124 #define MP_CMD_DVDNAV_LEFT 3
125 #define MP_CMD_DVDNAV_RIGHT 4
126 #define MP_CMD_DVDNAV_MENU 5
127 #define MP_CMD_DVDNAV_SELECT 6
128 #define MP_CMD_DVDNAV_PREVMENU 7
129 #define MP_CMD_DVDNAV_MOUSECLICK 8
132 #define MP_CMD_CHELP 7000
133 #define MP_CMD_CEXIT 7001
134 #define MP_CMD_CHIDE 7002
137 #define MP_CMD_ARG_INT 0
138 #define MP_CMD_ARG_FLOAT 1
139 #define MP_CMD_ARG_STRING 2
140 #define MP_CMD_ARG_VOID 3
142 #ifndef MP_CMD_MAX_ARGS
143 #define MP_CMD_MAX_ARGS 10
146 // Error codes for the drivers
148 // An error occurred but we can continue
149 #define MP_INPUT_ERROR -1
150 // A fatal error occurred, this driver should be removed
151 #define MP_INPUT_DEAD -2
152 // No input was available
153 #define MP_INPUT_NOTHING -3
154 //! Input will be available if you try again
155 #define MP_INPUT_RETRY -4
157 // For the key's drivers, if possible you can send key up and key down
158 // events. Key up is the default, to send a key down you must use the
159 // OR operator between the key code and MP_KEY_DOWN.
160 #define MP_KEY_DOWN (1<<29)
161 // Use this when the key shouldn't be auto-repeated (like mouse buttons)
162 #define MP_NO_REPEAT_KEY (1<<28)
164 #ifndef MP_MAX_KEY_DOWN
165 #define MP_MAX_KEY_DOWN 32
168 typedef union mp_cmd_arg_value
{
173 } mp_cmd_arg_value_t
;
175 typedef struct mp_cmd_arg
{
177 mp_cmd_arg_value_t v
;
180 typedef struct mp_cmd
{
184 mp_cmd_arg_t args
[MP_CMD_MAX_ARGS
];
189 typedef struct mp_cmd_bind
{
190 int input
[MP_MAX_KEY_DOWN
+1];
194 typedef struct mp_key_name
{
199 // These typedefs are for the drivers. They are the functions used to retrieve
200 // the next key code or command.
202 // These functions should return the key code or one of the error codes
203 typedef int (*mp_key_func_t
)(int fd
);
204 // These functions should act like read but they must use our error code (if needed ;-)
205 typedef int (*mp_cmd_func_t
)(int fd
,char* dest
,int size
);
206 // These are used to close the driver
207 typedef void (*mp_close_func_t
)(int fd
);
209 // Set this to grab all incoming key codes
210 extern int (*mp_input_key_cb
)(int code
);
211 // Should return 1 if the command was processed
212 typedef int (*mp_input_cmd_filter
)(mp_cmd_t
* cmd
, int paused
, void* ctx
);
214 // This function adds a new key driver.
215 // The first arg is a file descriptor (use a negative value if you don't use any fd)
216 // The second arg tells if we use select on the fd to know if something is available.
217 // The third arg is optional. If null a default function wich reads an int from the
219 // The last arg can be NULL if nothing is needed to close the driver. The close
220 // function can be used
222 mp_input_add_cmd_fd(int fd
, int select
, mp_cmd_func_t read_func
, mp_close_func_t close_func
);
224 // This removes a cmd driver, you usually don't need to use it.
226 mp_input_rm_cmd_fd(int fd
);
228 // The args are the same as for the key's drivers. If you don't use any valid fd you MUST
231 mp_input_add_key_fd(int fd
, int select
, mp_key_func_t read_func
, mp_close_func_t close_func
);
233 // As for the cmd one you usually don't need this function.
235 mp_input_rm_key_fd(int fd
);
237 int mp_input_add_event_fd(int fd
, void (*read_func
)(void));
239 void mp_input_rm_event_fd(int fd
);
241 /// Get input key from its name.
242 int mp_input_get_key_from_name(const char *name
);
244 // This function can be used to put a command in the system again. It's used by libmpdemux
245 // when it performs a blocking operation to resend the command it received to the main
248 mp_input_queue_cmd(mp_cmd_t
* cmd
);
250 // This function retrieves the next available command waiting no more than time msec.
251 // If pause is true, the next input will always return a pause command.
253 mp_input_get_cmd(int time
, int paused
, int peek_only
);
256 mp_input_parse_cmd(char* str
);
259 * Parse and queue commands separated by '\n'.
260 * @return count of commands new queued.
262 int mp_input_parse_and_queue_cmds(const char *str
);
264 /// These filters allow you to process the command before MPlayer.
265 /// If a filter returns a true value mp_input_get_cmd will return NULL.
267 mp_input_add_cmd_filter(mp_input_cmd_filter
, void* ctx
);
269 // After getting a command from mp_input_get_cmd you need to free it using this
272 mp_cmd_free(mp_cmd_t
* cmd
);
274 // This creates a copy of a command (used by the auto repeat stuff).
276 mp_cmd_clone(mp_cmd_t
* cmd
);
278 // Set current input section
280 mp_input_set_section(char *name
);
282 // Get current input section
284 mp_input_get_section(void);
286 // When you create a new driver you should add it in these 2 functions.
288 mp_input_init(int use_gui
);
291 mp_input_uninit(void);
293 // Interruptible usleep: (used by libmpdemux)
295 mp_input_check_interrupt(int time
);