Showing the changes to libavfilter/avfiltergraph.c (1 of 4 files). Show all
Unified · Split
| @@ -253,3 +253,33 @@ int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx) · 252 unmodified lines | ||
| 253 | 253 | |
| 254 | 254 | return 0; |
| 255 | 255 | } |
| 256 | + | |
| 257 | +int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags) | |
| 258 | +{ | |
| 259 | + int i, r = AVERROR(ENOSYS); | |
| 260 | + | |
| 261 | + if(!graph) | |
| 262 | + return r; | |
| 263 | + | |
| 264 | + if((flags & AVFILTER_CMD_FLAG_ONE) && !(flags & AVFILTER_CMD_FLAG_FAST)) { | |
| 265 | + r=avfilter_graph_send_command(graph, target, cmd, arg, res, res_len, flags | AVFILTER_CMD_FLAG_FAST); | |
| 266 | + if(r != AVERROR(ENOSYS)) | |
| 267 | + return r; | |
| 268 | + } | |
| 269 | + | |
| 270 | + if(res_len && res) | |
| 271 | + res[0]= 0; | |
| 272 | + | |
| 273 | + for (i = 0; i < graph->filter_count; i++) { | |
| 274 | + AVFilterContext *filter = graph->filters[i]; | |
| 275 | + if(!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name)){ | |
| 276 | + r = avfilter_process_command(filter, cmd, arg, res, res_len, flags); | |
| 277 | + if(r != AVERROR(ENOSYS)) { | |
| 278 | + if((flags & AVFILTER_CMD_FLAG_ONE) || r<0) | |
| 279 | + return r; | |
| 280 | + } | |
| 281 | + } | |
| 282 | + } | |
| 283 | + | |
| 284 | + return r; | |
| 285 | +} | |