Mercurial > mplayer.hg
annotate input/input.h @ 5380:8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
| author | arpi |
|---|---|
| date | Thu, 28 Mar 2002 20:40:21 +0000 |
| parents | f0e3dcefb7af |
| children | 39dae98304af |
| rev | line source |
|---|---|
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
1 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
2 #ifdef HAVE_NEW_INPUT |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
3 |
| 5197 | 4 // All commands id |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
5 #define MP_CMD_SEEK 0 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
6 #define MP_CMD_AUDIO_DELAY 1 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
7 #define MP_CMD_QUIT 2 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
8 #define MP_CMD_PAUSE 3 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
9 #define MP_CMD_GRAB_FRAMES 4 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
10 #define MP_CMD_PLAY_TREE_STEP 5 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
11 #define MP_CMD_PLAY_TREE_UP_STEP 6 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
12 #define MP_CMD_PLAY_ALT_SRC_STEP 7 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
13 #define MP_CMD_SUB_DELAY 8 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
14 #define MP_CMD_OSD 9 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
15 #define MP_CMD_VOLUME 10 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
16 #define MP_CMD_MIXER_USEMASTER 11 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
17 #define MP_CMD_CONTRAST 12 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
18 #define MP_CMD_BRIGHTNESS 13 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
19 #define MP_CMD_HUE 14 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
20 #define MP_CMD_SATURATION 15 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
21 #define MP_CMD_FRAMEDROPPING 16 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
22 #define MP_CMD_TV_STEP_CHANNEL 17 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
23 #define MP_CMD_TV_STEP_NORM 18 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
24 #define MP_CMD_TV_STEP_CHANNEL_LIST 19 |
| 4732 | 25 #define MP_CMD_VO_FULLSCREEN 20 |
|
5015
9842148f6053
-subpos key bindings with new input layer - patch by Tomas Konir <moje@molly.vabo.cz>
arpi
parents:
4858
diff
changeset
|
26 #define MP_CMD_SUB_POS 21 |
|
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
5197
diff
changeset
|
27 #define MP_CMD_DVDNAV 22 |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
28 |
| 4858 | 29 #define MP_CMD_GUI_EVENTS 5000 |
| 30 #define MP_CMD_GUI_LOADFILE 5001 | |
| 31 #define MP_CMD_GUI_LOADSUBTITLE 5002 | |
| 32 #define MP_CMD_GUI_ABOUT 5003 | |
| 33 #define MP_CMD_GUI_PLAY 5004 | |
| 34 #define MP_CMD_GUI_STOP 5005 | |
| 35 #define MP_CMD_GUI_PLAYLIST 5006 | |
| 36 #define MP_CMD_GUI_PREFERENCES 5007 | |
| 37 #define MP_CMD_GUI_FULLSCREEN 5008 | |
| 38 #define MP_CMD_GUI_SKINBROWSER 5009 | |
| 39 | |
|
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
5197
diff
changeset
|
40 #define MP_CMD_DVDNAV_UP 1 |
|
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
5197
diff
changeset
|
41 #define MP_CMD_DVDNAV_DOWN 2 |
|
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
5197
diff
changeset
|
42 #define MP_CMD_DVDNAV_LEFT 3 |
|
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
5197
diff
changeset
|
43 #define MP_CMD_DVDNAV_RIGHT 4 |
|
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
5197
diff
changeset
|
44 #define MP_CMD_DVDNAV_MENU 5 |
|
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
5197
diff
changeset
|
45 #define MP_CMD_DVDNAV_SELECT 6 |
|
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
5197
diff
changeset
|
46 |
| 5197 | 47 // The args types |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
48 #define MP_CMD_ARG_INT 0 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
49 #define MP_CMD_ARG_FLOAT 1 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
50 #define MP_CMD_ARG_STRING 2 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
51 |
| 5197 | 52 #ifndef MP_CMD_MAX_ARGS |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
53 #define MP_CMD_MAX_ARGS 10 |
| 5197 | 54 #endif |
| 55 | |
| 56 // Error codes for the drivers | |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
57 |
| 5197 | 58 // An error occured but we can continue |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
59 #define MP_INPUT_ERROR -1 |
| 5197 | 60 // A fatal error occured, this driver should be removed |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
61 #define MP_INPUT_DEAD -2 |
| 5197 | 62 // No input were avaible |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
63 #define MP_INPUT_NOTHING -3 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
64 |
| 5197 | 65 // For the keys drivers, if possible you can send key up and key down |
| 66 // events. Key up is the default, to send a key down you must or the key | |
| 67 // code with MP_KEY_DOWN | |
|
4657
610a11e4db36
Added key autorepeat support. Options to enable/disable joystick and lirc
albeu
parents:
4589
diff
changeset
|
68 #define MP_KEY_DOWN (1<<29) |
| 5197 | 69 // 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
|
70 #define MP_NO_REPEAT_KEY (1<<28) |
|
4589
4ce20c55a18a
Added support for key combination and mouse buttons key code
albeu
parents:
4431
diff
changeset
|
71 |
|
4ce20c55a18a
Added support for key combination and mouse buttons key code
albeu
parents:
4431
diff
changeset
|
72 #ifndef MP_MAX_KEY_DOWN |
|
4ce20c55a18a
Added support for key combination and mouse buttons key code
albeu
parents:
4431
diff
changeset
|
73 #define MP_MAX_KEY_DOWN 32 |
|
4ce20c55a18a
Added support for key combination and mouse buttons key code
albeu
parents:
4431
diff
changeset
|
74 #endif |
|
4ce20c55a18a
Added support for key combination and mouse buttons key code
albeu
parents:
4431
diff
changeset
|
75 |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
76 typedef union mp_cmd_arg_value { |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
77 int i; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
78 float f; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
79 char* s; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
80 } mp_cmd_arg_value_t; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
81 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
82 typedef struct mp_cmd_arg { |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
83 int type; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
84 mp_cmd_arg_value_t v; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
85 } mp_cmd_arg_t; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
86 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
87 typedef struct mp_cmd { |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
88 int id; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
89 char* name; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
90 int nargs; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
91 mp_cmd_arg_t args[MP_CMD_MAX_ARGS]; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
92 } mp_cmd_t; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
93 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
94 |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
95 typedef struct mp_cmd_bind { |
|
4589
4ce20c55a18a
Added support for key combination and mouse buttons key code
albeu
parents:
4431
diff
changeset
|
96 int input[MP_MAX_KEY_DOWN+1]; |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
97 char* cmd; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
98 } mp_cmd_bind_t; |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
99 |
|
4589
4ce20c55a18a
Added support for key combination and mouse buttons key code
albeu
parents:
4431
diff
changeset
|
100 typedef struct mp_key_name { |
|
4ce20c55a18a
Added support for key combination and mouse buttons key code
albeu
parents:
4431
diff
changeset
|
101 int key; |
|
4ce20c55a18a
Added support for key combination and mouse buttons key code
albeu
parents:
4431
diff
changeset
|
102 char* name; |
|
4ce20c55a18a
Added support for key combination and mouse buttons key code
albeu
parents:
4431
diff
changeset
|
103 } mp_key_name_t; |
|
4ce20c55a18a
Added support for key combination and mouse buttons key code
albeu
parents:
4431
diff
changeset
|
104 |
| 5197 | 105 // These typedefs are for the drivers. They are the functions used to retrive |
| 106 // the next key code or command. | |
| 107 | |
| 108 // These functions should return the key code or one of the error code | |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
109 typedef int (*mp_key_func_t)(int fd); |
| 5197 | 110 // These functions should act like read |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
111 typedef int (*mp_cmd_func_t)(int fd,char* dest,int size); |
| 5197 | 112 // These are used to close the driver |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
113 typedef void (*mp_close_func_t)(int fd); |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
114 |
| 5197 | 115 // This function add a new key driver. |
| 116 // The first arg is a file descriptor (use a negative value if you don't use any fd) | |
| 117 // The second arg tell if we use select on the fd to know if something is avaible. | |
| 118 // The third arg is optional. If null a default function wich read an int from the | |
| 119 // fd will be used. | |
| 120 // The last arg can be NULL if nothing is needed to close the driver. The close | |
| 121 // function can be used | |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
122 int |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
123 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
|
124 |
| 5197 | 125 // This remove a cmd driver, you usally don't need to use it |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
126 void |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
127 mp_input_rm_cmd_fd(int fd); |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
128 |
| 5197 | 129 // The args are the sames as for the keys drivers. If you don't use any valid fd you MUST |
| 130 // give a read_func. | |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
131 int |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
132 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
|
133 |
| 5197 | 134 // As for the cmd one you usally don't need this function |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
135 void |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
136 mp_input_rm_key_fd(int fd); |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
137 |
| 5197 | 138 // This function can be used to reput a command in the system. It's used by libmpdemux |
| 139 // when it perform a blocking operation to resend the command it received to the main | |
| 140 // loop. | |
| 4821 | 141 int |
| 142 mp_input_queue_cmd(mp_cmd_t* cmd); | |
| 143 | |
| 5197 | 144 // This function retrive the next avaible command waiting no more than time msec. |
| 145 // 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
|
146 mp_cmd_t* |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
147 mp_input_get_cmd(int time, int paused); |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
148 |
| 5197 | 149 // After getting a command from mp_input_get_cmd you need to free it using this |
| 150 // function | |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
151 void |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
152 mp_cmd_free(mp_cmd_t* cmd); |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
153 |
| 5197 | 154 // This create 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
|
155 mp_cmd_t* |
|
610a11e4db36
Added key autorepeat support. Options to enable/disable joystick and lirc
albeu
parents:
4589
diff
changeset
|
156 mp_cmd_clone(mp_cmd_t* cmd); |
|
610a11e4db36
Added key autorepeat support. Options to enable/disable joystick and lirc
albeu
parents:
4589
diff
changeset
|
157 |
| 5197 | 158 // When you create a new driver you should add it in this 2 functions. |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
159 void |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
160 mp_input_init(void); |
|
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
161 |
| 4431 | 162 void |
| 163 mp_input_uninit(void); | |
| 164 | |
|
4418
8141d2c399e4
A new configurable input system and joystick support for this system
albeu
parents:
diff
changeset
|
165 #endif /* HAVE_NEW_INPUT */ |
