diff options
Diffstat (limited to 'input/input.h')
-rw-r--r-- | input/input.h | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/input/input.h b/input/input.h index 005d02b47c..47f2560348 100644 --- a/input/input.h +++ b/input/input.h @@ -193,6 +193,8 @@ typedef enum { #define MP_MAX_KEY_DOWN 32 #endif +struct input_ctx; + typedef union mp_cmd_arg_value { int i; float f; @@ -214,21 +216,11 @@ typedef struct mp_cmd { } mp_cmd_t; -typedef struct mp_cmd_bind { - int input[MP_MAX_KEY_DOWN+1]; - char* cmd; -} mp_cmd_bind_t; - -typedef struct mp_key_name { - int key; - char* name; -} mp_key_name_t; - // These typedefs are for the drivers. They are the functions used to retrieve // the next key code or command. // These functions should return the key code or one of the error codes -typedef int (*mp_key_func_t)(int fd); +typedef int (*mp_key_func_t)(void *ctx, int fd); // These functions should act like read but they must use our error code (if needed ;-) typedef int (*mp_cmd_func_t)(int fd,char* dest,int size); // These are used to close the driver @@ -246,25 +238,20 @@ typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, void* ctx); // fd will be used. // The last arg can be NULL if nothing is needed to close the driver. The close // function can be used -int -mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func); +int mp_input_add_cmd_fd(struct input_ctx *ictx, int fd, int select, + mp_cmd_func_t read_func, mp_close_func_t close_func); // This removes a cmd driver, you usually don't need to use it. -void -mp_input_rm_cmd_fd(int fd); +void mp_input_rm_cmd_fd(struct input_ctx *ictx, int fd); // The args are the same as for the key's drivers. If you don't use any valid fd you MUST // give a read_func. -int -mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func); +int mp_input_add_key_fd(struct input_ctx *ictx, int fd, int select, + mp_key_func_t read_func, mp_close_func_t close_func, + void *ctx); // As for the cmd one you usually don't need this function. -void -mp_input_rm_key_fd(int fd); - -int mp_input_add_event_fd(int fd, void (*read_func)(void)); - -void mp_input_rm_event_fd(int fd); +void mp_input_rm_key_fd(struct input_ctx *ictx, int fd); /// Get input key from its name. int mp_input_get_key_from_name(const char *name); @@ -272,13 +259,12 @@ int mp_input_get_key_from_name(const char *name); // This function can be used to put a command in the system again. It's used by libmpdemux // when it performs a blocking operation to resend the command it received to the main // loop. -int -mp_input_queue_cmd(mp_cmd_t* cmd); +int mp_input_queue_cmd(struct input_ctx *ictx, mp_cmd_t* cmd); // This function retrieves the next available command waiting no more than time msec. // If pause is true, the next input will always return a pause command. mp_cmd_t* -mp_input_get_cmd(int time, int paused, int peek_only); +mp_input_get_cmd(struct input_ctx *ictx, int time, int paused, int peek_only); mp_cmd_t* mp_input_parse_cmd(char* str); @@ -287,7 +273,7 @@ mp_input_parse_cmd(char* str); * Parse and queue commands separated by '\n'. * @return count of commands new queued. */ -int mp_input_parse_and_queue_cmds(const char *str); +int mp_input_parse_and_queue_cmds(struct input_ctx *ictx, const char *str); /// These filters allow you to process the command before MPlayer. /// If a filter returns a true value mp_input_get_cmd will return NULL. @@ -304,23 +290,23 @@ mp_cmd_t* mp_cmd_clone(mp_cmd_t* cmd); // Set current input section -void -mp_input_set_section(char *name); +void mp_input_set_section(struct input_ctx *ictx, char *name); // Get current input section -char* -mp_input_get_section(void); +char *mp_input_get_section(struct input_ctx *ictx); // When you create a new driver you should add it in these 2 functions. -void -mp_input_init(int use_gui); +struct input_conf; +struct input_ctx *mp_input_init(struct input_conf *input_conf, int use_gui); -void -mp_input_uninit(void); +void mp_input_uninit(struct input_ctx *ictx); + +struct m_config; +void mp_input_register_options(struct m_config *cfg); // Interruptible usleep: (used by libmpdemux) int -mp_input_check_interrupt(int time); +mp_input_check_interrupt(struct input_ctx *ictx, int time); extern int async_quit_request; |