diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2013-07-02 01:39:14 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-07-03 13:21:42 +0200 |
commit | 838bd731393a29a41a86ff15ccf972f967306319 (patch) | |
tree | dc3861a36f6338bab0531b00aea8adfbcd77a2c4 /libavfilter | |
parent | 5efbeae38cdcf8ed099be06f59fb422b5004e163 (diff) | |
download | ffmpeg-838bd731393a29a41a86ff15ccf972f967306319.tar.gz |
lavfi: create Libav-API compatibility layer for avfilter_graph_parse() at the next bump
Add function avfilter_graph_parse_ptr() and favor it in place of
avfilter_graph_parse(), which will be restored with the old/Libav
signature at the next bump.
If HAVE_INCOMPATIBLE_LIBAV_API is enabled it will use the
Libav-compatible signature for avfilter_graph_parse().
At the next major bump the current implementation of
avfilter_graph_parse() should be dropped in favor of the Libav/old
implementation.
Should address trac ticket #2672.
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/avfilter.h | 65 | ||||
-rw-r--r-- | libavfilter/graphparser.c | 30 | ||||
-rw-r--r-- | libavfilter/version.h | 7 |
3 files changed, 72 insertions, 30 deletions
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 1f7da428af..0001cd7fc6 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -1311,6 +1311,29 @@ AVFilterInOut *avfilter_inout_alloc(void); */ void avfilter_inout_free(AVFilterInOut **inout); +#if HAVE_INCOMPATIBLE_LIBAV_ABI || !FF_API_OLD_GRAPH_PARSE +/** + * Add a graph described by a string to a graph. + * + * @note The caller must provide the lists of inputs and outputs, + * which therefore must be known before calling the function. + * + * @note The inputs parameter describes inputs of the already existing + * part of the graph; i.e. from the point of view of the newly created + * part, they are outputs. Similarly the outputs parameter describes + * outputs of the already existing filters, which are provided as + * inputs to the parsed filters. + * + * @param graph the filter graph where to link the parsed grap context + * @param filters string to be parsed + * @param inputs linked list to the inputs of the graph + * @param outputs linked list to the outputs of the graph + * @return zero on success, a negative AVERROR code on error + */ +int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, + AVFilterInOut *inputs, AVFilterInOut *outputs, + void *log_ctx); +#else /** * Add a graph described by a string to a graph. * @@ -1323,10 +1346,30 @@ void avfilter_inout_free(AVFilterInOut **inout); * If non-NULL, *outputs is updated to contain the list of open outputs * after the parsing, should be freed with avfilter_inout_free(). * @return non negative on success, a negative AVERROR code on error + * @deprecated Use avfilter_graph_parse_ptr() instead. */ +attribute_deprecated int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx); +#endif + +/** + * Add a graph described by a string to a graph. + * + * @param graph the filter graph where to link the parsed graph context + * @param filters string to be parsed + * @param inputs pointer to a linked list to the inputs of the graph, may be NULL. + * If non-NULL, *inputs is updated to contain the list of open inputs + * after the parsing, should be freed with avfilter_inout_free(). + * @param outputs pointer to a linked list to the outputs of the graph, may be NULL. + * If non-NULL, *outputs is updated to contain the list of open outputs + * after the parsing, should be freed with avfilter_inout_free(). + * @return non negative on success, a negative AVERROR code on error + */ +int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters, + AVFilterInOut **inputs, AVFilterInOut **outputs, + void *log_ctx); /** * Add a graph described by a string to a graph. @@ -1341,21 +1384,13 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, * caller using avfilter_inout_free(). * @return zero on success, a negative AVERROR code on error * - * @note the difference between avfilter_graph_parse2() and - * avfilter_graph_parse() is that in avfilter_graph_parse(), the caller provides - * the lists of inputs and outputs, which therefore must be known before calling - * the function. On the other hand, avfilter_graph_parse2() \em returns the - * inputs and outputs that are left unlinked after parsing the graph and the - * caller then deals with them. Another difference is that in - * avfilter_graph_parse(), the inputs parameter describes inputs of the - * <em>already existing</em> part of the graph; i.e. from the point of view of - * the newly created part, they are outputs. Similarly the outputs parameter - * describes outputs of the already existing filters, which are provided as - * inputs to the parsed filters. - * avfilter_graph_parse2() takes the opposite approach -- it makes no reference - * whatsoever to already existing parts of the graph and the inputs parameter - * will on return contain inputs of the newly parsed part of the graph. - * Analogously the outputs parameter will contain outputs of the newly created + * @note This function returns the inputs and outputs that are left + * unlinked after parsing the graph and the caller then deals with + * them. + * @note This function makes no reference whatsoever to already + * existing parts of the graph and the inputs parameter will on return + * contain inputs of the newly parsed part of the graph. Analogously + * the outputs parameter will contain outputs of the newly created * filters. */ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index 9241cf3bf2..6cf19e9860 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -447,14 +447,12 @@ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, return ret; } +#if HAVE_INCOMPATIBLE_LIBAV_ABI || !FF_API_OLD_GRAPH_PARSE int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, - AVFilterInOut **open_inputs_ptr, AVFilterInOut **open_outputs_ptr, - void *log_ctx) + AVFilterInOut *open_inputs, + AVFilterInOut *open_outputs, void *log_ctx) { -#if 0 int ret; - AVFilterInOut *open_inputs = open_inputs_ptr ? *open_inputs_ptr : NULL; - AVFilterInOut *open_outputs = open_outputs_ptr ? *open_outputs_ptr : NULL; AVFilterInOut *cur, *match, *inputs = NULL, *outputs = NULL; if ((ret = avfilter_graph_parse2(graph, filters, &inputs, &outputs)) < 0) @@ -508,14 +506,22 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, } avfilter_inout_free(&inputs); avfilter_inout_free(&outputs); - /* clear open_in/outputs only if not passed as parameters */ - if (open_inputs_ptr) *open_inputs_ptr = open_inputs; - else avfilter_inout_free(&open_inputs); - if (open_outputs_ptr) *open_outputs_ptr = open_outputs; - else avfilter_inout_free(&open_outputs); + avfilter_inout_free(&open_inputs); + avfilter_inout_free(&open_outputs); return ret; -} #else +int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, + AVFilterInOut **inputs, AVFilterInOut **outputs, + void *log_ctx) +{ + return avfilter_graph_parse_ptr(graph, filters, inputs, outputs, log_ctx); +} +#endif + +int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters, + AVFilterInOut **open_inputs_ptr, AVFilterInOut **open_outputs_ptr, + void *log_ctx) +{ int index = 0, ret = 0; char chr = 0; @@ -595,5 +601,3 @@ end: } return ret; } - -#endif diff --git a/libavfilter/version.h b/libavfilter/version.h index 1bc6b7e001..ee94f5856f 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,8 +30,8 @@ #include "libavutil/avutil.h" #define LIBAVFILTER_VERSION_MAJOR 3 -#define LIBAVFILTER_VERSION_MINOR 77 -#define LIBAVFILTER_VERSION_MICRO 101 +#define LIBAVFILTER_VERSION_MINOR 78 +#define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ LIBAVFILTER_VERSION_MINOR, \ @@ -79,5 +79,8 @@ #ifndef FF_API_OLD_FILTER_REGISTER #define FF_API_OLD_FILTER_REGISTER (LIBAVFILTER_VERSION_MAJOR < 4) #endif +#ifndef FF_API_OLD_GRAPH_PARSE +#define FF_API_OLD_GRAPH_PARSE (LIBAVFILTER_VERSION_MAJOR < 4) +#endif #endif /* AVFILTER_VERSION_H */ |