diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/defaultopts.c | 3 | ||||
-rw-r--r-- | core/input/input.c | 39 | ||||
-rw-r--r-- | core/input/input.h | 2 | ||||
-rw-r--r-- | core/input/keycodes.h | 17 | ||||
-rw-r--r-- | core/m_option.c | 7 | ||||
-rw-r--r-- | core/mplayer.c | 3 | ||||
-rw-r--r-- | core/options.h | 3 |
7 files changed, 71 insertions, 3 deletions
diff --git a/core/defaultopts.c b/core/defaultopts.c index 93dad1e624..a8a6b26930 100644 --- a/core/defaultopts.c +++ b/core/defaultopts.c @@ -108,6 +108,9 @@ void set_default_mplayer_options(struct MPOpts *opts) .use_joystick = 1, .use_lirc = 1, .use_lircc = 1, +#ifdef CONFIG_COCOA + .use_ar = 1, +#endif .default_bindings = 1, } }; diff --git a/core/input/input.c b/core/input/input.c index c9958753cd..4bfc22a08c 100644 --- a/core/input/input.c +++ b/core/input/input.c @@ -61,6 +61,10 @@ #include <lirc/lircc.h> #endif +#ifdef CONFIG_COCOA +#include "osdep/macosx_events.h" +#endif + #define MP_MAX_KEY_DOWN 4 struct cmd_bind { @@ -390,6 +394,21 @@ static const struct key_name key_names[] = { { MP_JOY_BTN8, "JOY_BTN8" }, { MP_JOY_BTN9, "JOY_BTN9" }, + { MP_AR_PLAY, "AR_PLAY" }, + { MP_AR_PLAY_HOLD, "AR_PLAY_HOLD" }, + { MP_AR_CENTER, "AR_CENTER" }, + { MP_AR_CENTER_HOLD, "AR_CENTER_HOLD" }, + { MP_AR_NEXT, "AR_NEXT" }, + { MP_AR_NEXT_HOLD, "AR_NEXT_HOLD" }, + { MP_AR_PREV, "AR_PREV" }, + { MP_AR_PREV_HOLD, "AR_PREV_HOLD" }, + { MP_AR_MENU, "AR_MENU" }, + { MP_AR_MENU_HOLD, "AR_MENU_HOLD" }, + { MP_AR_VUP, "AR_VUP" }, + { MP_AR_VUP_HOLD, "AR_VUP_HOLD" }, + { MP_AR_VDOWN, "AR_VDOWN" }, + { MP_AR_VDOWN_HOLD, "AR_VDOWN_HOLD" }, + { MP_KEY_POWER, "POWER" }, { MP_KEY_MENU, "MENU" }, { MP_KEY_PLAY, "PLAY" }, @@ -532,6 +551,9 @@ static const m_option_t mp_input_opts[] = { OPT_FLAG("joystick", input.use_joystick, CONF_GLOBAL), OPT_FLAG("lirc", input.use_lirc, CONF_GLOBAL), OPT_FLAG("lircc", input.use_lircc, CONF_GLOBAL), +#ifdef CONFIG_COCOA + OPT_FLAG("ar", input.use_ar, CONF_GLOBAL), +#endif { NULL, NULL, 0, 0, 0, 0, NULL} }; @@ -1474,6 +1496,9 @@ static void read_all_fd_events(struct input_ctx *ictx, int time) static void read_all_events(struct input_ctx *ictx, int time) { getch2_poll(); +#ifdef CONFIG_COCOA + cocoa_check_events(); +#endif read_all_fd_events(ictx, time); } @@ -1803,6 +1828,12 @@ struct input_ctx *mp_input_init(struct input_conf *input_conf, } #endif +#ifdef CONFIG_COCOA + if (input_conf->use_ar) { + cocoa_start_apple_remote(); + } +#endif + if (input_conf->in_file) { int mode = O_RDONLY; #ifndef __MINGW32__ @@ -1834,11 +1865,17 @@ static void clear_queue(struct cmd_queue *queue) } } -void mp_input_uninit(struct input_ctx *ictx) +void mp_input_uninit(struct input_ctx *ictx, struct input_conf *input_conf) { if (!ictx) return; +#ifdef CONFIG_COCOA + if (input_conf->use_ar) { + cocoa_stop_apple_remote(); + } +#endif + for (int i = 0; i < ictx->num_key_fd; i++) { if (ictx->key_fds[i].close_func) ictx->key_fds[i].close_func(ictx->key_fds[i].fd); diff --git a/core/input/input.h b/core/input/input.h index 6c33e47fdc..944debd847 100644 --- a/core/input/input.h +++ b/core/input/input.h @@ -216,7 +216,7 @@ struct input_conf; struct input_ctx *mp_input_init(struct input_conf *input_conf, bool load_default_conf); -void mp_input_uninit(struct input_ctx *ictx); +void mp_input_uninit(struct input_ctx *ictx, struct input_conf *input_conf); struct m_config; void mp_input_register_options(struct m_config *cfg); diff --git a/core/input/keycodes.h b/core/input/keycodes.h index 2e0e5fd33f..b9d2da23b7 100644 --- a/core/input/keycodes.h +++ b/core/input/keycodes.h @@ -172,6 +172,23 @@ #define MP_MOUSE_BTN19_DBL (MP_MOUSE_BASE_DBL+19) #define MP_MOUSE_BTN_DBL_END (MP_MOUSE_BASE_DBL+20) +// Apple Remote input module +#define MP_AR_BASE (MP_KEY_BASE+0xE0) +#define MP_AR_PLAY (MP_AR_BASE + 0) +#define MP_AR_PLAY_HOLD (MP_AR_BASE + 1) +#define MP_AR_CENTER (MP_AR_BASE + 2) +#define MP_AR_CENTER_HOLD (MP_AR_BASE + 3) +#define MP_AR_NEXT (MP_AR_BASE + 4) +#define MP_AR_NEXT_HOLD (MP_AR_BASE + 5) +#define MP_AR_PREV (MP_AR_BASE + 6) +#define MP_AR_PREV_HOLD (MP_AR_BASE + 7) +#define MP_AR_MENU (MP_AR_BASE + 8) +#define MP_AR_MENU_HOLD (MP_AR_BASE + 9) +#define MP_AR_VUP (MP_AR_BASE + 10) +#define MP_AR_VUP_HOLD (MP_AR_BASE + 11) +#define MP_AR_VDOWN (MP_AR_BASE + 12) +#define MP_AR_VDOWN_HOLD (MP_AR_BASE + 13) + /* Special keys */ #define MP_KEY_INTERN (MP_KEY_BASE+0x1000) #define MP_KEY_CLOSE_WIN (MP_KEY_INTERN+0) diff --git a/core/m_option.c b/core/m_option.c index 931b498213..406e4ede0b 100644 --- a/core/m_option.c +++ b/core/m_option.c @@ -762,6 +762,13 @@ static int parse_str(const m_option_t *opt, struct bstr name, goto exit; } + m_opt_string_validate_fn validate = opt->priv; + if (validate) { + r = validate(opt, name, param); + if (r < 0) + goto exit; + } + if (opt->flags & M_OPT_PARSE_ESCAPES) { char *res = unescape_string(tmp, param); if (!res) { diff --git a/core/mplayer.c b/core/mplayer.c index 4d71b5f55f..baae55b581 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -588,7 +588,7 @@ static MP_NORETURN void exit_player(struct MPContext *mpctx, timeEndPeriod(1); #endif - mp_input_uninit(mpctx->input); + mp_input_uninit(mpctx->input, &mpctx->opts.input); osd_free(mpctx->osd); @@ -3885,6 +3885,7 @@ static void init_input(struct MPContext *mpctx) #ifdef CONFIG_COCOA cocoa_set_input_context(mpctx->input); + cocoa_set_key_fifo(mpctx->key_fifo); #endif } diff --git a/core/options.h b/core/options.h index 31b4bc9136..0504ea0591 100644 --- a/core/options.h +++ b/core/options.h @@ -239,6 +239,9 @@ typedef struct MPOpts { int use_joystick; int use_lirc; int use_lircc; +#ifdef CONFIG_COCOA + int use_ar; +#endif int default_bindings; int test; } input; |