summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-04-27 21:57:27 +0200
committerwm4 <wm4@nowhere>2019-09-21 15:02:16 +0200
commita35da6612e8aed997da1c5322df0c8f0b88ff3e3 (patch)
tree3b13bc9502164a31541ab4a40c7b77d5dde93757
parentf54ad8eb055771a080f079964504cb0f32fc4014 (diff)
downloadmpv-a35da6612e8aed997da1c5322df0c8f0b88ff3e3.tar.bz2
mpv-a35da6612e8aed997da1c5322df0c8f0b88ff3e3.tar.xz
command: add video-add/video-remove/video-reload commands
-rw-r--r--DOCS/man/input.rst9
-rw-r--r--player/command.c21
2 files changed, 30 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 5451334313..6798130b32 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -585,6 +585,15 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
``audio-reload [<id>]``
Reload the given audio tracks. See ``sub-reload`` command.
+``video-add <url> [<flags> [<title> [<lang>]]]``
+ Load the given video file. See ``sub-add`` command.
+
+``video-remove [<id>]``
+ Remove the given video track. See ``sub-remove`` command.
+
+``video-reload [<id>]``
+ Reload the given video tracks. See ``sub-reload`` command.
+
``rescan-external-files [<mode>]``
Rescan external files according to the current ``--sub-auto`` and
``--audio-file-auto`` settings. This can be used to auto-load external
diff --git a/player/command.c b/player/command.c
index c66ecf4d6b..dce810a077 100644
--- a/player/command.c
+++ b/player/command.c
@@ -5783,11 +5783,26 @@ const struct mp_cmd_def mp_cmds[] = {
.can_abort = true,
.abort_on_playback_end = true,
},
+ { "video-add", cmd_track_add,
+ {
+ OPT_STRING("url", v.s, 0),
+ OPT_CHOICE("flags", v.i, MP_CMD_OPT_ARG,
+ ({"select", 0}, {"auto", 1}, {"cached", 2})),
+ OPT_STRING("title", v.s, MP_CMD_OPT_ARG),
+ OPT_STRING("lang", v.s, MP_CMD_OPT_ARG),
+ },
+ .priv = &(const int){STREAM_VIDEO},
+ .spawn_thread = true,
+ .can_abort = true,
+ .abort_on_playback_end = true,
+ },
{ "sub-remove", cmd_track_remove, { OPT_INT("id", v.i, 0, OPTDEF_INT(-1)) },
.priv = &(const int){STREAM_SUB}, },
{ "audio-remove", cmd_track_remove, { OPT_INT("id", v.i, 0, OPTDEF_INT(-1)) },
.priv = &(const int){STREAM_AUDIO}, },
+ { "video-remove", cmd_track_remove, { OPT_INT("id", v.i, 0, OPTDEF_INT(-1)) },
+ .priv = &(const int){STREAM_VIDEO}, },
{ "sub-reload", cmd_track_reload, { OPT_INT("id", v.i, 0, OPTDEF_INT(-1)) },
.priv = &(const int){STREAM_SUB},
@@ -5801,6 +5816,12 @@ const struct mp_cmd_def mp_cmds[] = {
.can_abort = true,
.abort_on_playback_end = true,
},
+ { "video-reload", cmd_track_reload, { OPT_INT("id", v.i, 0, OPTDEF_INT(-1)) },
+ .priv = &(const int){STREAM_VIDEO},
+ .spawn_thread = true,
+ .can_abort = true,
+ .abort_on_playback_end = true,
+ },
{ "rescan-external-files", cmd_rescan_external_files,
{