2003-09-14 17:52:59 +00:00
|
|
|
// All command IDs
|
2002-01-30 12:46:03 +00: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 01:06:50 +00:00
|
|
|
#define MP_CMD_VO_FULLSCREEN 20
|
2002-03-10 03:47:53 +00:00
|
|
|
#define MP_CMD_SUB_POS 21
|
2002-03-28 20:40:21 +00:00
|
|
|
#define MP_CMD_DVDNAV 22
|
2002-05-18 00:11:43 +00:00
|
|
|
#define MP_CMD_SCREENSHOT 23
|
2002-06-04 20:17:07 +00:00
|
|
|
#define MP_CMD_PANSCAN 24
|
2002-06-06 07:13:57 +00:00
|
|
|
#define MP_CMD_MUTE 25
|
2002-07-26 21:26:39 +00:00
|
|
|
#define MP_CMD_LOADFILE 26
|
|
|
|
#define MP_CMD_LOADLIST 27
|
2002-08-04 02:22:27 +00:00
|
|
|
#define MP_CMD_VF_CHANGE_RECTANGLE 28
|
2002-09-27 21:08:36 +00:00
|
|
|
#define MP_CMD_GAMMA 29
|
2002-10-06 17:40:51 +00:00
|
|
|
#define MP_CMD_SUB_VISIBILITY 30
|
2004-08-22 18:47:48 +00:00
|
|
|
// #define MP_CMD_VOBSUB_LANG 31 // combined with SUB_SELECT
|
2002-11-14 23:41:44 +00:00
|
|
|
#define MP_CMD_MENU 32
|
|
|
|
#define MP_CMD_SET_MENU 33
|
2002-12-05 00:11:12 +00:00
|
|
|
#define MP_CMD_GET_TIME_LENGTH 34
|
|
|
|
#define MP_CMD_GET_PERCENT_POS 35
|
2002-12-05 00:15:56 +00:00
|
|
|
#define MP_CMD_SUB_STEP 36
|
2002-12-28 22:57:39 +00:00
|
|
|
#define MP_CMD_TV_SET_CHANNEL 37
|
2002-12-23 00:33:22 +00:00
|
|
|
#define MP_CMD_EDL_MARK 38
|
2002-12-23 01:37:43 +00:00
|
|
|
#define MP_CMD_SUB_ALIGNMENT 39
|
2002-12-28 22:57:39 +00:00
|
|
|
#define MP_CMD_TV_LAST_CHANNEL 40
|
2003-05-17 09:21:21 +00:00
|
|
|
#define MP_CMD_OSD_SHOW_TEXT 41
|
2003-08-04 09:13:10 +00:00
|
|
|
#define MP_CMD_TV_SET_FREQ 42
|
|
|
|
#define MP_CMD_TV_SET_NORM 43
|
2003-08-12 07:38:49 +00:00
|
|
|
#define MP_CMD_TV_SET_BRIGHTNESS 44
|
|
|
|
#define MP_CMD_TV_SET_CONTRAST 45
|
|
|
|
#define MP_CMD_TV_SET_HUE 46
|
|
|
|
#define MP_CMD_TV_SET_SATURATION 47
|
2003-09-19 20:44:30 +00:00
|
|
|
#define MP_CMD_GET_VO_FULLSCREEN 48
|
|
|
|
#define MP_CMD_GET_SUB_VISIBILITY 49
|
2003-09-21 14:21:43 +00:00
|
|
|
#define MP_CMD_SUB_FORCED_ONLY 50
|
2003-11-30 16:36:10 +00:00
|
|
|
#define MP_CMD_VO_ONTOP 51
|
2004-07-17 12:47:12 +00:00
|
|
|
#define MP_CMD_SUB_SELECT 52
|
2004-08-22 19:01:56 +00:00
|
|
|
#define MP_CMD_VO_ROOTWIN 53
|
2004-09-02 12:02:06 +00:00
|
|
|
#define MP_CMD_SWITCH_VSYNC 54
|
2004-09-15 09:45:34 +00:00
|
|
|
#define MP_CMD_SWITCH_RATIO 55
|
2004-10-12 22:10:56 +00:00
|
|
|
#define MP_CMD_FRAME_STEP 56
|
2004-10-20 20:07:50 +00:00
|
|
|
#define MP_CMD_SPEED_INCR 57
|
|
|
|
#define MP_CMD_SPEED_MULT 58
|
|
|
|
#define MP_CMD_SPEED_SET 59
|
2004-12-02 14:37:16 +00:00
|
|
|
#define MP_CMD_RUN 60
|
2005-02-12 14:45:54 +00:00
|
|
|
#define MP_CMD_SUB_LOG 61
|
2005-04-03 14:08:28 +00:00
|
|
|
#define MP_CMD_SWITCH_AUDIO 62
|
2005-05-18 11:38:06 +00:00
|
|
|
#define MP_CMD_GET_TIME_POS 63
|
2005-06-09 20:13:53 +00:00
|
|
|
#define MP_CMD_SUB_LOAD 64
|
|
|
|
#define MP_CMD_SUB_REMOVE 65
|
2005-08-31 02:15:03 +00:00
|
|
|
#define MP_CMD_KEYDOWN_EVENTS 66
|
2005-11-10 22:25:54 +00:00
|
|
|
#define MP_CMD_VO_BORDER 67
|
2006-03-22 00:19:02 +00:00
|
|
|
#define MP_CMD_SET_PROPERTY 68
|
|
|
|
#define MP_CMD_GET_PROPERTY 69
|
2006-04-23 14:31:54 +00:00
|
|
|
#define MP_CMD_OSD_SHOW_PROPERTY_TEXT 70
|
2006-08-06 18:55:34 +00:00
|
|
|
#define MP_CMD_SEEK_CHAPTER 71
|
2006-08-22 20:55:49 +00:00
|
|
|
#define MP_CMD_FILE_FILTER 72
|
2006-08-26 09:44:20 +00:00
|
|
|
#define MP_CMD_GET_FILENAME 73
|
|
|
|
#define MP_CMD_GET_VIDEO_CODEC 74
|
|
|
|
#define MP_CMD_GET_VIDEO_BITRATE 75
|
|
|
|
#define MP_CMD_GET_VIDEO_RESOLUTION 76
|
|
|
|
#define MP_CMD_GET_AUDIO_CODEC 77
|
|
|
|
#define MP_CMD_GET_AUDIO_BITRATE 78
|
|
|
|
#define MP_CMD_GET_AUDIO_SAMPLES 79
|
|
|
|
#define MP_CMD_GET_META_TITLE 80
|
|
|
|
#define MP_CMD_GET_META_ARTIST 81
|
|
|
|
#define MP_CMD_GET_META_ALBUM 82
|
|
|
|
#define MP_CMD_GET_META_YEAR 83
|
|
|
|
#define MP_CMD_GET_META_COMMENT 84
|
|
|
|
#define MP_CMD_GET_META_TRACK 85
|
|
|
|
#define MP_CMD_GET_META_GENRE 86
|
2006-08-28 17:05:18 +00:00
|
|
|
#define MP_CMD_RADIO_STEP_CHANNEL 87
|
|
|
|
#define MP_CMD_RADIO_SET_CHANNEL 88
|
|
|
|
#define MP_CMD_RADIO_SET_FREQ 89
|
2006-09-16 15:13:41 +00:00
|
|
|
#define MP_CMD_SET_MOUSE_POS 90
|
2002-01-30 12:46:03 +00:00
|
|
|
|
2002-02-25 13:14:27 +00: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
|
|
|
|
|
2003-08-11 14:32:53 +00:00
|
|
|
#ifdef HAS_DVBIN_SUPPORT
|
|
|
|
#define MP_CMD_DVB_SET_CHANNEL 5101
|
|
|
|
#endif
|
|
|
|
|
2002-03-28 20:40:21 +00: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
|
2006-09-10 10:25:48 +00:00
|
|
|
#define MP_CMD_DVDNAV_PREVMENU 7
|
2006-09-19 23:50:21 +00:00
|
|
|
#define MP_CMD_DVDNAV_MOUSECLICK 8
|
2002-03-28 20:40:21 +00:00
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
/// Console commands
|
2002-11-14 23:41:44 +00:00
|
|
|
#define MP_CMD_CHELP 7000
|
|
|
|
#define MP_CMD_CEXIT 7001
|
|
|
|
#define MP_CMD_CHIDE 7002
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// The arg types
|
2002-01-30 12:46:03 +00:00
|
|
|
#define MP_CMD_ARG_INT 0
|
|
|
|
#define MP_CMD_ARG_FLOAT 1
|
|
|
|
#define MP_CMD_ARG_STRING 2
|
2002-04-03 17:58:17 +00:00
|
|
|
#define MP_CMD_ARG_VOID 3
|
2002-01-30 12:46:03 +00:00
|
|
|
|
2002-03-19 13:29:28 +00:00
|
|
|
#ifndef MP_CMD_MAX_ARGS
|
2002-01-30 12:46:03 +00:00
|
|
|
#define MP_CMD_MAX_ARGS 10
|
2002-03-19 13:29:28 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Error codes for the drivers
|
2002-01-30 12:46:03 +00:00
|
|
|
|
2003-12-24 22:00:51 +00:00
|
|
|
// An error occurred but we can continue
|
2002-01-30 12:46:03 +00:00
|
|
|
#define MP_INPUT_ERROR -1
|
2003-12-24 22:00:51 +00:00
|
|
|
// A fatal error occurred, this driver should be removed
|
2002-01-30 12:46:03 +00:00
|
|
|
#define MP_INPUT_DEAD -2
|
2003-09-14 17:52:59 +00:00
|
|
|
// No input was available
|
2002-01-30 12:46:03 +00:00
|
|
|
#define MP_INPUT_NOTHING -3
|
2005-06-27 08:16:23 +00:00
|
|
|
//! Input will be available if you try again
|
|
|
|
#define MP_INPUT_RETRY -4
|
2002-01-30 12:46:03 +00:00
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// For the key's drivers, if possible you can send key up and key down
|
2004-10-13 23:38:11 +00:00
|
|
|
// events. Key up is the default, to send a key down you must use the
|
|
|
|
// OR operator between the key code and MP_KEY_DOWN.
|
2002-02-11 11:42:08 +00:00
|
|
|
#define MP_KEY_DOWN (1<<29)
|
2002-03-19 13:29:28 +00:00
|
|
|
// Use this when the key shouldn't be auto-repeated (like mouse buttons)
|
2002-02-11 11:42:08 +00:00
|
|
|
#define MP_NO_REPEAT_KEY (1<<28)
|
2002-02-08 18:10:56 +00:00
|
|
|
|
|
|
|
#ifndef MP_MAX_KEY_DOWN
|
|
|
|
#define MP_MAX_KEY_DOWN 32
|
|
|
|
#endif
|
|
|
|
|
2002-01-30 12:46:03 +00:00
|
|
|
typedef union mp_cmd_arg_value {
|
|
|
|
int i;
|
|
|
|
float f;
|
|
|
|
char* s;
|
2002-04-03 17:58:17 +00:00
|
|
|
void* v;
|
2002-01-30 12:46:03 +00: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];
|
2004-11-20 10:51:13 +00:00
|
|
|
int pausing;
|
2002-01-30 12:46:03 +00:00
|
|
|
} mp_cmd_t;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct mp_cmd_bind {
|
2002-02-08 18:10:56 +00:00
|
|
|
int input[MP_MAX_KEY_DOWN+1];
|
2002-01-30 12:46:03 +00:00
|
|
|
char* cmd;
|
|
|
|
} mp_cmd_bind_t;
|
|
|
|
|
2002-02-08 18:10:56 +00:00
|
|
|
typedef struct mp_key_name {
|
|
|
|
int key;
|
|
|
|
char* name;
|
|
|
|
} mp_key_name_t;
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// These typedefs are for the drivers. They are the functions used to retrieve
|
2002-03-19 13:29:28 +00:00
|
|
|
// the next key code or command.
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// These functions should return the key code or one of the error codes
|
2002-01-30 12:46:03 +00:00
|
|
|
typedef int (*mp_key_func_t)(int fd);
|
2002-10-25 16:06:25 +00:00
|
|
|
// These functions should act like read but they must use our error code (if needed ;-)
|
2002-01-30 12:46:03 +00:00
|
|
|
typedef int (*mp_cmd_func_t)(int fd,char* dest,int size);
|
2002-03-19 13:29:28 +00:00
|
|
|
// These are used to close the driver
|
2002-01-30 12:46:03 +00:00
|
|
|
typedef void (*mp_close_func_t)(int fd);
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// Set this to grab all incoming key codes
|
2002-11-14 23:41:44 +00:00
|
|
|
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);
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// This function adds a new key driver.
|
2002-03-19 13:29:28 +00:00
|
|
|
// The first arg is a file descriptor (use a negative value if you don't use any fd)
|
2003-09-14 17:52:59 +00:00
|
|
|
// The second arg tells if we use select on the fd to know if something is available.
|
|
|
|
// The third arg is optional. If null a default function wich reads an int from the
|
2002-03-19 13:29:28 +00:00
|
|
|
// 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 12:46:03 +00:00
|
|
|
int
|
|
|
|
mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func);
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// This removes a cmd driver, you usually don't need to use it.
|
2002-01-30 12:46:03 +00:00
|
|
|
void
|
|
|
|
mp_input_rm_cmd_fd(int fd);
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// The args are the same as for the key's drivers. If you don't use any valid fd you MUST
|
2002-03-19 13:29:28 +00:00
|
|
|
// give a read_func.
|
2002-01-30 12:46:03 +00:00
|
|
|
int
|
|
|
|
mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func);
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// As for the cmd one you usually don't need this function.
|
2002-01-30 12:46:03 +00:00
|
|
|
void
|
|
|
|
mp_input_rm_key_fd(int fd);
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// 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
|
2002-03-19 13:29:28 +00:00
|
|
|
// loop.
|
2002-02-23 21:13:35 +00:00
|
|
|
int
|
|
|
|
mp_input_queue_cmd(mp_cmd_t* cmd);
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// This function retrieves the next available command waiting no more than time msec.
|
2002-03-19 13:29:28 +00:00
|
|
|
// If pause is true, the next input will always return a pause command.
|
2002-01-30 12:46:03 +00:00
|
|
|
mp_cmd_t*
|
2004-10-10 17:39:07 +00:00
|
|
|
mp_input_get_cmd(int time, int paused, int peek_only);
|
2002-01-30 12:46:03 +00:00
|
|
|
|
2002-11-14 23:41:44 +00:00
|
|
|
mp_cmd_t*
|
|
|
|
mp_input_parse_cmd(char* str);
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
/// These filters allow you to process the command before MPlayer.
|
|
|
|
/// If a filter returns a true value mp_input_get_cmd will return NULL.
|
2002-11-14 23:41:44 +00:00
|
|
|
void
|
|
|
|
mp_input_add_cmd_filter(mp_input_cmd_filter, void* ctx);
|
|
|
|
|
2002-03-19 13:29:28 +00:00
|
|
|
// After getting a command from mp_input_get_cmd you need to free it using this
|
|
|
|
// function
|
2002-01-30 12:46:03 +00:00
|
|
|
void
|
|
|
|
mp_cmd_free(mp_cmd_t* cmd);
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// This creates a copy of a command (used by the auto repeat stuff).
|
2002-02-11 11:42:08 +00:00
|
|
|
mp_cmd_t*
|
|
|
|
mp_cmd_clone(mp_cmd_t* cmd);
|
|
|
|
|
2003-09-14 17:52:59 +00:00
|
|
|
// When you create a new driver you should add it in these 2 functions.
|
2002-01-30 12:46:03 +00:00
|
|
|
void
|
2006-03-18 18:13:22 +00:00
|
|
|
mp_input_init(int use_gui);
|
2002-01-30 12:46:03 +00:00
|
|
|
|
2002-01-31 09:37:12 +00:00
|
|
|
void
|
|
|
|
mp_input_uninit(void);
|
2002-10-23 14:46:20 +00:00
|
|
|
|
|
|
|
// Interruptible usleep: (used by libmpdemux)
|
|
|
|
int
|
|
|
|
mp_input_check_interrupt(int time);
|
|
|
|
|