From a35da6612e8aed997da1c5322df0c8f0b88ff3e3 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Sat, 27 Apr 2019 21:57:27 +0200 Subject: [PATCH] command: add video-add/video-remove/video-reload commands --- DOCS/man/input.rst | 9 +++++++++ player/command.c | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) 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 []`` Reload the given audio tracks. See ``sub-reload`` command. +``video-add [ [ [<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, {