mirror of
https://github.com/mpv-player/mpv
synced 2025-04-01 14:50:07 +00:00
af/vf-command: add ability to target a specific lavfi filter
fixes: #11180
This commit is contained in:
parent
8641cbaab6
commit
d32f1aac3f
@ -1296,16 +1296,21 @@ Input Commands that are Possibly Subject to Change
|
||||
The ``flags`` argument is like the first argument to ``screenshot`` and
|
||||
supports ``subtitles``, ``video``, ``window``.
|
||||
|
||||
``vf-command <label> <command> <argument>``
|
||||
Send a command to the filter with the given ``<label>``. Use ``all`` to send
|
||||
it to all filters at once. The command and argument string is filter
|
||||
specific. Currently, this only works with the ``lavfi`` filter - see
|
||||
the libavfilter documentation for which commands a filter supports.
|
||||
``vf-command <label> <command> <argument> [<target>]``
|
||||
Send a command to the filter. Note that currently, this only works with
|
||||
the ``lavfi`` filter. Refer to the libavfilter documentation for the list
|
||||
of supported commands for each filter.
|
||||
|
||||
Note that the ``<label>`` is a mpv filter label, not a libavfilter filter
|
||||
name.
|
||||
``<label>`` is a mpv filter label, use ``all`` to send it to all filters
|
||||
at once.
|
||||
|
||||
``af-command <label> <command> <argument>``
|
||||
``<command>`` and ``<argument>`` are filter-specific strings.
|
||||
|
||||
``<target>`` is a filter or filter instance name and defaults to ``all``.
|
||||
Note that the target is an additional specifier for filters that
|
||||
support them, such as complex ``lavfi`` filter chains.
|
||||
|
||||
``af-command <label> <command> <argument> [<target>]``
|
||||
Same as ``vf-command``, but for audio filters.
|
||||
|
||||
``apply-profile <name> [<mode>]``
|
||||
|
@ -814,7 +814,8 @@ static bool lavfi_command(struct mp_filter *f, struct mp_filter_command *cmd)
|
||||
|
||||
switch (cmd->type) {
|
||||
case MP_FILTER_COMMAND_TEXT: {
|
||||
return avfilter_graph_send_command(c->graph, "all", cmd->cmd, cmd->arg,
|
||||
return avfilter_graph_send_command(c->graph, cmd->target,
|
||||
cmd->cmd, cmd->arg,
|
||||
&(char){0}, 0, 0) >= 0;
|
||||
}
|
||||
case MP_FILTER_COMMAND_GET_META: {
|
||||
|
@ -376,6 +376,7 @@ struct mp_filter_command {
|
||||
enum mp_filter_command_type type;
|
||||
|
||||
// For MP_FILTER_COMMAND_TEXT
|
||||
const char *target;
|
||||
const char *cmd;
|
||||
const char *arg;
|
||||
|
||||
|
@ -5999,6 +5999,7 @@ static void cmd_filter_command(void *p)
|
||||
}
|
||||
struct mp_filter_command filter_cmd = {
|
||||
.type = MP_FILTER_COMMAND_TEXT,
|
||||
.target = cmd->args[3].v.s,
|
||||
.cmd = cmd->args[1].v.s,
|
||||
.arg = cmd->args[2].v.s,
|
||||
};
|
||||
@ -6643,13 +6644,23 @@ const struct mp_cmd_def mp_cmds[] = {
|
||||
{"value", OPT_STRING(v.s)}, },
|
||||
.priv = &(const int){STREAM_VIDEO} },
|
||||
|
||||
{ "af-command", cmd_filter_command, { {"label", OPT_STRING(v.s)},
|
||||
{"command", OPT_STRING(v.s)},
|
||||
{"argument", OPT_STRING(v.s)}, },
|
||||
{ "af-command", cmd_filter_command,
|
||||
{
|
||||
{"label", OPT_STRING(v.s)},
|
||||
{"command", OPT_STRING(v.s)},
|
||||
{"argument", OPT_STRING(v.s)},
|
||||
{"target", OPT_STRING(v.s), OPTDEF_STR("all"),
|
||||
.flags = MP_CMD_OPT_ARG},
|
||||
},
|
||||
.priv = &(const int){STREAM_AUDIO} },
|
||||
{ "vf-command", cmd_filter_command, { {"label", OPT_STRING(v.s)},
|
||||
{"command", OPT_STRING(v.s)},
|
||||
{"argument", OPT_STRING(v.s)}, },
|
||||
{ "vf-command", cmd_filter_command,
|
||||
{
|
||||
{"label", OPT_STRING(v.s)},
|
||||
{"command", OPT_STRING(v.s)},
|
||||
{"argument", OPT_STRING(v.s)},
|
||||
{"target", OPT_STRING(v.s), OPTDEF_STR("all"),
|
||||
.flags = MP_CMD_OPT_ARG},
|
||||
},
|
||||
.priv = &(const int){STREAM_VIDEO} },
|
||||
|
||||
{ "ao-reload", cmd_ao_reload },
|
||||
|
Loading…
Reference in New Issue
Block a user