Remove remnants of the nonfunctional "grab_frames" command.
[mplayer.git] / input / input.h
blob86706e6be47895e1fe8697b7aff5314ea499c1cf
1 // All command IDs
2 #define MP_CMD_SEEK 0
3 #define MP_CMD_AUDIO_DELAY 1
4 #define MP_CMD_QUIT 2
5 #define MP_CMD_PAUSE 3
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
11 #define MP_CMD_OSD 9
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
16 #define MP_CMD_HUE 14
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
62 #define MP_CMD_RUN 60
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
96 #define MP_CMD_GUI_EVENTS 5000
97 #define MP_CMD_GUI_LOADFILE 5001
98 #define MP_CMD_GUI_LOADSUBTITLE 5002
99 #define MP_CMD_GUI_ABOUT 5003
100 #define MP_CMD_GUI_PLAY 5004
101 #define MP_CMD_GUI_STOP 5005
102 #define MP_CMD_GUI_PLAYLIST 5006
103 #define MP_CMD_GUI_PREFERENCES 5007
104 #define MP_CMD_GUI_FULLSCREEN 5008
105 #define MP_CMD_GUI_SKINBROWSER 5009
107 #ifdef HAS_DVBIN_SUPPORT
108 #define MP_CMD_DVB_SET_CHANNEL 5101
109 #endif
111 #define MP_CMD_DVDNAV_UP 1
112 #define MP_CMD_DVDNAV_DOWN 2
113 #define MP_CMD_DVDNAV_LEFT 3
114 #define MP_CMD_DVDNAV_RIGHT 4
115 #define MP_CMD_DVDNAV_MENU 5
116 #define MP_CMD_DVDNAV_SELECT 6
117 #define MP_CMD_DVDNAV_PREVMENU 7
118 #define MP_CMD_DVDNAV_MOUSECLICK 8
120 /// Console commands
121 #define MP_CMD_CHELP 7000
122 #define MP_CMD_CEXIT 7001
123 #define MP_CMD_CHIDE 7002
125 // The arg types
126 #define MP_CMD_ARG_INT 0
127 #define MP_CMD_ARG_FLOAT 1
128 #define MP_CMD_ARG_STRING 2
129 #define MP_CMD_ARG_VOID 3
131 #ifndef MP_CMD_MAX_ARGS
132 #define MP_CMD_MAX_ARGS 10
133 #endif
135 // Error codes for the drivers
137 // An error occurred but we can continue
138 #define MP_INPUT_ERROR -1
139 // A fatal error occurred, this driver should be removed
140 #define MP_INPUT_DEAD -2
141 // No input was available
142 #define MP_INPUT_NOTHING -3
143 //! Input will be available if you try again
144 #define MP_INPUT_RETRY -4
146 // For the key's drivers, if possible you can send key up and key down
147 // events. Key up is the default, to send a key down you must use the
148 // OR operator between the key code and MP_KEY_DOWN.
149 #define MP_KEY_DOWN (1<<29)
150 // Use this when the key shouldn't be auto-repeated (like mouse buttons)
151 #define MP_NO_REPEAT_KEY (1<<28)
153 #ifndef MP_MAX_KEY_DOWN
154 #define MP_MAX_KEY_DOWN 32
155 #endif
157 typedef union mp_cmd_arg_value {
158 int i;
159 float f;
160 char* s;
161 void* v;
162 } mp_cmd_arg_value_t;
164 typedef struct mp_cmd_arg {
165 int type;
166 mp_cmd_arg_value_t v;
167 } mp_cmd_arg_t;
169 typedef struct mp_cmd {
170 int id;
171 char* name;
172 int nargs;
173 mp_cmd_arg_t args[MP_CMD_MAX_ARGS];
174 int pausing;
175 } mp_cmd_t;
178 typedef struct mp_cmd_bind {
179 int input[MP_MAX_KEY_DOWN+1];
180 char* cmd;
181 } mp_cmd_bind_t;
183 typedef struct mp_key_name {
184 int key;
185 char* name;
186 } mp_key_name_t;
188 // These typedefs are for the drivers. They are the functions used to retrieve
189 // the next key code or command.
191 // These functions should return the key code or one of the error codes
192 typedef int (*mp_key_func_t)(int fd);
193 // These functions should act like read but they must use our error code (if needed ;-)
194 typedef int (*mp_cmd_func_t)(int fd,char* dest,int size);
195 // These are used to close the driver
196 typedef void (*mp_close_func_t)(int fd);
198 // Set this to grab all incoming key codes
199 extern void (*mp_input_key_cb)(int code);
200 // Should return 1 if the command was processed
201 typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, void* ctx);
203 // This function adds a new key driver.
204 // The first arg is a file descriptor (use a negative value if you don't use any fd)
205 // The second arg tells if we use select on the fd to know if something is available.
206 // The third arg is optional. If null a default function wich reads an int from the
207 // fd will be used.
208 // The last arg can be NULL if nothing is needed to close the driver. The close
209 // function can be used
211 mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func);
213 // This removes a cmd driver, you usually don't need to use it.
214 void
215 mp_input_rm_cmd_fd(int fd);
217 // The args are the same as for the key's drivers. If you don't use any valid fd you MUST
218 // give a read_func.
220 mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func);
222 // As for the cmd one you usually don't need this function.
223 void
224 mp_input_rm_key_fd(int fd);
226 // This function can be used to put a command in the system again. It's used by libmpdemux
227 // when it performs a blocking operation to resend the command it received to the main
228 // loop.
230 mp_input_queue_cmd(mp_cmd_t* cmd);
232 // This function retrieves the next available command waiting no more than time msec.
233 // If pause is true, the next input will always return a pause command.
234 mp_cmd_t*
235 mp_input_get_cmd(int time, int paused, int peek_only);
237 mp_cmd_t*
238 mp_input_parse_cmd(char* str);
240 /// These filters allow you to process the command before MPlayer.
241 /// If a filter returns a true value mp_input_get_cmd will return NULL.
242 void
243 mp_input_add_cmd_filter(mp_input_cmd_filter, void* ctx);
245 // After getting a command from mp_input_get_cmd you need to free it using this
246 // function
247 void
248 mp_cmd_free(mp_cmd_t* cmd);
250 // This creates a copy of a command (used by the auto repeat stuff).
251 mp_cmd_t*
252 mp_cmd_clone(mp_cmd_t* cmd);
254 // When you create a new driver you should add it in these 2 functions.
255 void
256 mp_input_init(int use_gui);
258 void
259 mp_input_uninit(void);
261 // Interruptible usleep: (used by libmpdemux)
263 mp_input_check_interrupt(int time);