From 8a9b64329c0e387dc59a1fca477a43c50f59ff34 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 19 Jan 2016 18:36:06 +0100 Subject: Relicense some non-MPlayer source files to LGPL 2.1 or later This covers source files which were added in mplayer2 and mpv times only, and where all code is covered by LGPL relicensing agreements. There are probably more files to which this applies, but I'm being conservative here. A file named ao_sdl.c exists in MPlayer too, but the mpv one is a complete rewrite, and was added some time after the original ao_sdl.c was removed. The same applies to vo_sdl.c, for which the SDL2 API is radically different in addition (MPlayer supports SDL 1.2 only). common.c contains only code written by me. But common.h is a strange case: although it originally was named mp_common.h and exists in MPlayer too, by now it contains only definitions written by uau and me. The exceptions are the CONTROL_ defines - thus not changing the license of common.h yet. codec_tags.c contained once large tables generated from MPlayer's codecs.conf, but all of these tables were removed. From demux_playlist.c I'm removing a code fragment from someone who was not asked; this probably could be done later (see commit 15dccc37). misc.c is a bit complicated to reason about (it was split off mplayer.c and thus contains random functions out of this file), but actually all functions have been added post-MPlayer. Except get_relative_time(), which was written by uau, but looks similar to 3 different versions of something similar in each of the Unix/win32/OSX timer source files. I'm not sure what that means in regards to copyright, so I've just moved it into another still-GPL source file for now. screenshot.c once had some minor parts of MPlayer's vf_screenshot.c, but they're all gone. --- input/event.c | 14 +++++++------- input/event.h | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'input') diff --git a/input/event.c b/input/event.c index 2c46978b15..f765342518 100644 --- a/input/event.c +++ b/input/event.c @@ -1,18 +1,18 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #include "event.h" diff --git a/input/event.h b/input/event.h index e2ce36b329..3a06ce1d1d 100644 --- a/input/event.h +++ b/input/event.h @@ -1,18 +1,18 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #include "misc/bstr.h" -- cgit v1.2.3 From f352669157bc77d54cf851df6eb919213cc5a099 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 20 Jan 2016 15:43:56 +0100 Subject: Change 3 more files to LGPL --- input/ipc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'input') diff --git a/input/ipc.c b/input/ipc.c index 5ed057edb6..6a0afc6e2a 100644 --- a/input/ipc.c +++ b/input/ipc.c @@ -1,18 +1,18 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #include -- cgit v1.2.3 From 135a7217b92c0b1c29ea40ab405566e72d23ae4b Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 22 Jan 2016 16:18:28 +0100 Subject: command: add vf-command command --- input/cmd_list.c | 1 + input/cmd_list.h | 1 + 2 files changed, 2 insertions(+) (limited to 'input') diff --git a/input/cmd_list.c b/input/cmd_list.c index 2f3bfb994a..a5fc342615 100644 --- a/input/cmd_list.c +++ b/input/cmd_list.c @@ -183,6 +183,7 @@ const struct mp_cmd_def mp_cmds[] = { { MP_CMD_AO_RELOAD, "ao-reload", }, { MP_CMD_VF, "vf", { ARG_STRING, ARG_STRING } }, + { MP_CMD_VF_COMMAND, "vf-command", { ARG_STRING, ARG_STRING, ARG_STRING } }, { MP_CMD_VO_CMDLINE, "vo-cmdline", { ARG_STRING } }, diff --git a/input/cmd_list.h b/input/cmd_list.h index c8c0dc3593..876fe4fd71 100644 --- a/input/cmd_list.h +++ b/input/cmd_list.h @@ -96,6 +96,7 @@ enum mp_command_type { /// Video filter commands MP_CMD_VF, + MP_CMD_VF_COMMAND, /// Video output commands MP_CMD_VO_CMDLINE, -- cgit v1.2.3 From f176104ed5c7be37f4f0756b7244cbb90c4fe1fe Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 22 Jan 2016 20:36:54 +0100 Subject: command: add af-command command Similar to vf-command. Requested. Untested. --- input/cmd_list.c | 1 + input/cmd_list.h | 1 + 2 files changed, 2 insertions(+) (limited to 'input') diff --git a/input/cmd_list.c b/input/cmd_list.c index a5fc342615..b5e29aab0e 100644 --- a/input/cmd_list.c +++ b/input/cmd_list.c @@ -180,6 +180,7 @@ const struct mp_cmd_def mp_cmds[] = { { MP_CMD_DROP_BUFFERS, "drop-buffers", }, { MP_CMD_AF, "af", { ARG_STRING, ARG_STRING } }, + { MP_CMD_AF_COMMAND, "af-command", { ARG_STRING, ARG_STRING, ARG_STRING } }, { MP_CMD_AO_RELOAD, "ao-reload", }, { MP_CMD_VF, "vf", { ARG_STRING, ARG_STRING } }, diff --git a/input/cmd_list.h b/input/cmd_list.h index 876fe4fd71..4e324bf01c 100644 --- a/input/cmd_list.h +++ b/input/cmd_list.h @@ -92,6 +92,7 @@ enum mp_command_type { /// Audio Filter commands MP_CMD_AF, + MP_CMD_AF_COMMAND, MP_CMD_AO_RELOAD, /// Video filter commands -- cgit v1.2.3 From b4f63cbbec563e46ef01899b7292e301e961ec1d Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 4 Feb 2016 23:01:15 +0100 Subject: input: ignore --input-cursor for events injected by input commands Apparently useful for window embedding. Fixes #2750. --- input/input.c | 28 +++++++++++++++++++++------- input/input.h | 6 ++++++ 2 files changed, 27 insertions(+), 7 deletions(-) (limited to 'input') diff --git a/input/input.c b/input/input.c index d1c69a9587..ff7dcea67e 100644 --- a/input/input.c +++ b/input/input.c @@ -604,7 +604,8 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale) mp_input_queue_cmd(ictx, cmd); } -static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale) +static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale, + bool force_mouse) { struct input_opts *opts = ictx->opts; @@ -615,7 +616,7 @@ static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale) release_down_cmd(ictx, false); return; } - if (!opts->enable_mouse_movements && MP_KEY_IS_MOUSE(unmod)) + if (!opts->enable_mouse_movements && MP_KEY_IS_MOUSE(unmod) && !force_mouse) return; if (unmod == MP_KEY_MOUSE_LEAVE || unmod == MP_KEY_MOUSE_ENTER) { update_mouse_section(ictx); @@ -643,7 +644,14 @@ static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale) void mp_input_put_key(struct input_ctx *ictx, int code) { input_lock(ictx); - mp_input_feed_key(ictx, code, 1); + mp_input_feed_key(ictx, code, 1, false); + input_unlock(ictx); +} + +void mp_input_put_key_artificial(struct input_ctx *ictx, int code) +{ + input_lock(ictx); + mp_input_feed_key(ictx, code, 1, true); input_unlock(ictx); } @@ -662,7 +670,7 @@ void mp_input_put_axis(struct input_ctx *ictx, int direction, double value) if (value == 0.0) return; input_lock(ictx); - mp_input_feed_key(ictx, direction, value); + mp_input_feed_key(ictx, direction, value, false); input_unlock(ictx); } @@ -697,13 +705,19 @@ bool mp_input_vo_keyboard_enabled(struct input_ctx *ictx) } void mp_input_set_mouse_pos(struct input_ctx *ictx, int x, int y) +{ + input_lock(ictx); + if (ictx->opts->enable_mouse_movements) + mp_input_set_mouse_pos_artificial(ictx, x, y); + input_unlock(ictx); +} + +void mp_input_set_mouse_pos_artificial(struct input_ctx *ictx, int x, int y) { input_lock(ictx); MP_DBG(ictx, "mouse move %d/%d\n", x, y); - if ((ictx->mouse_vo_x == x && ictx->mouse_vo_y == y) || - !ictx->opts->enable_mouse_movements) - { + if (ictx->mouse_vo_x == x && ictx->mouse_vo_y == y) { input_unlock(ictx); return; } diff --git a/input/input.h b/input/input.h index 6462555326..41432eb54d 100644 --- a/input/input.h +++ b/input/input.h @@ -132,6 +132,9 @@ void mp_input_src_feed_cmd_text(struct mp_input_src *src, char *buf, size_t len) // with modifiers applied. MP_INPUT_RELEASE_ALL is also a valid value. void mp_input_put_key(struct input_ctx *ictx, int code); +// Like mp_input_put_key(), but ignore mouse disable option for mouse buttons. +void mp_input_put_key_artificial(struct input_ctx *ictx, int code); + // Like mp_input_put_key(), but process all UTF-8 characters in the given // string as key events. void mp_input_put_key_utf8(struct input_ctx *ictx, int mods, struct bstr t); @@ -143,6 +146,9 @@ void mp_input_put_axis(struct input_ctx *ictx, int direction, double value); // Update mouse position (in window coordinates). void mp_input_set_mouse_pos(struct input_ctx *ictx, int x, int y); +// Like mp_input_set_mouse_pos(), but ignore mouse disable option. +void mp_input_set_mouse_pos_artificial(struct input_ctx *ictx, int x, int y); + void mp_input_get_mouse_pos(struct input_ctx *ictx, int *x, int *y); // Return whether we want/accept mouse input. -- cgit v1.2.3 From f9f3175487f9d3732ada3d7acd7d5472c8a069c0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 12 Feb 2016 16:11:05 +0100 Subject: ipc: fix uninitialized field The sockaddr_un.sun_len field was not initialized. It seems our API use is correct by simply making sure it's 0. Fixes CID 1350075. --- input/ipc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'input') diff --git a/input/ipc.c b/input/ipc.c index 6a0afc6e2a..c628fc9ea4 100644 --- a/input/ipc.c +++ b/input/ipc.c @@ -740,7 +740,7 @@ static void *ipc_thread(void *p) int rc; int ipc_fd; - struct sockaddr_un ipc_un; + struct sockaddr_un ipc_un = {0}; struct mp_ipc_ctx *arg = p; -- cgit v1.2.3