diff options
-rwxr-xr-x | configure | 11 | ||||
-rw-r--r-- | input/input.c | 57 | ||||
-rw-r--r-- | mp_msg.h | 11 | ||||
-rw-r--r-- | stream/tvi_v4l2.c | 4 |
4 files changed, 46 insertions, 37 deletions
@@ -3262,6 +3262,14 @@ fi echores "$_soundcard_h" +echocheck "sys/videoio.h" +sys_videoio_h=no +def_sys_videoio_h='#undef HAVE_SYS_VIDEOIO_H' +header_check sys/videoio.h && sys_videoio_h=yes && + def_sys_videoio_h='#define HAVE_SYS_VIDEOIO_H 1' +echores "$sys_videoio_h" + + echocheck "sys/dvdio.h" _dvdio=no # FreeBSD 8.1 has broken dvdio.h @@ -6259,6 +6267,8 @@ if test "$_tv_v4l2" = auto ; then _tv_v4l2=no if test "$_tv" = yes && linux ; then header_check_broken sys/time.h linux/videodev2.h && _tv_v4l2=yes + elif test "$_tv" = yes && test "$sys_videoio_h" = "yes" ; then + _tv_v4l2=yes fi fi if test "$_tv_v4l2" = yes ; then @@ -6908,6 +6918,7 @@ $def_soundcard_h $def_sys_asoundlib_h $def_sys_soundcard_h $def_sys_sysinfo_h +$def_sys_videoio_h $def_termios_h $def_termios_sys_h $def_winsock2_h diff --git a/input/input.c b/input/input.c index de776ad3ff..94c15f42bb 100644 --- a/input/input.c +++ b/input/input.c @@ -656,9 +656,8 @@ static const m_option_t mp_input_opts[] = { static int default_cmd_func(int fd, char *buf, int l); -static char *get_key_name(int key) +static char *get_key_name(int key, char *ret) { - char *ret = talloc_strdup(NULL, ""); for (int i = 0; modifier_names[i].name; i++) { if (modifier_names[i].key & key) { ret = talloc_asprintf_append_buffer(ret, "%s+", @@ -678,6 +677,19 @@ static char *get_key_name(int key) return talloc_asprintf_append_buffer(ret, "%#-8x", key); } +static char *get_key_combo_name(int *keys, int max) +{ + char *ret = talloc_strdup(NULL, ""); + while (1) { + ret = get_key_name(*keys, ret); + if (--max && *++keys) + talloc_asprintf_append_buffer(ret, "-"); + else + break; + } + return ret; +} + 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) { @@ -1124,36 +1136,20 @@ 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) { - char *key_buf = get_key_name(keys[0]); - mp_tmsg(MSGT_INPUT, MSGL_WARN, "No bind found for key '%s'.", key_buf); + char *key_buf = get_key_combo_name(keys, n); + mp_tmsg(MSGT_INPUT, MSGL_WARN, + "No bind found for key '%s'.\n", key_buf); talloc_free(key_buf); - if (n > 1) { - for (int s = 1; s < n; s++) { - key_buf = get_key_name(keys[s]); - mp_msg(MSGT_INPUT, MSGL_WARN, "-%s", key_buf); - talloc_free(key_buf); - } - } - mp_msg(MSGT_INPUT, MSGL_WARN, " \n"); return NULL; } if (strcmp(cmd, "ignore") == 0) return NULL; ret = mp_input_parse_cmd(cmd); if (!ret) { - char *key_buf = get_key_name(ictx->key_down[0]); - mp_tmsg(MSGT_INPUT, MSGL_ERR, "Invalid command for bound key %s", - key_buf); + char *key_buf = get_key_combo_name(keys, n); + mp_tmsg(MSGT_INPUT, MSGL_ERR, + "Invalid command for bound key '%s': '%s'\n", key_buf, cmd); talloc_free(key_buf); - if (ictx->num_key_down > 1) { - unsigned int s; - for (s = 1; s < ictx->num_key_down; s++) { - char *key_buf = get_key_name(ictx->key_down[s]); - mp_msg(MSGT_INPUT, MSGL_ERR, "-%s", key_buf); - talloc_free(key_buf); - } - } - mp_msg(MSGT_INPUT, MSGL_ERR, " : %s \n", cmd); } return ret; } @@ -1699,17 +1695,10 @@ static int parse_config(struct input_ctx *ictx, char *file) iter++; // Found new line if (iter[0] == '\n' || iter[0] == '\r') { - int i; - char *key_buf = get_key_name(keys[0]); - mp_tmsg(MSGT_INPUT, MSGL_ERR, "No command found for key %s", - key_buf); + char *key_buf = get_key_combo_name(keys, MP_MAX_KEY_DOWN); + mp_tmsg(MSGT_INPUT, MSGL_ERR, + "No command found for key '%s'.\n", key_buf); talloc_free(key_buf); - for (i = 1; keys[i] != 0; i++) { - char *key_buf = get_key_name(keys[i]); - mp_msg(MSGT_INPUT, MSGL_ERR, "-%s", key_buf); - talloc_free(key_buf); - } - mp_msg(MSGT_INPUT, MSGL_ERR, "\n"); keys[0] = 0; if (iter > buffer) { memmove(buffer, iter, bs - (iter - buffer)); @@ -140,16 +140,21 @@ void mp_msg_va(int mod, int lev, const char *format, va_list va); #ifdef __GNUC__ void mp_msg(int mod, int lev, const char *format, ... ) __attribute__ ((format (printf, 3, 4))); void mp_tmsg(int mod, int lev, const char *format, ... ) __attribute__ ((format (printf, 3, 4))); +static inline void mp_dbg(int mod, int lev, const char *format, ...) __attribute__ ((format (printf, 3, 4))); #else // not GNU C void mp_msg(int mod, int lev, const char *format, ... ); void mp_tmsg(int mod, int lev, const char *format, ...) #endif /* __GNUC__ */ +static inline void mp_dbg(int mod, int lev, const char *format, ...) +{ #ifdef MP_DEBUG -#define mp_dbg(mod,lev, ... ) mp_msg(mod, lev, __VA_ARGS__) -#else -#define mp_dbg(mod,lev, ... ) /* only useful for developers */ + va_list va; + va_start(va, format); + mp_msg_va(mod, lev, format, va); + va_end(va); #endif +} const char* filename_recode(const char* filename); diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c index def59ad40d..234a5ac019 100644 --- a/stream/tvi_v4l2.c +++ b/stream/tvi_v4l2.c @@ -49,8 +49,12 @@ known issues: #ifdef HAVE_SYS_SYSINFO_H #include <sys/sysinfo.h> #endif +#ifdef HAVE_SYS_VIDEOIO_H +#include <sys/videoio.h> +#else #include <linux/types.h> #include <linux/videodev2.h> +#endif #include "mp_msg.h" #include "libmpcodecs/img_format.h" #include "libmpcodecs/dec_teletext.h" |