Commit 6119b23a authored by Stefano Sabatini's avatar Stefano Sabatini

avfiltergraph: change the syntax of avfilter_graph_parse()

Make it returns the list of open inputs and outputs, so it can be
reused by applications.

Breaks API/ABI.
parent 86909dd5
...@@ -13,6 +13,9 @@ libavutil: 2011-04-18 ...@@ -13,6 +13,9 @@ libavutil: 2011-04-18
API changes, most recent first: API changes, most recent first:
2011-06-12 - xxxxxxx - lavfi 2.16.0 - avfilter_graph_parse()
Change avfilter_graph_parse() signature.
2011-06-xx - xxxxxxx - lavu 51.6.0 - opt.h 2011-06-xx - xxxxxxx - lavu 51.6.0 - opt.h
Add av_opt_flag_is_set(). Add av_opt_flag_is_set().
......
...@@ -418,7 +418,7 @@ static int configure_video_filters(AVInputStream *ist, AVOutputStream *ost) ...@@ -418,7 +418,7 @@ static int configure_video_filters(AVInputStream *ist, AVOutputStream *ost)
inputs->pad_idx = 0; inputs->pad_idx = 0;
inputs->next = NULL; inputs->next = NULL;
if ((ret = avfilter_graph_parse(ost->graph, ost->avfilter, inputs, outputs, NULL)) < 0) if ((ret = avfilter_graph_parse(ost->graph, ost->avfilter, &inputs, &outputs, NULL)) < 0)
return ret; return ret;
av_freep(&ost->avfilter); av_freep(&ost->avfilter);
} else { } else {
......
...@@ -1708,7 +1708,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c ...@@ -1708,7 +1708,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
inputs->pad_idx = 0; inputs->pad_idx = 0;
inputs->next = NULL; inputs->next = NULL;
if ((ret = avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL)) < 0) if ((ret = avfilter_graph_parse(graph, vfilters, &inputs, &outputs, NULL)) < 0)
goto the_end; goto the_end;
av_freep(&vfilters); av_freep(&vfilters);
} else { } else {
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#include "libavutil/samplefmt.h" #include "libavutil/samplefmt.h"
#define LIBAVFILTER_VERSION_MAJOR 2 #define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 15 #define LIBAVFILTER_VERSION_MINOR 16
#define LIBAVFILTER_VERSION_MICRO 1 #define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \ LIBAVFILTER_VERSION_MINOR, \
......
...@@ -112,12 +112,14 @@ typedef struct AVFilterInOut { ...@@ -112,12 +112,14 @@ typedef struct AVFilterInOut {
* *
* @param graph the filter graph where to link the parsed graph context * @param graph the filter graph where to link the parsed graph context
* @param filters string to be parsed * @param filters string to be parsed
* @param inputs linked list to the inputs of the graph * @param inputs linked list to the inputs of the graph, may be NULL.
* @param outputs linked list to the outputs of the graph * It is updated to contain the list of open inputs after the parsing.
* @param outputs linked list to the outputs of the graph, may be NULL.
* It is updated to contain the list of open outputs after the parsing.
* @return zero on success, a negative AVERROR code on error * @return zero on success, a negative AVERROR code on error
*/ */
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
AVFilterInOut *inputs, AVFilterInOut *outputs, AVFilterInOut **inputs, AVFilterInOut **outputs,
void *log_ctx); void *log_ctx);
#endif /* AVFILTER_AVFILTERGRAPH_H */ #endif /* AVFILTER_AVFILTERGRAPH_H */
...@@ -328,8 +328,8 @@ static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs, ...@@ -328,8 +328,8 @@ static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs,
} }
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
AVFilterInOut *open_inputs, AVFilterInOut **open_inputs, AVFilterInOut **open_outputs,
AVFilterInOut *open_outputs, void *log_ctx) void *log_ctx)
{ {
int index = 0, ret; int index = 0, ret;
char chr = 0; char chr = 0;
...@@ -341,7 +341,7 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, ...@@ -341,7 +341,7 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
const char *filterchain = filters; const char *filterchain = filters;
filters += strspn(filters, WHITESPACES); filters += strspn(filters, WHITESPACES);
if ((ret = parse_inputs(&filters, &curr_inputs, &open_outputs, log_ctx)) < 0) if ((ret = parse_inputs(&filters, &curr_inputs, open_outputs, log_ctx)) < 0)
goto fail; goto fail;
if ((ret = parse_filter(&filter, &filters, graph, index, log_ctx)) < 0) if ((ret = parse_filter(&filter, &filters, graph, index, log_ctx)) < 0)
...@@ -350,14 +350,14 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, ...@@ -350,14 +350,14 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
if (filter->input_count == 1 && !curr_inputs && !index) { if (filter->input_count == 1 && !curr_inputs && !index) {
/* First input can be omitted if it is "[in]" */ /* First input can be omitted if it is "[in]" */
const char *tmp = "[in]"; const char *tmp = "[in]";
if ((ret = parse_inputs(&tmp, &curr_inputs, &open_outputs, log_ctx)) < 0) if ((ret = parse_inputs(&tmp, &curr_inputs, open_outputs, log_ctx)) < 0)
goto fail; goto fail;
} }
if ((ret = link_filter_inouts(filter, &curr_inputs, &open_inputs, log_ctx)) < 0) if ((ret = link_filter_inouts(filter, &curr_inputs, open_inputs, log_ctx)) < 0)
goto fail; goto fail;
if ((ret = parse_outputs(&filters, &curr_inputs, &open_inputs, &open_outputs, if ((ret = parse_outputs(&filters, &curr_inputs, open_inputs, open_outputs,
log_ctx)) < 0) log_ctx)) < 0)
goto fail; goto fail;
...@@ -382,10 +382,10 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, ...@@ -382,10 +382,10 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
goto fail; goto fail;
} }
if (open_inputs && !strcmp(open_inputs->name, "out") && curr_inputs) { if (*open_inputs && !strcmp((*open_inputs)->name, "out") && curr_inputs) {
/* Last output can be omitted if it is "[out]" */ /* Last output can be omitted if it is "[out]" */
const char *tmp = "[out]"; const char *tmp = "[out]";
if ((ret = parse_outputs(&tmp, &curr_inputs, &open_inputs, &open_outputs, if ((ret = parse_outputs(&tmp, &curr_inputs, open_inputs, open_outputs,
log_ctx)) < 0) log_ctx)) < 0)
goto fail; goto fail;
} }
...@@ -396,8 +396,8 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, ...@@ -396,8 +396,8 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
for (; graph->filter_count > 0; graph->filter_count--) for (; graph->filter_count > 0; graph->filter_count--)
avfilter_free(graph->filters[graph->filter_count - 1]); avfilter_free(graph->filters[graph->filter_count - 1]);
av_freep(&graph->filters); av_freep(&graph->filters);
free_inout(open_inputs); free_inout(*open_inputs);
free_inout(open_outputs); free_inout(*open_outputs);
free_inout(curr_inputs); free_inout(curr_inputs);
return ret; return ret;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment