1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

avfiltergraph: replace AVFilterGraph.filter_count with nb_filters

This is more consistent with the naming in the rest of Libav.
This commit is contained in:
Anton Khirnov 2013-02-25 12:12:36 +01:00
parent 556aab8f11
commit 42c7c61ab2
5 changed files with 32 additions and 20 deletions

View File

@ -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

View File

@ -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++) {

View File

@ -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;
/**

View File

@ -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);

View File

@ -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, \