Merge commit '42c7c61ab25809620b8c8809b3da73e25f5bbaaf'

* commit '42c7c61ab25809620b8c8809b3da73e25f5bbaaf':
  avfiltergraph: replace AVFilterGraph.filter_count with nb_filters

Conflicts:
	doc/APIchanges
	libavfilter/avfiltergraph.c
	libavfilter/avfiltergraph.h
	libavfilter/graphparser.c
	libavfilter/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
pull/11/merge
Michael Niedermayer 12 years ago
commit ecade984ac
  1. 3
      doc/APIchanges
  2. 40
      libavfilter/avfiltergraph.c
  3. 11
      libavfilter/avfiltergraph.h
  4. 2
      libavfilter/graphdump.c
  5. 12
      libavfilter/graphparser.c
  6. 2
      libavfilter/version.h
  7. 2
      tools/graph2dot.c

@ -144,6 +144,9 @@ API changes, most recent first:
2012-03-26 - a67d9cf - lavfi 2.66.100
Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
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

@ -62,8 +62,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)->sink_links);
av_freep(&(*graph)->scale_sws_opts);
av_freep(&(*graph)->aresample_swr_opts);
@ -75,12 +75,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;
}
@ -124,7 +124,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++) {
const AVFilterPad *pad;
filt = graph->filters[i];
@ -162,7 +162,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) {
@ -178,7 +178,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];
@ -245,7 +245,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
for (j = 0; j < 2; j++) {
/* 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++) {
/* Call query_formats on sources first.
This is a temporary workaround for amerge,
until format renegociation is implemented. */
@ -261,7 +261,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++) {
@ -519,7 +519,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);
}
@ -567,7 +567,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]);
}
@ -698,7 +698,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]);
}
@ -766,7 +766,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]);
}
@ -778,7 +778,7 @@ static int pick_formats(AVFilterGraph *graph)
do{
change = 0;
for (i = 0; i < graph->filter_count; i++) {
for (i = 0; i < graph->nb_filters; i++) {
AVFilterContext *filter = graph->filters[i];
if (filter->nb_inputs){
for (j = 0; j < filter->nb_inputs; j++){
@ -810,7 +810,7 @@ static int pick_formats(AVFilterGraph *graph)
}
}while(change);
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++)
@ -859,7 +859,7 @@ static int ff_avfilter_graph_config_pointers(AVFilterGraph *graph,
AVFilterContext *f;
AVFilterLink **sinks;
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++) {
f->inputs[j]->graph = graph;
@ -878,7 +878,7 @@ static int ff_avfilter_graph_config_pointers(AVFilterGraph *graph,
sinks = av_calloc(sink_links_count, sizeof(*sinks));
if (!sinks)
return AVERROR(ENOMEM);
for (i = 0; i < graph->filter_count; i++) {
for (i = 0; i < graph->nb_filters; i++) {
f = graph->filters[i];
if (!f->nb_outputs) {
for (j = 0; j < f->nb_inputs; j++) {
@ -899,7 +899,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++) {
@ -965,7 +965,7 @@ int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const
if(res_len && res)
res[0]= 0;
for (i = 0; i < graph->filter_count; i++) {
for (i = 0; i < graph->nb_filters; i++) {
AVFilterContext *filter = graph->filters[i];
if(!strcmp(target, "all") || (filter->name && !strcmp(target, filter->name)) || !strcmp(target, filter->filter->name)){
r = avfilter_process_command(filter, cmd, arg, res, res_len, flags);
@ -986,7 +986,7 @@ int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const
if(!graph)
return 0;
for (i = 0; i < graph->filter_count; i++) {
for (i = 0; i < graph->nb_filters; i++) {
AVFilterContext *filter = graph->filters[i];
if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){
AVFilterCommand **queue = &filter->command_queue, *next;

@ -27,11 +27,20 @@
typedef struct AVFilterGraph {
const AVClass *av_class;
unsigned filter_count;
#if FF_API_FOO_COUNT
attribute_deprecated
unsigned filter_count_unused;
#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
char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions
/**

@ -62,7 +62,7 @@ static void avfilter_graph_dump_to_buf(AVBPrint *buf, AVFilterGraph *graph)
{
unsigned i, j, x, e;
for (i = 0; i < graph->filter_count; i++) {
for (i = 0; i < graph->nb_filters; i++) {
AVFilterContext *filter = graph->filters[i];
unsigned max_src_name = 0, max_dst_name = 0;
unsigned max_in_name = 0, max_out_name = 0;

@ -436,8 +436,8 @@ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
return 0;
fail:end:
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);
@ -504,8 +504,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);
@ -591,8 +591,8 @@ end:
avfilter_inout_free(&curr_inputs);
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);
}
return ret;

@ -29,7 +29,7 @@
#include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 46
#define LIBAVFILTER_VERSION_MINOR 47
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \

@ -58,7 +58,7 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
fprintf(outfile, "node [shape=box]\n");
fprintf(outfile, "rankdir=LR\n");
for (i = 0; i < graph->filter_count; i++) {
for (i = 0; i < graph->nb_filters; i++) {
char filter_ctx_label[128];
const AVFilterContext *filter_ctx = graph->filters[i];

Loading…
Cancel
Save