Mercurial > mplayer.hg
comparison input/input.h @ 5197:f0e3dcefb7af
Commentting session
author | albeu |
---|---|
date | Tue, 19 Mar 2002 13:29:28 +0000 |
parents | 9842148f6053 |
children | 8a01cde9cf39 |
comparison
equal
deleted
inserted
replaced
5196:aed5971d73a8 | 5197:f0e3dcefb7af |
---|---|
1 | 1 |
2 #ifdef HAVE_NEW_INPUT | 2 #ifdef HAVE_NEW_INPUT |
3 | 3 |
4 // All commands id | |
4 #define MP_CMD_SEEK 0 | 5 #define MP_CMD_SEEK 0 |
5 #define MP_CMD_AUDIO_DELAY 1 | 6 #define MP_CMD_AUDIO_DELAY 1 |
6 #define MP_CMD_QUIT 2 | 7 #define MP_CMD_QUIT 2 |
7 #define MP_CMD_PAUSE 3 | 8 #define MP_CMD_PAUSE 3 |
8 #define MP_CMD_GRAB_FRAMES 4 | 9 #define MP_CMD_GRAB_FRAMES 4 |
33 #define MP_CMD_GUI_PLAYLIST 5006 | 34 #define MP_CMD_GUI_PLAYLIST 5006 |
34 #define MP_CMD_GUI_PREFERENCES 5007 | 35 #define MP_CMD_GUI_PREFERENCES 5007 |
35 #define MP_CMD_GUI_FULLSCREEN 5008 | 36 #define MP_CMD_GUI_FULLSCREEN 5008 |
36 #define MP_CMD_GUI_SKINBROWSER 5009 | 37 #define MP_CMD_GUI_SKINBROWSER 5009 |
37 | 38 |
39 // The args types | |
38 #define MP_CMD_ARG_INT 0 | 40 #define MP_CMD_ARG_INT 0 |
39 #define MP_CMD_ARG_FLOAT 1 | 41 #define MP_CMD_ARG_FLOAT 1 |
40 #define MP_CMD_ARG_STRING 2 | 42 #define MP_CMD_ARG_STRING 2 |
41 | 43 |
44 #ifndef MP_CMD_MAX_ARGS | |
42 #define MP_CMD_MAX_ARGS 10 | 45 #define MP_CMD_MAX_ARGS 10 |
46 #endif | |
43 | 47 |
48 // Error codes for the drivers | |
49 | |
50 // An error occured but we can continue | |
44 #define MP_INPUT_ERROR -1 | 51 #define MP_INPUT_ERROR -1 |
52 // A fatal error occured, this driver should be removed | |
45 #define MP_INPUT_DEAD -2 | 53 #define MP_INPUT_DEAD -2 |
54 // No input were avaible | |
46 #define MP_INPUT_NOTHING -3 | 55 #define MP_INPUT_NOTHING -3 |
47 | 56 |
57 // For the keys drivers, if possible you can send key up and key down | |
58 // events. Key up is the default, to send a key down you must or the key | |
59 // code with MP_KEY_DOWN | |
48 #define MP_KEY_DOWN (1<<29) | 60 #define MP_KEY_DOWN (1<<29) |
49 // Key up is the default | 61 // Use this when the key shouldn't be auto-repeated (like mouse buttons) |
50 #define MP_NO_REPEAT_KEY (1<<28) | 62 #define MP_NO_REPEAT_KEY (1<<28) |
51 | 63 |
52 #ifndef MP_MAX_KEY_DOWN | 64 #ifndef MP_MAX_KEY_DOWN |
53 #define MP_MAX_KEY_DOWN 32 | 65 #define MP_MAX_KEY_DOWN 32 |
54 #endif | 66 #endif |
80 typedef struct mp_key_name { | 92 typedef struct mp_key_name { |
81 int key; | 93 int key; |
82 char* name; | 94 char* name; |
83 } mp_key_name_t; | 95 } mp_key_name_t; |
84 | 96 |
97 // These typedefs are for the drivers. They are the functions used to retrive | |
98 // the next key code or command. | |
99 | |
100 // These functions should return the key code or one of the error code | |
85 typedef int (*mp_key_func_t)(int fd); | 101 typedef int (*mp_key_func_t)(int fd); |
102 // These functions should act like read | |
86 typedef int (*mp_cmd_func_t)(int fd,char* dest,int size); | 103 typedef int (*mp_cmd_func_t)(int fd,char* dest,int size); |
104 // These are used to close the driver | |
87 typedef void (*mp_close_func_t)(int fd); | 105 typedef void (*mp_close_func_t)(int fd); |
88 | 106 |
107 // This function add a new key driver. | |
108 // The first arg is a file descriptor (use a negative value if you don't use any fd) | |
109 // The second arg tell if we use select on the fd to know if something is avaible. | |
110 // The third arg is optional. If null a default function wich read an int from the | |
111 // fd will be used. | |
112 // The last arg can be NULL if nothing is needed to close the driver. The close | |
113 // function can be used | |
89 int | 114 int |
90 mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func); | 115 mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func); |
91 | 116 |
117 // This remove a cmd driver, you usally don't need to use it | |
92 void | 118 void |
93 mp_input_rm_cmd_fd(int fd); | 119 mp_input_rm_cmd_fd(int fd); |
94 | 120 |
121 // The args are the sames as for the keys drivers. If you don't use any valid fd you MUST | |
122 // give a read_func. | |
95 int | 123 int |
96 mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func); | 124 mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func); |
97 | 125 |
126 // As for the cmd one you usally don't need this function | |
98 void | 127 void |
99 mp_input_rm_key_fd(int fd); | 128 mp_input_rm_key_fd(int fd); |
100 | 129 |
130 // This function can be used to reput a command in the system. It's used by libmpdemux | |
131 // when it perform a blocking operation to resend the command it received to the main | |
132 // loop. | |
101 int | 133 int |
102 mp_input_queue_cmd(mp_cmd_t* cmd); | 134 mp_input_queue_cmd(mp_cmd_t* cmd); |
103 | 135 |
136 // This function retrive the next avaible command waiting no more than time msec. | |
137 // If pause is true, the next input will always return a pause command. | |
104 mp_cmd_t* | 138 mp_cmd_t* |
105 mp_input_get_cmd(int time, int paused); | 139 mp_input_get_cmd(int time, int paused); |
106 | 140 |
141 // After getting a command from mp_input_get_cmd you need to free it using this | |
142 // function | |
107 void | 143 void |
108 mp_cmd_free(mp_cmd_t* cmd); | 144 mp_cmd_free(mp_cmd_t* cmd); |
109 | 145 |
146 // This create a copy of a command (used by the auto repeat stuff) | |
110 mp_cmd_t* | 147 mp_cmd_t* |
111 mp_cmd_clone(mp_cmd_t* cmd); | 148 mp_cmd_clone(mp_cmd_t* cmd); |
112 | 149 |
150 // When you create a new driver you should add it in this 2 functions. | |
113 void | 151 void |
114 mp_input_init(void); | 152 mp_input_init(void); |
115 | 153 |
116 void | 154 void |
117 mp_input_uninit(void); | 155 mp_input_uninit(void); |