1
mirror of https://github.com/mpv-player/mpv synced 2024-11-14 22:48:35 +01:00

command: add video-add/video-remove/video-reload commands

This commit is contained in:
Paul B Mahol 2019-04-27 21:57:27 +02:00 committed by wm4
parent f54ad8eb05
commit a35da6612e
2 changed files with 30 additions and 0 deletions

View File

@ -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

View File

@ -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,
{