summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
Diffstat (limited to 'input')
-rw-r--r--input/appleir.c18
-rw-r--r--input/input.c136
-rw-r--r--input/input.h16
-rw-r--r--input/joystick.c32
-rw-r--r--input/lirc.c10
-rw-r--r--input/lirc.h2
6 files changed, 85 insertions, 129 deletions
diff --git a/input/appleir.c b/input/appleir.c
index 756c66047d..5e4bc148c6 100644
--- a/input/appleir.c
+++ b/input/appleir.c
@@ -68,7 +68,7 @@ static const struct {
{ APPLE_IR_BACKWARD, 2, AR_PREV_HOLD },
{ APPLE_IR_MENU, 1, AR_MENU },
{ APPLE_IR_MENU, 2, AR_MENU_HOLD },
- { APPLE_IR_PLUS, 1, AR_VUP },
+ { APPLE_IR_PLUS, 1, AR_VUP },
{ APPLE_IR_MINUS, 1, AR_VDOWN },
{ -1, -1, -1 }
};
@@ -79,12 +79,12 @@ int mp_input_appleir_init (char *dev)
if (dev)
{
- mp_msg (MSGT_INPUT, MSGL_V, MSGTR_INPUT_APPLE_IR_Init, dev);
+ mp_tmsg (MSGT_INPUT, MSGL_V, "Initializing Apple IR on %s\n", dev);
fd = open (dev, O_RDONLY | O_NONBLOCK);
if (fd < 0)
{
- mp_msg (MSGT_INPUT, MSGL_ERR,
- MSGTR_INPUT_APPLE_IR_CantOpen, strerror (errno));
+ mp_tmsg (MSGT_INPUT, MSGL_ERR,
+ "Can't open Apple IR device: %s\n", strerror (errno));
return -1;
}
@@ -102,20 +102,20 @@ int mp_input_appleir_init (char *dev)
fd = open (file, O_RDONLY | O_NONBLOCK);
if (fd < 0)
continue;
-
+
ioctl (fd, EVIOCGID, &id);
if (id.bustype == BUS_USB &&
id.vendor == USB_VENDOR_APPLE &&
(id.product == USB_DEV_APPLE_IR ||id.product == USB_DEV_APPLE_IR_2))
{
- mp_msg (MSGT_INPUT, MSGL_V, MSGTR_INPUT_APPLE_IR_Detect, file);
+ mp_tmsg (MSGT_INPUT, MSGL_V, "Detected Apple IR on %s\n", file);
return fd;
}
close (fd);
}
- mp_msg (MSGT_INPUT, MSGL_ERR,
- MSGTR_INPUT_APPLE_IR_CantOpen, strerror (errno));
+ mp_tmsg (MSGT_INPUT, MSGL_ERR,
+ "Can't open Apple IR device: %s\n", strerror (errno));
}
return -1;
@@ -147,6 +147,6 @@ int mp_input_appleir_read(void *ctx, int fd)
if (apple_ir_mapping[i].linux_keycode == ev.code &&
apple_ir_mapping[i].value == ev.value)
return apple_ir_mapping[i].mp_keycode;
-
+
return MP_INPUT_NOTHING;
}
diff --git a/input/input.c b/input/input.c
index 9296a714e5..b45f94605b 100644
--- a/input/input.c
+++ b/input/input.c
@@ -189,17 +189,6 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_TV_TELETEXT_GO_LINK, "teletext_go_link", 1, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
#endif
-#ifdef CONFIG_GUI
- { MP_CMD_GUI_LOADFILE, "gui_loadfile", 0, { {-1,{0}} } },
- { MP_CMD_GUI_LOADSUBTITLE, "gui_loadsubtitle", 0, { {-1,{0}} } },
- { MP_CMD_GUI_ABOUT, "gui_about", 0, { {-1,{0}} } },
- { MP_CMD_GUI_PLAY, "gui_play", 0, { {-1,{0}} } },
- { MP_CMD_GUI_STOP, "gui_stop", 0, { {-1,{0}} } },
- { MP_CMD_GUI_PLAYLIST, "gui_playlist", 0, { {-1,{0}} } },
- { MP_CMD_GUI_PREFERENCES, "gui_preferences", 0, { {-1,{0}} } },
- { MP_CMD_GUI_SKINBROWSER, "gui_skinbrowser", 0, { {-1,{0}} } },
-#endif
-
#ifdef CONFIG_DVDNAV
{ MP_CMD_DVDNAV, "dvdnav", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
#endif
@@ -211,17 +200,17 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_CEXIT, "exit", 0, { {-1,{0}} } },
{ MP_CMD_CHIDE, "hide", 0, { {MP_CMD_ARG_INT,{3000}}, {-1,{0}} } },
#endif
-
+
{ MP_CMD_GET_VO_FULLSCREEN, "get_vo_fullscreen", 0, { {-1,{0}} } },
{ MP_CMD_GET_SUB_VISIBILITY, "get_sub_visibility", 0, { {-1,{0}} } },
{ MP_CMD_KEYDOWN_EVENTS, "key_down_event", 1, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
{ MP_CMD_SET_PROPERTY, "set_property", 2, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
{ MP_CMD_GET_PROPERTY, "get_property", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
{ MP_CMD_STEP_PROPERTY, "step_property", 1, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
-
+
{ MP_CMD_SEEK_CHAPTER, "seek_chapter", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
{ MP_CMD_SET_MOUSE_POS, "set_mouse_pos", 2, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
-
+
{ 0, NULL, 0, {} }
};
@@ -375,7 +364,7 @@ static const mp_cmd_bind_t def_cmd_binds[] = {
{ { MOUSE_BTN4, 0 }, "seek -10" },
{ { MOUSE_BTN5, 0 }, "volume 1" },
{ { MOUSE_BTN6, 0 }, "volume -1" },
-
+
#ifdef CONFIG_DVDNAV
{ { KEY_KP8, 0 }, "dvdnav up" }, // up
{ { KEY_KP2, 0 }, "dvdnav down" }, // down
@@ -498,9 +487,9 @@ static const mp_cmd_bind_t def_cmd_binds[] = {
{ { KEY_VOLUME_UP, 0 }, "volume 1" },
{ { KEY_VOLUME_DOWN, 0 }, "volume -1" },
{ { KEY_MUTE, 0 }, "mute" },
-
+
{ { KEY_CLOSE_WIN, 0 }, "quit" },
-
+
{ { '!', 0 }, "seek_chapter -1" },
{ { '@', 0 }, "seek_chapter 1" },
{ { 'A', 0 }, "switch_angle 1" },
@@ -510,21 +499,6 @@ static const mp_cmd_bind_t def_cmd_binds[] = {
};
-#ifdef CONFIG_GUI
-static const mp_cmd_bind_t gui_def_cmd_binds[] = {
-
- { { 'l', 0 }, "gui_loadfile" },
- { { 't', 0 }, "gui_loadsubtitle" },
- { { KEY_ENTER, 0 }, "gui_play" },
- { { KEY_ESC, 0 }, "gui_stop" },
- { { 'p', 0 }, "gui_playlist" },
- { { 'r', 0 }, "gui_preferences" },
- { { 'c', 0 }, "gui_skinbrowser" },
-
- { { 0 }, NULL }
-};
-#endif
-
#ifndef MP_MAX_KEY_FD
#define MP_MAX_KEY_FD 10
#endif
@@ -650,7 +624,7 @@ 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)
{
if (ictx->num_cmd_fd == MP_MAX_CMD_FD) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantRegister2ManyCmdFds,fd);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Too many command file descriptors, cannot register file descriptor %d.\n",fd);
return 0;
}
if (select && fd < 0) {
@@ -716,7 +690,7 @@ int mp_input_add_key_fd(struct input_ctx *ictx, int fd, int select,
void *ctx)
{
if (ictx->num_key_fd == MP_MAX_KEY_FD) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantRegister2ManyKeyFds,fd);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Too many key file descriptors, cannot register file descriptor %d.\n",fd);
return 0;
}
if (select && fd < 0) {
@@ -829,7 +803,7 @@ mp_input_parse_cmd(char* str) {
errno = 0;
cmd->args[i].v.i = atoi(ptr);
if(errno != 0) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrArgMustBeInt,cmd_def->name,i+1);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Command %s: argument %d isn't an integer.\n",cmd_def->name,i+1);
ptr = NULL;
}
break;
@@ -837,7 +811,7 @@ mp_input_parse_cmd(char* str) {
errno = 0;
cmd->args[i].v.f = atof(ptr);
if(errno != 0) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrArgMustBeFloat,cmd_def->name,i+1);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Command %s: argument %d isn't a float.\n",cmd_def->name,i+1);
ptr = NULL;
}
break;
@@ -857,9 +831,9 @@ mp_input_parse_cmd(char* str) {
if(e <= ptr2 || *(e - 1) != '\\') break;
ptr2 = e + 1;
}
-
+
if(term != ' ' && (!e || e[0] == '\0')) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrUnterminatedArg,cmd_def->name,i+1);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Command %s: argument %d is unterminated.\n",cmd_def->name,i+1);
ptr = NULL;
break;
} else if(!e) e = ptr+strlen(ptr);
@@ -877,14 +851,14 @@ mp_input_parse_cmd(char* str) {
ptr = NULL;
break;
default :
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrUnknownArg,i);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Unknown argument %d\n",i);
}
}
cmd->nargs = i;
if(cmd_def->nargs > cmd->nargs) {
/* mp_msg(MSGT_INPUT,MSGL_ERR,"Got command '%s' but\n",str); */
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_Err2FewArgs,cmd_def->name,cmd_def->nargs,cmd->nargs);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Command %s requires at least %d arguments, we found only %d so far.\n",cmd_def->name,cmd_def->nargs,cmd->nargs);
mp_cmd_free(cmd);
return NULL;
}
@@ -901,7 +875,7 @@ mp_input_parse_cmd(char* str) {
return cmd;
}
-#define MP_CMD_MAX_SIZE 256
+#define MP_CMD_MAX_SIZE 4096
static int read_cmd(mp_input_fd_t* mp_fd, char** ret)
{
@@ -913,8 +887,8 @@ static int read_cmd(mp_input_fd_t* mp_fd, char** ret)
mp_fd->buffer = talloc_size(NULL, MP_CMD_MAX_SIZE);
mp_fd->pos = 0;
mp_fd->size = MP_CMD_MAX_SIZE;
- }
-
+ }
+
// Get some data if needed/possible
while (!mp_fd->got_cmd && !mp_fd->eof && (mp_fd->size - mp_fd->pos > 1) ) {
int r = mp_fd->read_func.cmd(mp_fd->fd, mp_fd->buffer+mp_fd->pos,
@@ -924,7 +898,7 @@ static int read_cmd(mp_input_fd_t* mp_fd, char** ret)
switch(r) {
case MP_INPUT_ERROR:
case MP_INPUT_DEAD:
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrReadingCmdFd,mp_fd->fd,strerror(errno));
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Error while reading command file descriptor %d: %s\n",mp_fd->fd,strerror(errno));
case MP_INPUT_NOTHING:
return r;
case MP_INPUT_RETRY:
@@ -950,7 +924,7 @@ static int read_cmd(mp_input_fd_t* mp_fd, char** ret)
if(!end) {
// If buffer is full we must drop all until the next \n
if(mp_fd->size - mp_fd->pos <= 1) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCmdBufferFullDroppingContent,mp_fd->fd);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Command buffer of file descriptor %d is full: dropping content.\n",mp_fd->fd);
mp_fd->pos = 0;
mp_fd->drop = 1;
}
@@ -972,7 +946,7 @@ static int read_cmd(mp_input_fd_t* mp_fd, char** ret)
mp_fd->pos -= l+1;
memmove(mp_fd->buffer, end+1, mp_fd->pos);
}
-
+
if(*ret)
return 1;
else
@@ -1007,7 +981,7 @@ mp_input_add_cmd_filter(mp_input_cmd_filter func, void* ctx) {
filter->next = cmd_filters;
cmd_filters = filter;
}
-
+
static char *find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys)
{
@@ -1067,7 +1041,7 @@ static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, int n, int *keys,
cmd = find_bind_for_key(def_cmd_binds,n,keys);
if(cmd == NULL) {
- mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_NoBindFound, get_key_name(keys[0],
+ mp_tmsg(MSGT_INPUT,MSGL_WARN,"No bind found for key '%s'.", get_key_name(keys[0],
key_buf));
if(n > 1) {
int s;
@@ -1080,7 +1054,7 @@ static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, int n, int *keys,
if (strcmp(cmd, "ignore") == 0) return NULL;
ret = mp_input_parse_cmd(cmd);
if(!ret) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrInvalidCommandForKey,
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Invalid command for bound key %s",
get_key_name(ictx->key_down[0], key_buf));
if (ictx->num_key_down > 1) {
unsigned int s;
@@ -1109,7 +1083,7 @@ static mp_cmd_t* interpret_key(struct input_ctx *ictx, int code, int paused)
if(code & MP_KEY_DOWN) {
if (ictx->num_key_down > MP_MAX_KEY_DOWN) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_Err2ManyKeyDowns);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Too many key down events at the same time\n");
return NULL;
}
code &= ~MP_KEY_DOWN;
@@ -1135,13 +1109,13 @@ static mp_cmd_t* interpret_key(struct input_ctx *ictx, int code, int paused)
}
if (j == ictx->num_key_down) { // key was not in the down keys : add it
if (ictx->num_key_down > MP_MAX_KEY_DOWN) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_Err2ManyKeyDowns);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Too many key down events at the same time\n");
return NULL;
}
ictx->key_down[ictx->num_key_down] = code;
ictx->num_key_down++;
ictx->last_key_down = 1;
- }
+ }
// We ignore key from last combination
ret = ictx->last_key_down ?
get_cmd_from_keys(ictx, ictx->num_key_down, ictx->key_down, paused)
@@ -1239,7 +1213,7 @@ static mp_cmd_t *read_events(struct input_ctx *ictx, int time, int paused)
time_val = NULL;
if (select(max_fd + 1, &fds, NULL, NULL, time_val) < 0) {
if (errno != EINTR)
- mp_msg(MSGT_INPUT, MSGL_ERR, MSGTR_INPUT_INPUT_ErrSelect,
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Select error: %s\n",
strerror(errno));
FD_ZERO(&fds);
}
@@ -1264,10 +1238,10 @@ static mp_cmd_t *read_events(struct input_ctx *ictx, int time, int paused)
return ret;
}
else if (code == MP_INPUT_ERROR)
- mp_msg(MSGT_INPUT, MSGL_ERR, MSGTR_INPUT_INPUT_ErrOnKeyInFd,
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Error on key input file descriptor %d\n",
key_fds[i].fd);
else if (code == MP_INPUT_DEAD) {
- mp_msg(MSGT_INPUT, MSGL_ERR, MSGTR_INPUT_INPUT_ErrDeadKeyOnFd,
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Dead key input on file descriptor %d\n",
key_fds[i].fd);
key_fds[i].dead = 1;
}
@@ -1291,7 +1265,7 @@ static mp_cmd_t *read_events(struct input_ctx *ictx, int time, int paused)
return ret;
}
else if (r == MP_INPUT_ERROR)
- mp_msg(MSGT_INPUT, MSGL_ERR, MSGTR_INPUT_INPUT_ErrOnCmdFd,
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Error on command file descriptor %d\n",
cmd_fds[i].fd);
else if (r == MP_INPUT_DEAD)
cmd_fds[i].dead = 1;
@@ -1319,14 +1293,14 @@ static mp_cmd_t *get_queued_cmd(struct input_ctx *ictx, int peek_only)
return NULL;
ret = ictx->cmd_queue[ictx->cmd_queue_start];
-
- if (!peek_only) {
+
+ if (!peek_only) {
ictx->cmd_queue_length--;
ictx->cmd_queue_start = (ictx->cmd_queue_start + 1) % CMD_QUEUE_SIZE;
}
-
+
return ret;
-}
+}
/**
* \param peek_only when set, the returned command stays in the queue.
@@ -1402,7 +1376,7 @@ static char *get_key_name(int key, char buffer[12])
if(key_names[i].key == key)
return key_names[i].name;
}
-
+
if(isascii(key)) {
snprintf(buffer, 12, "%c",(char)key);
return buffer;
@@ -1493,7 +1467,7 @@ static void bind_keys(struct input_ctx *ictx,
}
}
}
-
+
if(!bind) {
bind_section->cmd_binds = talloc_realloc(bind_section,
bind_section->cmd_binds,
@@ -1538,7 +1512,7 @@ static int parse_config(struct input_ctx *ictx, char *file)
if(r < 0) {
if(errno == EINTR)
continue;
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrReadingInputConfig,file,strerror(errno));
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Error while reading input config file %s: %s\n",file,strerror(errno));
close(fd);
return 0;
} else if(r == 0) {
@@ -1591,9 +1565,9 @@ static int parse_config(struct input_ctx *ictx, char *file)
if(end[0] == '\0') { // Key name doesn't fit in the buffer
if(buffer == iter) {
if(eof && (buffer-iter) == bs)
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrUnfinishedBinding,iter);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Unfinished binding %s\n",iter);
else
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrBuffer2SmallForKeyName,iter);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Buffer is too small for this key name: %s\n",iter);
return 0;
}
memmove(buffer,iter,end-iter);
@@ -1605,7 +1579,7 @@ static int parse_config(struct input_ctx *ictx, char *file)
strncpy(name,iter,end-iter);
name[end-iter] = '\0';
if (!get_input_from_name(name,keys)) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrUnknownKey,name);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Unknown key '%s'\n",name);
close(fd);
return 0;
}
@@ -1620,10 +1594,10 @@ static int parse_config(struct input_ctx *ictx, char *file)
if(iter[0] == '\n' || iter[0] == '\r') {
int i;
char key_buf[12];
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrNoCmdForKey, get_key_name(keys[0], key_buf));
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"No command found for key %s", get_key_name(keys[0], key_buf));
for(i = 1; keys[i] != 0 ; i++)
mp_msg(MSGT_INPUT,MSGL_ERR,"-%s", get_key_name(keys[i], key_buf));
- mp_msg(MSGT_INPUT,MSGL_ERR,"\n");
+ mp_msg(MSGT_INPUT,MSGL_ERR,"\n");
keys[0] = 0;
if(iter > buffer) {
memmove(buffer,iter,bs- (iter-buffer));
@@ -1635,7 +1609,7 @@ static int parse_config(struct input_ctx *ictx, char *file)
/* NOTHING */;
if(end[0] == '\0' && ! (eof && ((end+1) - buffer) == bs)) {
if(iter == buffer) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrBuffer2SmallForCmd,buffer);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Buffer is too small for command %s\n",buffer);
close(fd);
return 0;
}
@@ -1660,7 +1634,7 @@ static int parse_config(struct input_ctx *ictx, char *file)
continue;
}
}
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrWhyHere);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"What are we doing here?\n");
close(fd);
mp_input_set_section(ictx, NULL);
return 0;
@@ -1691,7 +1665,7 @@ char *mp_input_get_section(struct input_ctx *ictx)
return ictx->section;
}
-struct input_ctx *mp_input_init(struct input_conf *input_conf, int use_gui)
+struct input_ctx *mp_input_init(struct input_conf *input_conf)
{
struct input_ctx *ictx = talloc_ptrtype(NULL, ictx);
*ictx = (struct input_ctx){
@@ -1702,17 +1676,11 @@ struct input_ctx *mp_input_init(struct input_conf *input_conf, int use_gui)
};
char* file;
-
-#ifdef CONFIG_GUI
- if(use_gui)
- add_binds(ictx, gui_def_cmd_binds);
-#endif
-
char *config_file = input_conf->config_file;
file = config_file[0] != '/' ? get_path(config_file) : config_file;
if(!file)
return ictx;
-
+
if (!parse_config(ictx, file)) {
// free file if it was allocated by get_path(),
// before it gets overwritten
@@ -1736,7 +1704,7 @@ struct input_ctx *mp_input_init(struct input_conf *input_conf, int use_gui)
if (input_conf->use_joystick) {
int fd = mp_input_joystick_init(input_conf->js_dev);
if(fd < 0)
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantInitJoystick);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Can't init input joystick\n");
else
mp_input_add_key_fd(ictx, fd, 1, mp_input_joystick_read,
(mp_close_func_t)close,NULL);
@@ -1763,7 +1731,7 @@ struct input_ctx *mp_input_init(struct input_conf *input_conf, int use_gui)
#ifdef CONFIG_APPLE_REMOTE
if (input_conf->use_ar) {
if(mp_input_ar_init() < 0)
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantInitAppleRemote);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Can't init Apple Remote.\n");
else
mp_input_add_key_fd(ictx, -1, 0, mp_input_ar_read, mp_input_ar_close,
NULL);
@@ -1774,17 +1742,17 @@ struct input_ctx *mp_input_init(struct input_conf *input_conf, int use_gui)
if (input_conf->use_ar) {
int fd = mp_input_appleir_init(input_conf->ar_dev);
if(fd < 0)
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantInitAppleRemote);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Can't init Apple Remote.\n");
else
mp_input_add_key_fd(ictx, fd, 1, mp_input_appleir_read,
(mp_close_func_t)close, NULL);
}
#endif
-
+
if (input_conf->in_file) {
struct stat st;
if (stat(input_conf->in_file, &st))
- mp_msg(MSGT_INPUT, MSGL_ERR, MSGTR_INPUT_INPUT_ErrCantStatFile, input_conf->in_file, strerror(errno));
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Can't stat %s: %s\n", input_conf->in_file, strerror(errno));
else {
int in_file_fd = open(input_conf->in_file,
S_ISFIFO(st.st_mode) ? O_RDWR : O_RDONLY);
@@ -1792,7 +1760,7 @@ struct input_ctx *mp_input_init(struct input_conf *input_conf, int use_gui)
mp_input_add_cmd_fd(ictx, in_file_fd, 1, NULL,
(mp_close_func_t)close);
else
- mp_msg(MSGT_INPUT, MSGL_ERR, MSGTR_INPUT_INPUT_ErrCantOpenFile,
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Can't open %s: %s\n",
input_conf->in_file, strerror(errno));
}
}
diff --git a/input/input.h b/input/input.h
index 47f2560348..3a73d4d568 100644
--- a/input/input.h
+++ b/input/input.h
@@ -139,18 +139,6 @@ typedef enum {
MP_CMD_DVDNAV_SELECT,
MP_CMD_DVDNAV_PREVMENU,
MP_CMD_DVDNAV_MOUSECLICK,
-
- /// GUI commands
- MP_CMD_GUI_EVENTS = 5000,
- MP_CMD_GUI_LOADFILE,
- MP_CMD_GUI_LOADSUBTITLE,
- MP_CMD_GUI_ABOUT,
- MP_CMD_GUI_PLAY,
- MP_CMD_GUI_STOP,
- MP_CMD_GUI_PLAYLIST,
- MP_CMD_GUI_PREFERENCES,
- MP_CMD_GUI_FULLSCREEN,
- MP_CMD_GUI_SKINBROWSER,
/// DVB commands
MP_CMD_DVB_SET_CHANNEL = 5101,
@@ -183,7 +171,7 @@ typedef enum {
#define MP_INPUT_RETRY -4
// For the key's drivers, if possible you can send key up and key down
-// events. Key up is the default, to send a key down you must use the
+// 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.
#define MP_KEY_DOWN (1<<29)
// Use this when the key shouldn't be auto-repeated (like mouse buttons)
@@ -297,7 +285,7 @@ char *mp_input_get_section(struct input_ctx *ictx);
// When you create a new driver you should add it in these 2 functions.
struct input_conf;
-struct input_ctx *mp_input_init(struct input_conf *input_conf, int use_gui);
+struct input_ctx *mp_input_init(struct input_conf *input_conf);
void mp_input_uninit(struct input_ctx *ictx);
diff --git a/input/joystick.c b/input/joystick.c
index b49214c95c..4a63c14fae 100644
--- a/input/joystick.c
+++ b/input/joystick.c
@@ -50,15 +50,15 @@ int mp_input_joystick_init(char* dev) {
int fd,l=0;
int initialized = 0;
struct js_event ev;
-
- mp_msg(MSGT_INPUT,MSGL_V,MSGTR_INPUT_JOYSTICK_Opening,dev ? dev : JS_DEV);
+
+ mp_tmsg(MSGT_INPUT,MSGL_V,"Opening joystick device %s\n",dev ? dev : JS_DEV);
fd = open( dev ? dev : JS_DEV , O_RDONLY | O_NONBLOCK );
if(fd < 0) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_CantOpen,dev ? dev : JS_DEV,strerror(errno));
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Can't open joystick device %s: %s\n",dev ? dev : JS_DEV,strerror(errno));
return -1;
}
-
+
while(! initialized) {
l = 0;
while((unsigned int)l < sizeof(struct js_event)) {
@@ -70,15 +70,15 @@ int mp_input_joystick_init(char* dev) {
initialized = 1;
break;
}
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_ErrReading,strerror(errno));
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Error while reading joystick device: %s\n",strerror(errno));
close(fd);
return -1;
- }
+ }
l += r;
}
if((unsigned int)l < sizeof(struct js_event)) {
if(l > 0)
- mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_LoosingBytes,l);
+ mp_tmsg(MSGT_INPUT,MSGL_WARN,"Joystick: We lose %d bytes of data\n",l);
break;
}
if(ev.type == JS_EVENT_BUTTON)
@@ -86,7 +86,7 @@ int mp_input_joystick_init(char* dev) {
if(ev.type == JS_EVENT_AXIS)
axis[ev.number] = ev.value;
}
-
+
return fd;
}
@@ -102,22 +102,22 @@ int mp_input_joystick_read(void *ctx, int fd) {
else if(errno == EAGAIN)
return MP_INPUT_NOTHING;
if( r < 0)
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_ErrReading,strerror(errno));
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Error while reading joystick device: %s\n",strerror(errno));
else
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_ErrReading,"EOF");
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Error while reading joystick device: %s\n","EOF");
return MP_INPUT_DEAD;
- }
+ }
l += r;
}
if((unsigned int)l < sizeof(struct js_event)) {
if(l > 0)
- mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_LoosingBytes,l);
+ mp_tmsg(MSGT_INPUT,MSGL_WARN,"Joystick: We lose %d bytes of data\n",l);
return MP_INPUT_NOTHING;
}
if(ev.type & JS_EVENT_INIT) {
- mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_WarnLostSync);
+ mp_tmsg(MSGT_INPUT,MSGL_WARN,"Joystick: warning init event, we have lost sync with driver.\n");
ev.type &= ~JS_EVENT_INIT;
if(ev.type == JS_EVENT_BUTTON) {
int s = (btns >> ev.number) & 1;
@@ -130,9 +130,9 @@ int mp_input_joystick_read(void *ctx, int fd) {
(axis[ev.number] == 0 && ev.value >= -JOY_AXIS_DELTA && ev.value <= JOY_AXIS_DELTA)
) // State is the same : ignore
return MP_INPUT_NOTHING;
- }
+ }
}
-
+
if(ev.type & JS_EVENT_BUTTON) {
btns &= ~(1 << ev.number);
btns |= (ev.value << ev.number);
@@ -154,7 +154,7 @@ int mp_input_joystick_read(void *ctx, int fd) {
} else
return MP_INPUT_NOTHING;
} else {
- mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_WarnUnknownEvent,ev.type);
+ mp_tmsg(MSGT_INPUT,MSGL_WARN,"Joystick warning unknown event type %d\n",ev.type);
return MP_INPUT_ERROR;
}
diff --git a/input/lirc.c b/input/lirc.c
index 4e60f01182..1e3708a3f4 100644
--- a/input/lirc.c
+++ b/input/lirc.c
@@ -35,14 +35,14 @@ char *lirc_configfile;
static char* cmd_buf = NULL;
-int
+int
mp_input_lirc_init(void) {
int lirc_sock;
int mode;
- mp_msg(MSGT_LIRC,MSGL_V,MSGTR_SettingUpLIRC);
+ mp_tmsg(MSGT_LIRC,MSGL_V,"Setting up LIRC support...\n");
if((lirc_sock=lirc_init("mplayer",1))==-1){
- mp_msg(MSGT_LIRC,MSGL_ERR,MSGTR_LIRCopenfailed);
+ mp_tmsg(MSGT_LIRC,MSGL_ERR,"Failed to open LIRC support. You will not be able to use your remote control.\n");
return -1;
}
@@ -55,7 +55,7 @@ mp_input_lirc_init(void) {
}
if(lirc_readconfig( lirc_configfile,&lirc_config,NULL )!=0 ){
- mp_msg(MSGT_LIRC,MSGL_ERR,MSGTR_LIRCcfgerr,
+ mp_tmsg(MSGT_LIRC,MSGL_ERR,"Failed to read LIRC config file %s.\n",
lirc_configfile == NULL ? "~/.lircrc" : lirc_configfile);
lirc_deinit();
return -1;
@@ -81,7 +81,7 @@ int mp_input_lirc_read(int fd,char* dest, int s) {
}
return w;
}
-
+
// Nothing in the buffer, poll the lirc fd
if(lirc_nextcode(&code) != 0) {
mp_msg(MSGT_LIRC,MSGL_ERR,"Lirc error :(\n");
diff --git a/input/lirc.h b/input/lirc.h
index 22ba92cc6c..d7b22fbb60 100644
--- a/input/lirc.h
+++ b/input/lirc.h
@@ -19,7 +19,7 @@
#ifndef MPLAYER_LIRC_H
#define MPLAYER_LIRC_H
-int
+int
mp_input_lirc_init(void);
int