diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-16 16:09:37 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-16 16:09:37 +0100 |
commit | ecade984ac3ce5205f6276a9329e2b7bca09fa47 (patch) | |
tree | b3be8c61ad61a2ba7d12c028c48b561ae400f315 | |
parent | 8a0187e43d22527899a346034df4c7e4713f5212 (diff) | |
parent | 42c7c61ab25809620b8c8809b3da73e25f5bbaaf (diff) | |
download | ffmpeg-ecade984ac3ce5205f6276a9329e2b7bca09fa47.tar.gz |
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>
-rw-r--r-- | doc/APIchanges | 3 | ||||
-rw-r--r-- | libavfilter/avfiltergraph.c | 40 | ||||
-rw-r--r-- | libavfilter/avfiltergraph.h | 11 | ||||
-rw-r--r-- | libavfilter/graphdump.c | 2 | ||||
-rw-r--r-- | libavfilter/graphparser.c | 12 | ||||
-rw-r--r-- | libavfilter/version.h | 2 | ||||
-rw-r--r-- | tools/graph2dot.c | 2 |
7 files changed, 42 insertions, 30 deletions
diff --git a/doc/APIchanges b/doc/APIchanges index 0b2295c562..2bde666c35 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -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 diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 2764b8c85a..9b05c6d6d1 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -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; diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h index 3965412803..61110f99a1 100644 --- a/libavfilter/avfiltergraph.h +++ b/libavfilter/avfiltergraph.h @@ -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 /** diff --git a/libavfilter/graphdump.c b/libavfilter/graphdump.c index 28e9bc9789..756f63dc49 100644 --- a/libavfilter/graphdump.c +++ b/libavfilter/graphdump.c @@ -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; diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index 3e85261c38..8d2fffc194 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -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; diff --git a/libavfilter/version.h b/libavfilter/version.h index 3a2fff3bf8..3ec6f2db46 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 46 +#define LIBAVFILTER_VERSION_MINOR 47 #define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/tools/graph2dot.c b/tools/graph2dot.c index 74075c7af2..d53642f915 100644 --- a/tools/graph2dot.c +++ b/tools/graph2dot.c @@ -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]; |