forked from FFmpeg/FFmpeg
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.
This commit is contained in:
parent
5efbeae38c
commit
838bd73139
8 changed files with 83 additions and 37 deletions
|
@ -15,6 +15,10 @@ libavutil: 2012-10-22
|
|||
|
||||
API changes, most recent first:
|
||||
|
||||
2013-07-03 - xxxxxxx - lavfi 3.78.100 - avfilter.h
|
||||
Deprecate avfilter_graph_parse() in favor of the equivalent
|
||||
avfilter_graph_parse_ptr().
|
||||
|
||||
2013-06-xx - xxxxxxx - lavc 55.10.0 - avcodec.h
|
||||
Add MPEG-2 AAC profiles
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ static int init_filters(const char *filters_descr)
|
|||
inputs->pad_idx = 0;
|
||||
inputs->next = NULL;
|
||||
|
||||
if ((ret = avfilter_graph_parse(filter_graph, filters_descr,
|
||||
if ((ret = avfilter_graph_parse_ptr(filter_graph, filters_descr,
|
||||
&inputs, &outputs, NULL)) < 0)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ static int init_filters(const char *filters_descr)
|
|||
inputs->pad_idx = 0;
|
||||
inputs->next = NULL;
|
||||
|
||||
if ((ret = avfilter_graph_parse(filter_graph, filters_descr,
|
||||
if ((ret = avfilter_graph_parse_ptr(filter_graph, filters_descr,
|
||||
&inputs, &outputs, NULL)) < 0)
|
||||
return ret;
|
||||
|
||||
|
|
2
ffplay.c
2
ffplay.c
|
@ -1737,7 +1737,7 @@ static int configure_filtergraph(AVFilterGraph *graph, const char *filtergraph,
|
|||
inputs->pad_idx = 0;
|
||||
inputs->next = NULL;
|
||||
|
||||
if ((ret = avfilter_graph_parse(graph, filtergraph, &inputs, &outputs, NULL)) < 0)
|
||||
if ((ret = avfilter_graph_parse_ptr(graph, filtergraph, &inputs, &outputs, NULL)) < 0)
|
||||
goto fail;
|
||||
} else {
|
||||
if ((ret = avfilter_link(source_ctx, 0, sink_ctx, 0)) < 0)
|
||||
|
|
|
@ -141,7 +141,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
|
|||
if (!(lavfi->graph = avfilter_graph_alloc()))
|
||||
FAIL(AVERROR(ENOMEM));
|
||||
|
||||
if ((ret = avfilter_graph_parse(lavfi->graph, lavfi->graph_str,
|
||||
if ((ret = avfilter_graph_parse_ptr(lavfi->graph, lavfi->graph_str,
|
||||
&input_links, &output_links, avctx)) < 0)
|
||||
FAIL(ret);
|
||||
|
||||
|
|
|
@ -1311,6 +1311,49 @@ 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.
|
||||
*
|
||||
* @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
|
||||
* @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.
|
||||
*
|
||||
|
@ -1324,9 +1367,9 @@ void avfilter_inout_free(AVFilterInOut **inout);
|
|||
* 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(AVFilterGraph *graph, const char *filters,
|
||||
AVFilterInOut **inputs, AVFilterInOut **outputs,
|
||||
void *log_ctx);
|
||||
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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue