summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-02-25 12:12:36 +0100
committerAnton Khirnov <anton@khirnov.net>2013-03-16 05:33:23 +0100
commit42c7c61ab25809620b8c8809b3da73e25f5bbaaf (patch)
tree9cc267ffd8a0aad4e6fb50c04a6fa81bb6451bf2
parent556aab8f11b045a21182eee32413aa78d5c8539b (diff)
avfiltergraph: replace AVFilterGraph.filter_count with nb_filters
This is more consistent with the naming in the rest of Libav.
-rw-r--r--doc/APIchanges3
-rw-r--r--libavfilter/avfiltergraph.c30
-rw-r--r--libavfilter/avfiltergraph.h9
-rw-r--r--libavfilter/graphparser.c8
-rw-r--r--libavfilter/version.h2
5 files changed, 32 insertions, 20 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index 0d317fcaa6..2c08af44af 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2012-10-22
API changes, most recent first:
+2013-xx-xx - lavfi 3.6.0
+ Add AVFilterGraph.nb_filters, deprecate AVFilterGraph.filter_count.
+
2013-03-xx - Reference counted buffers - lavu 52.8.0, lavc 55.0.0, lavf 55.0.0,
lavd 54.0.0, lavfi 3.5.0
xxxxxxx, xxxxxxx - add a new API for reference counted buffers and buffer
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 09b32f3f42..7bbfc1ceb4 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -50,8 +50,8 @@ void avfilter_graph_free(AVFilterGraph **graph)
{
if (!*graph)
return;
- for (; (*graph)->filter_count > 0; (*graph)->filter_count--)
- avfilter_free((*graph)->filters[(*graph)->filter_count - 1]);
+ for (; (*graph)->nb_filters > 0; (*graph)->nb_filters--)
+ avfilter_free((*graph)->filters[(*graph)->nb_filters - 1]);
av_freep(&(*graph)->scale_sws_opts);
av_freep(&(*graph)->resample_lavr_opts);
av_freep(&(*graph)->filters);
@@ -61,12 +61,12 @@ void avfilter_graph_free(AVFilterGraph **graph)
int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
{
AVFilterContext **filters = av_realloc(graph->filters,
- sizeof(AVFilterContext*) * (graph->filter_count+1));
+ sizeof(AVFilterContext*) * (graph->nb_filters + 1));
if (!filters)
return AVERROR(ENOMEM);
graph->filters = filters;
- graph->filters[graph->filter_count++] = filter;
+ graph->filters[graph->nb_filters++] = filter;
return 0;
}
@@ -105,7 +105,7 @@ static int graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
AVFilterContext *filt;
int i, j;
- for (i = 0; i < graph->filter_count; i++) {
+ for (i = 0; i < graph->nb_filters; i++) {
filt = graph->filters[i];
for (j = 0; j < filt->nb_inputs; j++) {
@@ -140,7 +140,7 @@ static int graph_config_links(AVFilterGraph *graph, AVClass *log_ctx)
AVFilterContext *filt;
int i, ret;
- for (i=0; i < graph->filter_count; i++) {
+ for (i = 0; i < graph->nb_filters; i++) {
filt = graph->filters[i];
if (!filt->nb_outputs) {
@@ -156,7 +156,7 @@ AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name)
{
int i;
- for (i = 0; i < graph->filter_count; i++)
+ for (i = 0; i < graph->nb_filters; i++)
if (graph->filters[i]->name && !strcmp(name, graph->filters[i]->name))
return graph->filters[i];
@@ -169,7 +169,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
int scaler_count = 0, resampler_count = 0;
/* ask all the sub-filters for their supported media formats */
- for (i = 0; i < graph->filter_count; i++) {
+ for (i = 0; i < graph->nb_filters; i++) {
if (graph->filters[i]->filter->query_formats)
graph->filters[i]->filter->query_formats(graph->filters[i]);
else
@@ -177,7 +177,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
}
/* go through and merge as many format lists as possible */
- for (i = 0; i < graph->filter_count; i++) {
+ for (i = 0; i < graph->nb_filters; i++) {
AVFilterContext *filter = graph->filters[i];
for (j = 0; j < filter->nb_inputs; j++) {
@@ -377,7 +377,7 @@ static void reduce_formats(AVFilterGraph *graph)
do {
reduced = 0;
- for (i = 0; i < graph->filter_count; i++)
+ for (i = 0; i < graph->nb_filters; i++)
reduced |= reduce_formats_on_filter(graph->filters[i]);
} while (reduced);
}
@@ -425,7 +425,7 @@ static void swap_samplerates(AVFilterGraph *graph)
{
int i;
- for (i = 0; i < graph->filter_count; i++)
+ for (i = 0; i < graph->nb_filters; i++)
swap_samplerates_on_filter(graph->filters[i]);
}
@@ -540,7 +540,7 @@ static void swap_channel_layouts(AVFilterGraph *graph)
{
int i;
- for (i = 0; i < graph->filter_count; i++)
+ for (i = 0; i < graph->nb_filters; i++)
swap_channel_layouts_on_filter(graph->filters[i]);
}
@@ -608,7 +608,7 @@ static void swap_sample_fmts(AVFilterGraph *graph)
{
int i;
- for (i = 0; i < graph->filter_count; i++)
+ for (i = 0; i < graph->nb_filters; i++)
swap_sample_fmts_on_filter(graph->filters[i]);
}
@@ -617,7 +617,7 @@ static int pick_formats(AVFilterGraph *graph)
{
int i, j, ret;
- for (i = 0; i < graph->filter_count; i++) {
+ for (i = 0; i < graph->nb_filters; i++) {
AVFilterContext *filter = graph->filters[i];
for (j = 0; j < filter->nb_inputs; j++)
@@ -664,7 +664,7 @@ static int graph_insert_fifos(AVFilterGraph *graph, AVClass *log_ctx)
int i, j, ret;
int fifo_count = 0;
- for (i = 0; i < graph->filter_count; i++) {
+ for (i = 0; i < graph->nb_filters; i++) {
f = graph->filters[i];
for (j = 0; j < f->nb_inputs; j++) {
diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h
index 62308982d0..9859389390 100644
--- a/libavfilter/avfiltergraph.h
+++ b/libavfilter/avfiltergraph.h
@@ -27,11 +27,20 @@
typedef struct AVFilterGraph {
const AVClass *av_class;
+#if FF_API_FOO_COUNT
+ attribute_deprecated
unsigned filter_count;
+#endif
AVFilterContext **filters;
+#if !FF_API_FOO_COUNT
+ unsigned nb_filters;
+#endif
char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters
char *resample_lavr_opts; ///< libavresample options to use for the auto-inserted resample filters
+#if FF_API_FOO_COUNT
+ unsigned nb_filters;
+#endif
} AVFilterGraph;
/**
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
index d48828ea24..ea0a86d51a 100644
--- a/libavfilter/graphparser.c
+++ b/libavfilter/graphparser.c
@@ -435,8 +435,8 @@ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
return 0;
fail:
- for (; graph->filter_count > 0; graph->filter_count--)
- avfilter_free(graph->filters[graph->filter_count - 1]);
+ for (; graph->nb_filters > 0; graph->nb_filters--)
+ avfilter_free(graph->filters[graph->nb_filters - 1]);
av_freep(&graph->filters);
avfilter_inout_free(&open_inputs);
avfilter_inout_free(&open_outputs);
@@ -500,8 +500,8 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
fail:
if (ret < 0) {
- for (; graph->filter_count > 0; graph->filter_count--)
- avfilter_free(graph->filters[graph->filter_count - 1]);
+ for (; graph->nb_filters > 0; graph->nb_filters--)
+ avfilter_free(graph->filters[graph->nb_filters - 1]);
av_freep(&graph->filters);
}
avfilter_inout_free(&inputs);
diff --git a/libavfilter/version.h b/libavfilter/version.h
index a07af2bff6..1a5ec42916 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -29,7 +29,7 @@
#include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 3
-#define LIBAVFILTER_VERSION_MINOR 5
+#define LIBAVFILTER_VERSION_MINOR 6
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \