2013-12-26 16:10:35 +00:00
|
|
|
/*
|
2015-04-13 07:36:54 +00:00
|
|
|
* This file is part of mpv.
|
2013-12-26 16:10:35 +00:00
|
|
|
*
|
input: change license to LGPL
cehoyos adds the step_property command in 7a71da01d, and it could be
argued that copyright of this still applies to the later add/cycle
commands (a668ae0ff90c4). While I'm not sure if this is really the case,
stay conservative for now and mark these commands as GPL-only. Mark the
command.c code too, although that is not being relicensed yet.
I'm leaving the MP_CMD_* enum items, as they are obviously different.
In commit 116ca0c7682, "veal" (essentially an anonymous author) adds an
"osd_show_property_text" command (well, the commit message says "based
on" that person's code, so it's not clear how much is from him or from
albeu, who agreed to LGPL). This was later merged again with the
"osd_show_text" command, and then all original code was removed in
commit 58cc0f637f, so I claim that no copyright applies anymore. (Though
technically the input.conf addition still might be copyrighted, so I'm
just dropping it to get rid of the thought.)
"kiriuja" added 2f376d1b39 (sub_load etc.) and be54f4813 (switch_audio).
The latter is gone. I would argue that the former is fully rewritten
with commits b7052b431c9 and 0f155921b0. But like in the step_property
case, I will be overly conservative for now, and mark them as GPL-only,
as this is potentially shaky and should be thought through first. (Not
bothering with the command define/enum in the header, as it will be
unused in LGPL mode anyway.)
keycodes.c/h can be GPL, except for commit 2b1f95dcc2f8, which is a
patch by someone who wasn't asked yet. Before doing something radical, I
will wait for a reply.
2017-06-19 11:02:35 +00:00
|
|
|
* 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.
|
2013-12-26 16:10:35 +00:00
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is distributed in the hope that it will be useful,
|
2013-12-26 16:10:35 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
input: change license to LGPL
cehoyos adds the step_property command in 7a71da01d, and it could be
argued that copyright of this still applies to the later add/cycle
commands (a668ae0ff90c4). While I'm not sure if this is really the case,
stay conservative for now and mark these commands as GPL-only. Mark the
command.c code too, although that is not being relicensed yet.
I'm leaving the MP_CMD_* enum items, as they are obviously different.
In commit 116ca0c7682, "veal" (essentially an anonymous author) adds an
"osd_show_property_text" command (well, the commit message says "based
on" that person's code, so it's not clear how much is from him or from
albeu, who agreed to LGPL). This was later merged again with the
"osd_show_text" command, and then all original code was removed in
commit 58cc0f637f, so I claim that no copyright applies anymore. (Though
technically the input.conf addition still might be copyrighted, so I'm
just dropping it to get rid of the thought.)
"kiriuja" added 2f376d1b39 (sub_load etc.) and be54f4813 (switch_audio).
The latter is gone. I would argue that the former is fully rewritten
with commits b7052b431c9 and 0f155921b0. But like in the step_property
case, I will be overly conservative for now, and mark them as GPL-only,
as this is potentially shaky and should be thought through first. (Not
bothering with the command define/enum in the header, as it will be
unused in LGPL mode anyway.)
keycodes.c/h can be GPL, except for commit 2b1f95dcc2f8, which is a
patch by someone who wasn't asked yet. Before doing something radical, I
will wait for a reply.
2017-06-19 11:02:35 +00:00
|
|
|
* GNU Lesser General Public License for more details.
|
2013-12-26 16:10:35 +00:00
|
|
|
*
|
input: change license to LGPL
cehoyos adds the step_property command in 7a71da01d, and it could be
argued that copyright of this still applies to the later add/cycle
commands (a668ae0ff90c4). While I'm not sure if this is really the case,
stay conservative for now and mark these commands as GPL-only. Mark the
command.c code too, although that is not being relicensed yet.
I'm leaving the MP_CMD_* enum items, as they are obviously different.
In commit 116ca0c7682, "veal" (essentially an anonymous author) adds an
"osd_show_property_text" command (well, the commit message says "based
on" that person's code, so it's not clear how much is from him or from
albeu, who agreed to LGPL). This was later merged again with the
"osd_show_text" command, and then all original code was removed in
commit 58cc0f637f, so I claim that no copyright applies anymore. (Though
technically the input.conf addition still might be copyrighted, so I'm
just dropping it to get rid of the thought.)
"kiriuja" added 2f376d1b39 (sub_load etc.) and be54f4813 (switch_audio).
The latter is gone. I would argue that the former is fully rewritten
with commits b7052b431c9 and 0f155921b0. But like in the step_property
case, I will be overly conservative for now, and mark them as GPL-only,
as this is potentially shaky and should be thought through first. (Not
bothering with the command define/enum in the header, as it will be
unused in LGPL mode anyway.)
keycodes.c/h can be GPL, except for commit 2b1f95dcc2f8, which is a
patch by someone who wasn't asked yet. Before doing something radical, I
will wait for a reply.
2017-06-19 11:02:35 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2013-12-26 16:10:35 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MP_COMMAND_LIST_H
|
|
|
|
#define MP_COMMAND_LIST_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "options/m_option.h"
|
|
|
|
|
|
|
|
#define MP_CMD_MAX_ARGS 10
|
|
|
|
|
2014-02-24 22:02:20 +00:00
|
|
|
#define MP_CMD_OPT_ARG 0x1000
|
|
|
|
|
2013-12-26 16:10:35 +00:00
|
|
|
struct mp_cmd_def {
|
|
|
|
int id; // one of MP_CMD_...
|
|
|
|
const char *name; // user-visible name (as used in input.conf)
|
|
|
|
const struct m_option args[MP_CMD_MAX_ARGS];
|
|
|
|
bool allow_auto_repeat; // react to repeated key events
|
2014-11-24 15:48:34 +00:00
|
|
|
bool on_updown; // always emit it on both up and down key events
|
2013-12-26 16:10:35 +00:00
|
|
|
bool vararg; // last argument can be given 0 to multiple times
|
2017-04-24 12:04:25 +00:00
|
|
|
bool scalable;
|
2013-12-26 16:10:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct mp_cmd_def mp_cmds[];
|
|
|
|
|
|
|
|
// All command IDs
|
|
|
|
enum mp_command_type {
|
|
|
|
MP_CMD_IGNORE,
|
|
|
|
MP_CMD_SEEK,
|
|
|
|
MP_CMD_REVERT_SEEK,
|
|
|
|
MP_CMD_QUIT,
|
|
|
|
MP_CMD_QUIT_WATCH_LATER,
|
|
|
|
MP_CMD_PLAYLIST_NEXT,
|
|
|
|
MP_CMD_PLAYLIST_PREV,
|
|
|
|
MP_CMD_OSD,
|
|
|
|
MP_CMD_SCREENSHOT,
|
|
|
|
MP_CMD_SCREENSHOT_TO_FILE,
|
2015-04-20 21:11:03 +00:00
|
|
|
MP_CMD_SCREENSHOT_RAW,
|
2013-12-26 16:10:35 +00:00
|
|
|
MP_CMD_LOADFILE,
|
|
|
|
MP_CMD_LOADLIST,
|
|
|
|
MP_CMD_PLAYLIST_CLEAR,
|
|
|
|
MP_CMD_PLAYLIST_REMOVE,
|
|
|
|
MP_CMD_PLAYLIST_MOVE,
|
2015-05-17 19:16:10 +00:00
|
|
|
MP_CMD_PLAYLIST_SHUFFLE,
|
2013-12-26 16:10:35 +00:00
|
|
|
MP_CMD_SUB_STEP,
|
|
|
|
MP_CMD_SUB_SEEK,
|
|
|
|
MP_CMD_TV_LAST_CHANNEL,
|
|
|
|
MP_CMD_FRAME_STEP,
|
|
|
|
MP_CMD_FRAME_BACK_STEP,
|
|
|
|
MP_CMD_RUN,
|
|
|
|
MP_CMD_SUB_ADD,
|
|
|
|
MP_CMD_SUB_REMOVE,
|
|
|
|
MP_CMD_SUB_RELOAD,
|
|
|
|
MP_CMD_SET,
|
|
|
|
MP_CMD_PRINT_TEXT,
|
|
|
|
MP_CMD_SHOW_TEXT,
|
2017-03-26 17:29:10 +00:00
|
|
|
MP_CMD_EXPAND_TEXT,
|
2013-12-26 16:10:35 +00:00
|
|
|
MP_CMD_SHOW_PROGRESS,
|
|
|
|
MP_CMD_ADD,
|
|
|
|
MP_CMD_CYCLE,
|
|
|
|
MP_CMD_MULTIPLY,
|
|
|
|
MP_CMD_CYCLE_VALUES,
|
|
|
|
MP_CMD_STOP,
|
2015-02-03 08:15:14 +00:00
|
|
|
MP_CMD_AUDIO_ADD,
|
|
|
|
MP_CMD_AUDIO_REMOVE,
|
|
|
|
MP_CMD_AUDIO_RELOAD,
|
2013-12-26 16:10:35 +00:00
|
|
|
|
|
|
|
MP_CMD_ENABLE_INPUT_SECTION,
|
|
|
|
MP_CMD_DISABLE_INPUT_SECTION,
|
2015-08-05 21:55:16 +00:00
|
|
|
MP_CMD_DEFINE_INPUT_SECTION,
|
2013-12-26 16:10:35 +00:00
|
|
|
|
2014-11-18 20:33:15 +00:00
|
|
|
MP_CMD_AB_LOOP,
|
|
|
|
|
2014-11-20 21:41:50 +00:00
|
|
|
MP_CMD_DROP_BUFFERS,
|
|
|
|
|
2015-01-23 20:45:13 +00:00
|
|
|
MP_CMD_MOUSE,
|
2015-06-10 23:56:56 +00:00
|
|
|
MP_CMD_KEYPRESS,
|
|
|
|
MP_CMD_KEYDOWN,
|
|
|
|
MP_CMD_KEYUP,
|
2015-01-23 20:45:13 +00:00
|
|
|
|
2013-12-26 16:10:35 +00:00
|
|
|
/// Audio Filter commands
|
|
|
|
MP_CMD_AF,
|
2016-01-22 19:36:54 +00:00
|
|
|
MP_CMD_AF_COMMAND,
|
2014-10-27 10:52:42 +00:00
|
|
|
MP_CMD_AO_RELOAD,
|
2013-12-26 16:10:35 +00:00
|
|
|
|
|
|
|
/// Video filter commands
|
|
|
|
MP_CMD_VF,
|
2016-01-22 15:18:28 +00:00
|
|
|
MP_CMD_VF_COMMAND,
|
2013-12-26 16:10:35 +00:00
|
|
|
|
|
|
|
/// Internal for Lua scripts
|
2014-11-23 14:08:49 +00:00
|
|
|
MP_CMD_SCRIPT_BINDING,
|
2014-02-17 01:33:47 +00:00
|
|
|
MP_CMD_SCRIPT_MESSAGE,
|
2014-03-17 17:26:56 +00:00
|
|
|
MP_CMD_SCRIPT_MESSAGE_TO,
|
2013-12-26 16:10:35 +00:00
|
|
|
|
|
|
|
MP_CMD_OVERLAY_ADD,
|
|
|
|
MP_CMD_OVERLAY_REMOVE,
|
|
|
|
|
2014-05-26 16:11:02 +00:00
|
|
|
MP_CMD_WRITE_WATCH_LATER_CONFIG,
|
|
|
|
|
command: add a mechanism to allow scripts to intercept file loads
A vague idea to get something similar what libquvi did.
Undocumented because it might change a lot, or even be removed. To give
an idea what it does, a Lua script could do the following:
-- type ID priority
mp.commandv("hook_add", "on_load", 0, 0)
mp.register_script_message("hook_run", function(param, param2)
-- param is "0", the user-chosen ID from the hook_add command
-- param2 is the magic value that has to be passed to finish
-- the hook
mp.resume_all()
-- do something, maybe set options that are reset on end:
mp.set_property("file-local-options/name", "value")
-- or change the URL that's being opened:
local url = mp.get_property("stream-open-filename")
mp.set_property("stream-open-filename", url .. ".png")
-- let the player (or the next script) continue
mp.commandv("hook_ack", param2)
end)
2014-10-15 21:09:53 +00:00
|
|
|
MP_CMD_HOOK_ADD,
|
|
|
|
MP_CMD_HOOK_ACK,
|
|
|
|
|
2015-02-16 21:06:41 +00:00
|
|
|
MP_CMD_RESCAN_EXTERNAL_FILES,
|
|
|
|
|
2016-09-17 19:01:59 +00:00
|
|
|
MP_CMD_APPLY_PROFILE,
|
|
|
|
|
2016-09-22 18:43:33 +00:00
|
|
|
MP_CMD_LOAD_SCRIPT,
|
|
|
|
|
2013-12-26 16:10:35 +00:00
|
|
|
// Internal
|
|
|
|
MP_CMD_COMMAND_LIST, // list of sub-commands in args[0].v.p
|
|
|
|
};
|
|
|
|
|
2014-09-13 14:47:30 +00:00
|
|
|
// Executing this command will maybe abort playback (play something else, or quit).
|
2014-02-20 12:38:39 +00:00
|
|
|
struct mp_cmd;
|
2014-09-13 14:47:30 +00:00
|
|
|
bool mp_input_is_maybe_abort_cmd(struct mp_cmd *cmd);
|
|
|
|
// This command will definitely abort playback.
|
2014-02-20 12:38:39 +00:00
|
|
|
bool mp_input_is_abort_cmd(struct mp_cmd *cmd);
|
2013-12-26 16:10:35 +00:00
|
|
|
|
2014-05-26 19:49:14 +00:00
|
|
|
bool mp_input_is_repeatable_cmd(struct mp_cmd *cmd);
|
|
|
|
|
2017-04-24 12:04:25 +00:00
|
|
|
bool mp_input_is_scalable_cmd(struct mp_cmd *cmd);
|
|
|
|
|
2013-12-26 16:10:35 +00:00
|
|
|
struct bstr;
|
|
|
|
bool mp_replace_legacy_cmd(void *talloc_ctx, struct bstr *s);
|
|
|
|
|
|
|
|
struct mp_log;
|
|
|
|
void mp_print_cmd_list(struct mp_log *out);
|
|
|
|
|
|
|
|
#endif
|