diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-08-28 20:46:31 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-08-29 20:16:01 +0200 |
commit | 1e5014c7c7dee0efe026eacafe80a967f04892c8 (patch) | |
tree | 6278c5228b23d956c4b4084432deed4183309eb7 /libavfilter/avfiltergraph.c | |
parent | 4becc8613967869e3fdb748ae7939d849c672500 (diff) | |
download | ffmpeg-1e5014c7c7dee0efe026eacafe80a967f04892c8.tar.gz |
avfilter: Add command passing support
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/avfiltergraph.c')
-rw-r--r-- | libavfilter/avfiltergraph.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 8756e42bd4..f9ae1cd1ef 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -253,3 +253,33 @@ int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx) return 0; } + +int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags) +{ + int i, r = AVERROR(ENOSYS); + + if(!graph) + return r; + + if((flags & AVFILTER_CMD_FLAG_ONE) && !(flags & AVFILTER_CMD_FLAG_FAST)) { + r=avfilter_graph_send_command(graph, target, cmd, arg, res, res_len, flags | AVFILTER_CMD_FLAG_FAST); + if(r != AVERROR(ENOSYS)) + return r; + } + + if(res_len && res) + res[0]= 0; + + for (i = 0; i < graph->filter_count; i++) { + AVFilterContext *filter = graph->filters[i]; + if(!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name)){ + r = avfilter_process_command(filter, cmd, arg, res, res_len, flags); + if(r != AVERROR(ENOSYS)) { + if((flags & AVFILTER_CMD_FLAG_ONE) || r<0) + return r; + } + } + } + + return r; +} |