2002-03-19 14:29:28 +01:00
|
|
|
// All commands id
|
2002-01-30 13:46:03 +01:00
|
|
|
#define MP_CMD_SEEK 0
|
|
|
|
#define MP_CMD_AUDIO_DELAY 1
|
|
|
|
#define MP_CMD_QUIT 2
|
|
|
|
#define MP_CMD_PAUSE 3
|
|
|
|
#define MP_CMD_GRAB_FRAMES 4
|
|
|
|
#define MP_CMD_PLAY_TREE_STEP 5
|
|
|
|
#define MP_CMD_PLAY_TREE_UP_STEP 6
|
|
|
|
#define MP_CMD_PLAY_ALT_SRC_STEP 7
|
|
|
|
#define MP_CMD_SUB_DELAY 8
|
|
|
|
#define MP_CMD_OSD 9
|
|
|
|
#define MP_CMD_VOLUME 10
|
|
|
|
#define MP_CMD_MIXER_USEMASTER 11
|
|
|
|
#define MP_CMD_CONTRAST 12
|
|
|
|
#define MP_CMD_BRIGHTNESS 13
|
|
|
|
#define MP_CMD_HUE 14
|
|
|
|
#define MP_CMD_SATURATION 15
|
|
|
|
#define MP_CMD_FRAMEDROPPING 16
|
|
|
|
#define MP_CMD_TV_STEP_CHANNEL 17
|
|
|
|
#define MP_CMD_TV_STEP_NORM 18
|
|
|
|
#define MP_CMD_TV_STEP_CHANNEL_LIST 19
|
2002-02-17 02:06:50 +01:00
|
|
|
#define MP_CMD_VO_FULLSCREEN 20
|
2002-03-10 04:47:53 +01:00
|
|
|
#define MP_CMD_SUB_POS 21
|
2002-03-28 21:40:21 +01:00
|
|
|
#define MP_CMD_DVDNAV 22
|
2002-05-18 02:11:43 +02:00
|
|
|
#define MP_CMD_SCREENSHOT 23
|
2002-06-04 22:17:07 +02:00
|
|
|
#define MP_CMD_PANSCAN 24
|
2002-06-06 09:13:57 +02:00
|
|
|
#define MP_CMD_MUTE 25
|
2002-07-26 23:26:39 +02:00
|
|
|
#define MP_CMD_LOADFILE 26
|
|
|
|
#define MP_CMD_LOADLIST 27
|
2002-08-04 04:22:27 +02:00
|
|
|
#define MP_CMD_VF_CHANGE_RECTANGLE 28
|
2002-09-27 23:08:36 +02:00
|
|
|
#define MP_CMD_GAMMA 29
|
2002-10-06 19:40:51 +02:00
|
|
|
#define MP_CMD_SUB_VISIBILITY 30
|
2002-10-17 17:41:20 +02:00
|
|
|
#define MP_CMD_VOBSUB_LANG 31
|
2002-11-15 00:41:44 +01:00
|
|
|
#define MP_CMD_MENU 32
|
|
|
|
#define MP_CMD_SET_MENU 33
|
2002-01-30 13:46:03 +01:00
|
|
|
|
2002-02-25 14:14:27 +01:00
|
|
|
#define MP_CMD_GUI_EVENTS 5000
|
|
|
|
#define MP_CMD_GUI_LOADFILE 5001
|
|
|
|
#define MP_CMD_GUI_LOADSUBTITLE 5002
|
|
|
|
#define MP_CMD_GUI_ABOUT 5003
|
|
|
|
#define MP_CMD_GUI_PLAY 5004
|
|
|
|
#define MP_CMD_GUI_STOP 5005
|
|
|
|
#define MP_CMD_GUI_PLAYLIST 5006
|
|
|
|
#define MP_CMD_GUI_PREFERENCES 5007
|
|
|
|
#define MP_CMD_GUI_FULLSCREEN 5008
|
|
|
|
#define MP_CMD_GUI_SKINBROWSER 5009
|
|
|
|
|
2002-04-03 19:58:17 +02:00
|
|
|
#define MP_CMD_DVDNAV_EVENT 6000
|
|
|
|
|
2002-03-28 21:40:21 +01:00
|
|
|
#define MP_CMD_DVDNAV_UP 1
|
|
|
|
#define MP_CMD_DVDNAV_DOWN 2
|
|
|
|
#define MP_CMD_DVDNAV_LEFT 3
|
|
|
|
#define MP_CMD_DVDNAV_RIGHT 4
|
|
|
|
#define MP_CMD_DVDNAV_MENU 5
|
|
|
|
#define MP_CMD_DVDNAV_SELECT 6
|
|
|
|
|
2002-11-15 00:41:44 +01:00
|
|
|
/// Console command
|
|
|
|
#define MP_CMD_CHELP 7000
|
|
|
|
#define MP_CMD_CEXIT 7001
|
|
|
|
#define MP_CMD_CHIDE 7002
|
2002-11-18 01:11:56 +01:00
|
|
|
#define MP_CMD_CRUN 7003
|
2002-11-15 00:41:44 +01:00
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// The args types
|
2002-01-30 13:46:03 +01:00
|
|
|
#define MP_CMD_ARG_INT 0
|
|
|
|
#define MP_CMD_ARG_FLOAT 1
|
|
|
|
#define MP_CMD_ARG_STRING 2
|
2002-04-03 19:58:17 +02:00
|
|
|
#define MP_CMD_ARG_VOID 3
|
2002-01-30 13:46:03 +01:00
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
#ifndef MP_CMD_MAX_ARGS
|
2002-01-30 13:46:03 +01:00
|
|
|
#define MP_CMD_MAX_ARGS 10
|
2002-03-19 14:29:28 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Error codes for the drivers
|
2002-01-30 13:46:03 +01:00
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// An error occured but we can continue
|
2002-01-30 13:46:03 +01:00
|
|
|
#define MP_INPUT_ERROR -1
|
2002-03-19 14:29:28 +01:00
|
|
|
// A fatal error occured, this driver should be removed
|
2002-01-30 13:46:03 +01:00
|
|
|
#define MP_INPUT_DEAD -2
|
2002-03-19 14:29:28 +01:00
|
|
|
// No input were avaible
|
2002-01-30 13:46:03 +01:00
|
|
|
#define MP_INPUT_NOTHING -3
|
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// For the keys drivers, if possible you can send key up and key down
|
|
|
|
// events. Key up is the default, to send a key down you must or the key
|
|
|
|
// code with MP_KEY_DOWN
|
2002-02-11 12:42:08 +01:00
|
|
|
#define MP_KEY_DOWN (1<<29)
|
2002-03-19 14:29:28 +01:00
|
|
|
// Use this when the key shouldn't be auto-repeated (like mouse buttons)
|
2002-02-11 12:42:08 +01:00
|
|
|
#define MP_NO_REPEAT_KEY (1<<28)
|
2002-02-08 19:10:56 +01:00
|
|
|
|
|
|
|
#ifndef MP_MAX_KEY_DOWN
|
|
|
|
#define MP_MAX_KEY_DOWN 32
|
|
|
|
#endif
|
|
|
|
|
2002-01-30 13:46:03 +01:00
|
|
|
typedef union mp_cmd_arg_value {
|
|
|
|
int i;
|
|
|
|
float f;
|
|
|
|
char* s;
|
2002-04-03 19:58:17 +02:00
|
|
|
void* v;
|
2002-01-30 13:46:03 +01:00
|
|
|
} mp_cmd_arg_value_t;
|
|
|
|
|
|
|
|
typedef struct mp_cmd_arg {
|
|
|
|
int type;
|
|
|
|
mp_cmd_arg_value_t v;
|
|
|
|
} mp_cmd_arg_t;
|
|
|
|
|
|
|
|
typedef struct mp_cmd {
|
|
|
|
int id;
|
|
|
|
char* name;
|
|
|
|
int nargs;
|
|
|
|
mp_cmd_arg_t args[MP_CMD_MAX_ARGS];
|
|
|
|
} mp_cmd_t;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct mp_cmd_bind {
|
2002-02-08 19:10:56 +01:00
|
|
|
int input[MP_MAX_KEY_DOWN+1];
|
2002-01-30 13:46:03 +01:00
|
|
|
char* cmd;
|
|
|
|
} mp_cmd_bind_t;
|
|
|
|
|
2002-02-08 19:10:56 +01:00
|
|
|
typedef struct mp_key_name {
|
|
|
|
int key;
|
|
|
|
char* name;
|
|
|
|
} mp_key_name_t;
|
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// These typedefs are for the drivers. They are the functions used to retrive
|
|
|
|
// the next key code or command.
|
|
|
|
|
|
|
|
// These functions should return the key code or one of the error code
|
2002-01-30 13:46:03 +01:00
|
|
|
typedef int (*mp_key_func_t)(int fd);
|
2002-10-25 18:06:25 +02:00
|
|
|
// These functions should act like read but they must use our error code (if needed ;-)
|
2002-01-30 13:46:03 +01:00
|
|
|
typedef int (*mp_cmd_func_t)(int fd,char* dest,int size);
|
2002-03-19 14:29:28 +01:00
|
|
|
// These are used to close the driver
|
2002-01-30 13:46:03 +01:00
|
|
|
typedef void (*mp_close_func_t)(int fd);
|
|
|
|
|
2002-11-15 00:41:44 +01:00
|
|
|
// Set this to grab all incoming key code
|
|
|
|
extern void (*mp_input_key_cb)(int code);
|
|
|
|
// Should return 1 if the command was processed
|
|
|
|
typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, void* ctx);
|
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// This function add a new key driver.
|
|
|
|
// The first arg is a file descriptor (use a negative value if you don't use any fd)
|
|
|
|
// The second arg tell if we use select on the fd to know if something is avaible.
|
|
|
|
// The third arg is optional. If null a default function wich read an int from the
|
|
|
|
// fd will be used.
|
|
|
|
// The last arg can be NULL if nothing is needed to close the driver. The close
|
|
|
|
// function can be used
|
2002-01-30 13:46:03 +01:00
|
|
|
int
|
|
|
|
mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func);
|
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// This remove a cmd driver, you usally don't need to use it
|
2002-01-30 13:46:03 +01:00
|
|
|
void
|
|
|
|
mp_input_rm_cmd_fd(int fd);
|
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// The args are the sames as for the keys drivers. If you don't use any valid fd you MUST
|
|
|
|
// give a read_func.
|
2002-01-30 13:46:03 +01:00
|
|
|
int
|
|
|
|
mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func);
|
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// As for the cmd one you usally don't need this function
|
2002-01-30 13:46:03 +01:00
|
|
|
void
|
|
|
|
mp_input_rm_key_fd(int fd);
|
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// This function can be used to reput a command in the system. It's used by libmpdemux
|
|
|
|
// when it perform a blocking operation to resend the command it received to the main
|
|
|
|
// loop.
|
2002-02-23 22:13:35 +01:00
|
|
|
int
|
|
|
|
mp_input_queue_cmd(mp_cmd_t* cmd);
|
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// This function retrive the next avaible command waiting no more than time msec.
|
|
|
|
// If pause is true, the next input will always return a pause command.
|
2002-01-30 13:46:03 +01:00
|
|
|
mp_cmd_t*
|
|
|
|
mp_input_get_cmd(int time, int paused);
|
|
|
|
|
2002-11-15 00:41:44 +01:00
|
|
|
mp_cmd_t*
|
|
|
|
mp_input_parse_cmd(char* str);
|
|
|
|
|
|
|
|
/// These filter allow you to process the command before mplayer
|
|
|
|
/// If a filter return a true value mp_input_get_cmd will return NULL
|
|
|
|
void
|
|
|
|
mp_input_add_cmd_filter(mp_input_cmd_filter, void* ctx);
|
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// After getting a command from mp_input_get_cmd you need to free it using this
|
|
|
|
// function
|
2002-01-30 13:46:03 +01:00
|
|
|
void
|
|
|
|
mp_cmd_free(mp_cmd_t* cmd);
|
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// This create a copy of a command (used by the auto repeat stuff)
|
2002-02-11 12:42:08 +01:00
|
|
|
mp_cmd_t*
|
|
|
|
mp_cmd_clone(mp_cmd_t* cmd);
|
|
|
|
|
2002-03-19 14:29:28 +01:00
|
|
|
// When you create a new driver you should add it in this 2 functions.
|
2002-01-30 13:46:03 +01:00
|
|
|
void
|
|
|
|
mp_input_init(void);
|
|
|
|
|
2002-01-31 10:37:12 +01:00
|
|
|
void
|
|
|
|
mp_input_uninit(void);
|
2002-10-23 16:46:20 +02:00
|
|
|
|
|
|
|
// Interruptible usleep: (used by libmpdemux)
|
|
|
|
int
|
|
|
|
mp_input_check_interrupt(int time);
|
|
|
|
|