annotate input/input.h @ 35334:3397976a029b

stream ftp: readline: Always initialize output parameter buf Only exception if passed parameter max is less than or equal to zero. That cannot happen with the current code. Additionally change readresp function to always copy the first response line if the parameter rsp is non-NULL. This fixes some error reporting that used uninitialized stack arrays.
author al
date Tue, 20 Nov 2012 22:16:29 +0000
parents f05c75392897
children 2d29160e0957
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28112
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
1 /*
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
2 * This file is part of MPlayer.
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
3 *
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
5 * it under the terms of the GNU General Public License as published by
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
7 * (at your option) any later version.
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
8 *
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
12 * GNU General Public License for more details.
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
13 *
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
14 * You should have received a copy of the GNU General Public License along
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
17 */
142c53391eb7 Add standard GPL license header.
diego
parents: 28054
diff changeset
18
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25817
diff changeset
19 #ifndef MPLAYER_INPUT_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25817
diff changeset
20 #define MPLAYER_INPUT_H
25553
6ac1ece1f9fe Add multiple inclusion guards to all header files that lack them.
diego
parents: 25502
diff changeset
21
30530
c5d1693acb35 Declare mp_input_register_options() in input/input.h.
diego
parents: 29263
diff changeset
22 #include "m_config.h"
c5d1693acb35 Declare mp_input_register_options() in input/input.h.
diego
parents: 29263
diff changeset
23
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
24 // All command IDs
27066
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
25 typedef enum {
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
26 MP_CMD_SEEK,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
27 MP_CMD_AUDIO_DELAY,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
28 MP_CMD_QUIT,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
29 MP_CMD_PAUSE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
30 MP_CMD_GRAB_FRAMES, // deprecated: was a no-op command for years
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
31 MP_CMD_PLAY_TREE_STEP,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
32 MP_CMD_PLAY_TREE_UP_STEP,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
33 MP_CMD_PLAY_ALT_SRC_STEP,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
34 MP_CMD_SUB_DELAY,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
35 MP_CMD_OSD,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
36 MP_CMD_VOLUME,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
37 MP_CMD_MIXER_USEMASTER,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
38 MP_CMD_CONTRAST,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
39 MP_CMD_BRIGHTNESS,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
40 MP_CMD_HUE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
41 MP_CMD_SATURATION,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
42 MP_CMD_FRAMEDROPPING,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
43 MP_CMD_TV_STEP_CHANNEL,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
44 MP_CMD_TV_STEP_NORM,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
45 MP_CMD_TV_STEP_CHANNEL_LIST,
32438
faefba58f413 Implement a basic capture feature, available through -capture.
diego
parents: 32419
diff changeset
46 MP_CMD_CAPTURING,
27066
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
47 MP_CMD_VO_FULLSCREEN,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
48 MP_CMD_SUB_POS,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
49 MP_CMD_DVDNAV,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
50 MP_CMD_SCREENSHOT,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
51 MP_CMD_PANSCAN,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
52 MP_CMD_MUTE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
53 MP_CMD_LOADFILE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
54 MP_CMD_LOADLIST,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
55 MP_CMD_VF_CHANGE_RECTANGLE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
56 MP_CMD_GAMMA,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
57 MP_CMD_SUB_VISIBILITY,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
58 MP_CMD_VOBSUB_LANG, // deprecated: combined with SUB_SELECT
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
59 MP_CMD_MENU,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
60 MP_CMD_SET_MENU,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
61 MP_CMD_GET_TIME_LENGTH,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
62 MP_CMD_GET_PERCENT_POS,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
63 MP_CMD_SUB_STEP,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
64 MP_CMD_TV_SET_CHANNEL,
31956
a6c25d94e60e Add new slave mode command for loading EDL file on demand.
reynaldo
parents: 31319
diff changeset
65 MP_CMD_EDL_LOADFILE,
27066
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
66 MP_CMD_EDL_MARK,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
67 MP_CMD_SUB_ALIGNMENT,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
68 MP_CMD_TV_LAST_CHANNEL,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
69 MP_CMD_OSD_SHOW_TEXT,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
70 MP_CMD_TV_SET_FREQ,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
71 MP_CMD_TV_SET_NORM,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
72 MP_CMD_TV_SET_BRIGHTNESS,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
73 MP_CMD_TV_SET_CONTRAST,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
74 MP_CMD_TV_SET_HUE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
75 MP_CMD_TV_SET_SATURATION,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
76 MP_CMD_GET_VO_FULLSCREEN,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
77 MP_CMD_GET_SUB_VISIBILITY,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
78 MP_CMD_SUB_FORCED_ONLY,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
79 MP_CMD_VO_ONTOP,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
80 MP_CMD_SUB_SELECT,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
81 MP_CMD_VO_ROOTWIN,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
82 MP_CMD_SWITCH_VSYNC,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
83 MP_CMD_SWITCH_RATIO,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
84 MP_CMD_FRAME_STEP,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
85 MP_CMD_SPEED_INCR,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
86 MP_CMD_SPEED_MULT,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
87 MP_CMD_SPEED_SET,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
88 MP_CMD_RUN,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
89 MP_CMD_SUB_LOG,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
90 MP_CMD_SWITCH_AUDIO,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
91 MP_CMD_GET_TIME_POS,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
92 MP_CMD_SUB_LOAD,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
93 MP_CMD_SUB_REMOVE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
94 MP_CMD_KEYDOWN_EVENTS,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
95 MP_CMD_VO_BORDER,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
96 MP_CMD_SET_PROPERTY,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
97 MP_CMD_GET_PROPERTY,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
98 MP_CMD_OSD_SHOW_PROPERTY_TEXT,
30986
2186c040f9e0 Add osd_show_progression: Show progress bar and elapsed/total time.
cehoyos
parents: 30530
diff changeset
99 MP_CMD_OSD_SHOW_PROGRESSION,
27066
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
100 MP_CMD_SEEK_CHAPTER,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
101 MP_CMD_FILE_FILTER,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
102 MP_CMD_GET_FILENAME,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
103 MP_CMD_GET_VIDEO_CODEC,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
104 MP_CMD_GET_VIDEO_BITRATE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
105 MP_CMD_GET_VIDEO_RESOLUTION,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
106 MP_CMD_GET_AUDIO_CODEC,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
107 MP_CMD_GET_AUDIO_BITRATE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
108 MP_CMD_GET_AUDIO_SAMPLES,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
109 MP_CMD_GET_META_TITLE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
110 MP_CMD_GET_META_ARTIST,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
111 MP_CMD_GET_META_ALBUM,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
112 MP_CMD_GET_META_YEAR,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
113 MP_CMD_GET_META_COMMENT,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
114 MP_CMD_GET_META_TRACK,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
115 MP_CMD_GET_META_GENRE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
116 MP_CMD_RADIO_STEP_CHANNEL,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
117 MP_CMD_RADIO_SET_CHANNEL,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
118 MP_CMD_RADIO_SET_FREQ,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
119 MP_CMD_SET_MOUSE_POS,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
120 MP_CMD_STEP_PROPERTY,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
121 MP_CMD_RADIO_STEP_FREQ,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
122 MP_CMD_TV_STEP_FREQ,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
123 MP_CMD_LOOP,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
124 MP_CMD_BALANCE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
125 MP_CMD_SUB_SCALE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
126 MP_CMD_TV_TELETEXT_ADD_DEC,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
127 MP_CMD_TV_TELETEXT_GO_LINK,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
128 MP_CMD_TV_START_SCAN,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
129 MP_CMD_SUB_SOURCE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
130 MP_CMD_SUB_FILE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
131 MP_CMD_SUB_VOB,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
132 MP_CMD_SUB_DEMUX,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
133 MP_CMD_SWITCH_ANGLE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
134 MP_CMD_ASS_USE_MARGINS,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
135 MP_CMD_SWITCH_TITLE,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
136 MP_CMD_STOP,
32392
7fd2de8d6f32 Add the overlay_add and overlay_remove commands.
cigaes
parents: 31956
diff changeset
137 MP_CMD_OVERLAY_ADD,
7fd2de8d6f32 Add the overlay_add and overlay_remove commands.
cigaes
parents: 31956
diff changeset
138 MP_CMD_OVERLAY_REMOVE,
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
139
27068
d7e0e33c546f Change DVDNAV command key names.
ben
parents: 27066
diff changeset
140 /// DVDNAV commands
d7e0e33c546f Change DVDNAV command key names.
ben
parents: 27066
diff changeset
141 MP_CMD_DVDNAV_UP = 1000,
d7e0e33c546f Change DVDNAV command key names.
ben
parents: 27066
diff changeset
142 MP_CMD_DVDNAV_DOWN,
d7e0e33c546f Change DVDNAV command key names.
ben
parents: 27066
diff changeset
143 MP_CMD_DVDNAV_LEFT,
d7e0e33c546f Change DVDNAV command key names.
ben
parents: 27066
diff changeset
144 MP_CMD_DVDNAV_RIGHT,
d7e0e33c546f Change DVDNAV command key names.
ben
parents: 27066
diff changeset
145 MP_CMD_DVDNAV_MENU,
d7e0e33c546f Change DVDNAV command key names.
ben
parents: 27066
diff changeset
146 MP_CMD_DVDNAV_SELECT,
d7e0e33c546f Change DVDNAV command key names.
ben
parents: 27066
diff changeset
147 MP_CMD_DVDNAV_PREVMENU,
d7e0e33c546f Change DVDNAV command key names.
ben
parents: 27066
diff changeset
148 MP_CMD_DVDNAV_MOUSECLICK,
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28112
diff changeset
149
27066
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
150 /// DVB commands
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
151 MP_CMD_DVB_SET_CHANNEL = 5101,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
152
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
153 /// Console commands
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
154 MP_CMD_CHELP = 7000,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
155 MP_CMD_CEXIT,
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
156 MP_CMD_CHIDE,
30988
8d840754a921 Add slave commands for loading and unloading audio filters at runtime.
cehoyos
parents: 30986
diff changeset
157
8d840754a921 Add slave commands for loading and unloading audio filters at runtime.
cehoyos
parents: 30986
diff changeset
158 /// Audio Filter commands
8d840754a921 Add slave commands for loading and unloading audio filters at runtime.
cehoyos
parents: 30986
diff changeset
159 MP_CMD_AF_SWITCH,
8d840754a921 Add slave commands for loading and unloading audio filters at runtime.
cehoyos
parents: 30986
diff changeset
160 MP_CMD_AF_ADD,
8d840754a921 Add slave commands for loading and unloading audio filters at runtime.
cehoyos
parents: 30986
diff changeset
161 MP_CMD_AF_DEL,
8d840754a921 Add slave commands for loading and unloading audio filters at runtime.
cehoyos
parents: 30986
diff changeset
162 MP_CMD_AF_CLR,
32419
8f35fc25523f Add experimental af_cmdline slave command to allow changing filter options at runtime.
reimar
parents: 32392
diff changeset
163 MP_CMD_AF_CMDLINE,
30988
8d840754a921 Add slave commands for loading and unloading audio filters at runtime.
cehoyos
parents: 30986
diff changeset
164
34339
f05c75392897 Enable gui slave commands.
ib
parents: 33017
diff changeset
165 /// GUI command
f05c75392897 Enable gui slave commands.
ib
parents: 33017
diff changeset
166 MP_CMD_GUI,
f05c75392897 Enable gui slave commands.
ib
parents: 33017
diff changeset
167
27066
361349e1ac6b Group all input command defines in one big enum
ben
parents: 26877
diff changeset
168 } mp_command_type;
10568
02e4b1f77d6a dvbin fix by Nico <nsabbi@libero.it>
alex
parents: 10521
diff changeset
169
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
170 // The arg types
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
171 #define MP_CMD_ARG_INT 0
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
172 #define MP_CMD_ARG_FLOAT 1
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
173 #define MP_CMD_ARG_STRING 2
5473
39dae98304af dvdnav event added, queue size 10->100, added void* event arg type - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents: 5380
diff changeset
174 #define MP_CMD_ARG_VOID 3
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
175
5197
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
176 #ifndef MP_CMD_MAX_ARGS
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
177 #define MP_CMD_MAX_ARGS 10
5197
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
178 #endif
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
179
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
180 // Error codes for the drivers
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
181
11678
972d1998bde9 occured --> occurred typo patch by Clinton Roy <croy@dstc.edu.au>
diego
parents: 11542
diff changeset
182 // An error occurred but we can continue
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
183 #define MP_INPUT_ERROR -1
11678
972d1998bde9 occured --> occurred typo patch by Clinton Roy <croy@dstc.edu.au>
diego
parents: 11542
diff changeset
184 // A fatal error occurred, this driver should be removed
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
185 #define MP_INPUT_DEAD -2
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
186 // No input was available
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
187 #define MP_INPUT_NOTHING -3
15825
8549fc0fb5b1 consume empty lirc events at once.
reimar
parents: 15706
diff changeset
188 //! Input will be available if you try again
8549fc0fb5b1 consume empty lirc events at once.
reimar
parents: 15706
diff changeset
189 #define MP_INPUT_RETRY -4
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
190
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
191 // For the key's drivers, if possible you can send key up and key down
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28112
diff changeset
192 // events. Key up is the default, to send a key down you must use the
13634
9a270ee1682e Comment clarified, patch by Sylvain Colinet <scolinet at gmail dot com>.
diego
parents: 13626
diff changeset
193 // OR operator between the key code and MP_KEY_DOWN.
4657
610a11e4db36 Added key autorepeat support. Options to enable/disable joystick and lirc
albeu
parents: 4589
diff changeset
194 #define MP_KEY_DOWN (1<<29)
5197
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
195 // Use this when the key shouldn't be auto-repeated (like mouse buttons)
4657
610a11e4db36 Added key autorepeat support. Options to enable/disable joystick and lirc
albeu
parents: 4589
diff changeset
196 #define MP_NO_REPEAT_KEY (1<<28)
33017
cc8cef372901 Make "stuck keys" problem impossibly by resetting the internal
reimar
parents: 32438
diff changeset
197 // Special value to mark all keys as "up"
cc8cef372901 Make "stuck keys" problem impossibly by resetting the internal
reimar
parents: 32438
diff changeset
198 #define MP_KEY_RELEASE_ALL (1<<27)
4589
4ce20c55a18a Added support for key combination and mouse buttons key code
albeu
parents: 4431
diff changeset
199
4ce20c55a18a Added support for key combination and mouse buttons key code
albeu
parents: 4431
diff changeset
200 #ifndef MP_MAX_KEY_DOWN
4ce20c55a18a Added support for key combination and mouse buttons key code
albeu
parents: 4431
diff changeset
201 #define MP_MAX_KEY_DOWN 32
4ce20c55a18a Added support for key combination and mouse buttons key code
albeu
parents: 4431
diff changeset
202 #endif
4ce20c55a18a Added support for key combination and mouse buttons key code
albeu
parents: 4431
diff changeset
203
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
204 typedef union mp_cmd_arg_value {
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
205 int i;
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
206 float f;
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
207 char* s;
5473
39dae98304af dvdnav event added, queue size 10->100, added void* event arg type - dvdnav patch by Kees Cook <mplayer@outflux.net>
arpi
parents: 5380
diff changeset
208 void* v;
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
209 } mp_cmd_arg_value_t;
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
210
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
211 typedef struct mp_cmd_arg {
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
212 int type;
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
213 mp_cmd_arg_value_t v;
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
214 } mp_cmd_arg_t;
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
215
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
216 typedef struct mp_cmd {
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
217 int id;
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
218 char* name;
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
219 int nargs;
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
220 mp_cmd_arg_t args[MP_CMD_MAX_ARGS];
13991
28a6f0847c58 add "pausing" prefix for MPlayer commands
reimar
parents: 13710
diff changeset
221 int pausing;
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
222 } mp_cmd_t;
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
223
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
224
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
225 typedef struct mp_cmd_bind {
4589
4ce20c55a18a Added support for key combination and mouse buttons key code
albeu
parents: 4431
diff changeset
226 int input[MP_MAX_KEY_DOWN+1];
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
227 char* cmd;
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
228 } mp_cmd_bind_t;
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
229
4589
4ce20c55a18a Added support for key combination and mouse buttons key code
albeu
parents: 4431
diff changeset
230 typedef struct mp_key_name {
4ce20c55a18a Added support for key combination and mouse buttons key code
albeu
parents: 4431
diff changeset
231 int key;
4ce20c55a18a Added support for key combination and mouse buttons key code
albeu
parents: 4431
diff changeset
232 char* name;
4ce20c55a18a Added support for key combination and mouse buttons key code
albeu
parents: 4431
diff changeset
233 } mp_key_name_t;
4ce20c55a18a Added support for key combination and mouse buttons key code
albeu
parents: 4431
diff changeset
234
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
235 // These typedefs are for the drivers. They are the functions used to retrieve
5197
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
236 // the next key code or command.
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
237
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
238 // These functions should return the key code or one of the error codes
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
239 typedef int (*mp_key_func_t)(int fd);
7912
e15e76559bd5 Reverse Arpi's commit and put the right fix in place.
albeu
parents: 7862
diff changeset
240 // These functions should act like read but they must use our error code (if needed ;-)
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
241 typedef int (*mp_cmd_func_t)(int fd,char* dest,int size);
5197
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
242 // These are used to close the driver
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
243 typedef void (*mp_close_func_t)(int fd);
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
244
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
245 // Set this to grab all incoming key codes
28054
d717788f3fb6 Re-add "extern"s incorrectly removed in r28085
reimar
parents: 28051
diff changeset
246 extern int (*mp_input_key_cb)(int code);
8196
419bdbfdb660 Add the possibilty to grab the keys and to filter the commands
albeu
parents: 7912
diff changeset
247 // Should return 1 if the command was processed
419bdbfdb660 Add the possibilty to grab the keys and to filter the commands
albeu
parents: 7912
diff changeset
248 typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, void* ctx);
419bdbfdb660 Add the possibilty to grab the keys and to filter the commands
albeu
parents: 7912
diff changeset
249
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
250 // This function adds a new key driver.
5197
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
251 // The first arg is a file descriptor (use a negative value if you don't use any fd)
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
252 // The second arg tells if we use select on the fd to know if something is available.
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
253 // The third arg is optional. If null a default function wich reads an int from the
5197
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
254 // fd will be used.
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
255 // The last arg can be NULL if nothing is needed to close the driver. The close
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
256 // function can be used
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
257 int
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
258 mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func);
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
259
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
260 // This removes a cmd driver, you usually don't need to use it.
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
261 void
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
262 mp_input_rm_cmd_fd(int fd);
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
263
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
264 // The args are the same as for the key's drivers. If you don't use any valid fd you MUST
5197
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
265 // give a read_func.
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
266 int
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
267 mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func);
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
268
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
269 // As for the cmd one you usually don't need this function.
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
270 void
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
271 mp_input_rm_key_fd(int fd);
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
272
24132
9f234010c4be Add separate event input type for terminal+vo
uau
parents: 24105
diff changeset
273 int mp_input_add_event_fd(int fd, void (*read_func)(void));
9f234010c4be Add separate event input type for terminal+vo
uau
parents: 24105
diff changeset
274
9f234010c4be Add separate event input type for terminal+vo
uau
parents: 24105
diff changeset
275 void mp_input_rm_event_fd(int fd);
9f234010c4be Add separate event input type for terminal+vo
uau
parents: 24105
diff changeset
276
25263
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25129
diff changeset
277 /// Get input key from its name.
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25129
diff changeset
278 int mp_input_get_key_from_name(const char *name);
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25129
diff changeset
279
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
280 // This function can be used to put a command in the system again. It's used by libmpdemux
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
281 // when it performs a blocking operation to resend the command it received to the main
5197
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
282 // loop.
4821
5a71377d2759 Fixed bug with comments in input.conf parser
albeu
parents: 4732
diff changeset
283 int
5a71377d2759 Fixed bug with comments in input.conf parser
albeu
parents: 4732
diff changeset
284 mp_input_queue_cmd(mp_cmd_t* cmd);
5a71377d2759 Fixed bug with comments in input.conf parser
albeu
parents: 4732
diff changeset
285
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
286 // This function retrieves the next available command waiting no more than time msec.
5197
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
287 // If pause is true, the next input will always return a pause command.
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
288 mp_cmd_t*
13603
80fc8f48f14c Do not loose commands while paused.
reimar
parents: 13339
diff changeset
289 mp_input_get_cmd(int time, int paused, int peek_only);
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
290
8196
419bdbfdb660 Add the possibilty to grab the keys and to filter the commands
albeu
parents: 7912
diff changeset
291 mp_cmd_t*
419bdbfdb660 Add the possibilty to grab the keys and to filter the commands
albeu
parents: 7912
diff changeset
292 mp_input_parse_cmd(char* str);
419bdbfdb660 Add the possibilty to grab the keys and to filter the commands
albeu
parents: 7912
diff changeset
293
25319
50a30be5300c Add new function for parsing and queueing multi-commands separated by \n or \r.
ulion
parents: 25263
diff changeset
294 /**
50a30be5300c Add new function for parsing and queueing multi-commands separated by \n or \r.
ulion
parents: 25263
diff changeset
295 * Parse and queue commands separated by '\n'.
50a30be5300c Add new function for parsing and queueing multi-commands separated by \n or \r.
ulion
parents: 25263
diff changeset
296 * @return count of commands new queued.
50a30be5300c Add new function for parsing and queueing multi-commands separated by \n or \r.
ulion
parents: 25263
diff changeset
297 */
50a30be5300c Add new function for parsing and queueing multi-commands separated by \n or \r.
ulion
parents: 25263
diff changeset
298 int mp_input_parse_and_queue_cmds(const char *str);
50a30be5300c Add new function for parsing and queueing multi-commands separated by \n or \r.
ulion
parents: 25263
diff changeset
299
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
300 /// These filters allow you to process the command before MPlayer.
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
301 /// If a filter returns a true value mp_input_get_cmd will return NULL.
8196
419bdbfdb660 Add the possibilty to grab the keys and to filter the commands
albeu
parents: 7912
diff changeset
302 void
419bdbfdb660 Add the possibilty to grab the keys and to filter the commands
albeu
parents: 7912
diff changeset
303 mp_input_add_cmd_filter(mp_input_cmd_filter, void* ctx);
419bdbfdb660 Add the possibilty to grab the keys and to filter the commands
albeu
parents: 7912
diff changeset
304
5197
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
305 // After getting a command from mp_input_get_cmd you need to free it using this
f0e3dcefb7af Commentting session
albeu
parents: 5015
diff changeset
306 // function
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
307 void
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
308 mp_cmd_free(mp_cmd_t* cmd);
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
309
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
310 // This creates a copy of a command (used by the auto repeat stuff).
4657
610a11e4db36 Added key autorepeat support. Options to enable/disable joystick and lirc
albeu
parents: 4589
diff changeset
311 mp_cmd_t*
610a11e4db36 Added key autorepeat support. Options to enable/disable joystick and lirc
albeu
parents: 4589
diff changeset
312 mp_cmd_clone(mp_cmd_t* cmd);
610a11e4db36 Added key autorepeat support. Options to enable/disable joystick and lirc
albeu
parents: 4589
diff changeset
313
23477
15710094cb15 implement "bind sections"
voroshil
parents: 22667
diff changeset
314 // Set current input section
15710094cb15 implement "bind sections"
voroshil
parents: 22667
diff changeset
315 void
15710094cb15 implement "bind sections"
voroshil
parents: 22667
diff changeset
316 mp_input_set_section(char *name);
15710094cb15 implement "bind sections"
voroshil
parents: 22667
diff changeset
317
15710094cb15 implement "bind sections"
voroshil
parents: 22667
diff changeset
318 // Get current input section
15710094cb15 implement "bind sections"
voroshil
parents: 22667
diff changeset
319 char*
15710094cb15 implement "bind sections"
voroshil
parents: 22667
diff changeset
320 mp_input_get_section(void);
15710094cb15 implement "bind sections"
voroshil
parents: 22667
diff changeset
321
10867
5b666694b437 spelling cosmetics
diego
parents: 10580
diff changeset
322 // When you create a new driver you should add it in these 2 functions.
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
323 void
31319
14bbe725b50e Remove unused mp_input_init parameter.
reimar
parents: 31312
diff changeset
324 mp_input_init(void);
4418
8141d2c399e4 A new configurable input system and joystick support for this system
albeu
parents:
diff changeset
325
4431
44c23fd75005 Added uninit to input
albeu
parents: 4418
diff changeset
326 void
44c23fd75005 Added uninit to input
albeu
parents: 4418
diff changeset
327 mp_input_uninit(void);
7862
013c255225d8 mpdemux.c|h moved to libinput, mpdemux_check_interrupt() -> mp_input_check_interrupt()
arpi
parents: 7779
diff changeset
328
30530
c5d1693acb35 Declare mp_input_register_options() in input/input.h.
diego
parents: 29263
diff changeset
329 void mp_input_register_options(m_config_t* cfg);
c5d1693acb35 Declare mp_input_register_options() in input/input.h.
diego
parents: 29263
diff changeset
330
7862
013c255225d8 mpdemux.c|h moved to libinput, mpdemux_check_interrupt() -> mp_input_check_interrupt()
arpi
parents: 7779
diff changeset
331 // Interruptible usleep: (used by libmpdemux)
013c255225d8 mpdemux.c|h moved to libinput, mpdemux_check_interrupt() -> mp_input_check_interrupt()
arpi
parents: 7779
diff changeset
332 int
013c255225d8 mpdemux.c|h moved to libinput, mpdemux_check_interrupt() -> mp_input_check_interrupt()
arpi
parents: 7779
diff changeset
333 mp_input_check_interrupt(int time);
013c255225d8 mpdemux.c|h moved to libinput, mpdemux_check_interrupt() -> mp_input_check_interrupt()
arpi
parents: 7779
diff changeset
334
25623
b955a135e3a8 Do not use exit_player in the signal handler, this code just can not
reimar
parents: 25576
diff changeset
335 extern int async_quit_request;
b955a135e3a8 Do not use exit_player in the signal handler, this code just can not
reimar
parents: 25576
diff changeset
336
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25817
diff changeset
337 #endif /* MPLAYER_INPUT_H */