See http://lists.ffmpeg.org/pipermail/ffmpeg-user/2017-April/035975.html Parsed_filter_X could remain and user can override it with custom one. Example: ffplay -f lavfi "nullsrc=s=640x360, sendcmd='1 drawtext@top reinit text=Hello; 2 drawtext@bottom reinit text=World', drawtext@top=x=16:y=16:fontsize=20:fontcolor=Red:text='', drawtext@bottom=x=16:y=340:fontsize=16:fontcolor=Blue:text=''"
Unified · Split
| @@ -130,11 +130,11 @@ filterchains is represented by a list of ";"-separated filterchain · 129 unmodified lines | ||
| 130 | 130 | descriptions. |
| 131 | 131 | |
| 132 | 132 | A filter is represented by a string of the form: |
| 133 | −[@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}] | |
| 133 | +[@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}] | |
| 134 | 134 | |
| 135 | 135 | @var{filter_name} is the name of the filter class of which the |
| 136 | 136 | described filter is an instance of, and has to be the name of one of |
| 137 | −the filter classes registered in the program. | |
| 137 | +the filter classes registered in the program optionally followed by "@@@var{id}". | |
| 138 | 138 | The name of the filter class is optionally followed by a string |
| 139 | 139 | "=@var{arguments}". |
| 140 | 140 | |
| @@ -212,10 +212,11 @@ to the filtergraph description. · 71 unmodified lines | ||
| 212 | 212 | Here is a BNF description of the filtergraph syntax: |
| 213 | 213 | @example |
| 214 | 214 | @var{NAME} ::= sequence of alphanumeric characters and '_' |
| 215 | +@var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}] | |
| 215 | 216 | @var{LINKLABEL} ::= "[" @var{NAME} "]" |
| 216 | 217 | @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}] |
| 217 | 218 | @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted) |
| 218 | −@var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}] | |
| 219 | +@var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}] | |
| 219 | 220 | @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}] |
| 220 | 221 | @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}] |
| 221 | 222 | @end example |
| @@ -17246,6 +17247,12 @@ Specify audio tempo change at second 4: · 17024 unmodified lines | ||
| 17246 | 17247 | asendcmd=c='4.0 atempo tempo 1.5',atempo |
| 17247 | 17248 | @end example |
| 17248 | 17249 | |
| 17250 | +@item | |
| 17251 | +Target a specific filter instance: | |
| 17252 | +@example | |
| 17253 | +asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my | |
| 17254 | +@end example | |
| 17255 | + | |
| 17249 | 17256 | @item |
| 17250 | 17257 | Specify a list of drawtext and hue commands in a file. |
| 17251 | 17258 | @example |
| @@ -88,20 +88,36 @@ static char *parse_link_name(const char **buf, void *log_ctx) · 87 unmodified lines | ||
| 88 | 88 | * @param filt_ctx put here a filter context in case of successful creation and configuration, NULL otherwise. |
| 89 | 89 | * @param ctx the filtergraph context |
| 90 | 90 | * @param index an index which is supposed to be unique for each filter instance added to the filtergraph |
| 91 | − * @param filt_name the name of the filter to create | |
| 91 | + * @param name the name of the filter to create, can be filter name or filter_name\@id as instance name | |
| 92 | 92 | * @param args the arguments provided to the filter during its initialization |
| 93 | 93 | * @param log_ctx the log context to use |
| 94 | 94 | * @return >= 0 in case of success, a negative AVERROR code otherwise |
| 95 | 95 | */ |
| 96 | 96 | static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int index, |
| 97 | − const char *filt_name, const char *args, void *log_ctx) | |
| 97 | + const char *name, const char *args, void *log_ctx) | |
| 98 | 98 | { |
| 99 | 99 | AVFilter *filt; |
| 100 | − char inst_name[30]; | |
| 100 | + char name2[30]; | |
| 101 | + const char *inst_name = NULL, *filt_name = NULL; | |
| 101 | 102 | char *tmp_args = NULL; |
| 102 | − int ret; | |
| 103 | + int ret, k; | |
| 104 | + | |
| 105 | + av_strlcpy(name2, name, sizeof(name2)); | |
| 106 | + | |
| 107 | + for (k = 0; name2[k]; k++) { | |
| 108 | + if (name2[k] == '@' && name[k+1]) { | |
| 109 | + name2[k] = 0; | |
| 110 | + inst_name = name; | |
| 111 | + filt_name = name2; | |
| 112 | + break; | |
| 113 | + } | |
| 114 | + } | |
| 103 | 115 | |
| 104 | − snprintf(inst_name, sizeof(inst_name), "Parsed_%s_%d", filt_name, index); | |
| 116 | + if (!inst_name) { | |
| 117 | + snprintf(name2, sizeof(name2), "Parsed_%s_%d", name, index); | |
| 118 | + inst_name = name2; | |
| 119 | + filt_name = name; | |
| 120 | + } | |
| 105 | 121 | |
| 106 | 122 | filt = avfilter_get_by_name(filt_name); |
| 107 | 123 | |