History

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

Michael Niedermayer committed 13 years ago

Commit ecade982 parents 8a0187e 42c7c617 files · +42 −30Browse files

Unified · Split

7 files
  1. doc/APIchanges +3 −0
  2. libavfilter/avfiltergraph.c +20 −20
  3. libavfilter/avfiltergraph.h +10 −1
  4. libavfilter/graphdump.c +1 −1
  5. libavfilter/graphparser.c +6 −6
  6. libavfilter/version.h +1 −1
  7. tools/graph2dot.c +1 −1
doc/APIchanges+3−0
@@ -144,6 +144,9 @@ API changes, most recent first: · 143 unmodified lines
144144 2012-03-26 - a67d9cf - lavfi 2.66.100
145145 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
146146
147+2013-xx-xx - lavfi 3.6.0
148+ Add AVFilterGraph.nb_filters, deprecate AVFilterGraph.filter_count.
149+
147150 2013-03-xx - Reference counted buffers - lavu 52.8.0, lavc 55.0.0, lavf 55.0.0,
148151 lavd 54.0.0, lavfi 3.5.0
149152 xxxxxxx, xxxxxxx - add a new API for reference counted buffers and buffer
libavfilter/avfiltergraph.c+20−20
@@ -62,8 +62,8 @@ void avfilter_graph_free(AVFilterGraph **graph) · 61 unmodified lines
6262 {
6363 if (!*graph)
6464 return;
65− for (; (*graph)->filter_count > 0; (*graph)->filter_count--)
66− avfilter_free((*graph)->filters[(*graph)->filter_count - 1]);
65+ for (; (*graph)->nb_filters > 0; (*graph)->nb_filters--)
66+ avfilter_free((*graph)->filters[(*graph)->nb_filters - 1]);
6767 av_freep(&(*graph)->sink_links);
6868 av_freep(&(*graph)->scale_sws_opts);
6969 av_freep(&(*graph)->aresample_swr_opts);
@@ -75,12 +75,12 @@ void avfilter_graph_free(AVFilterGraph **graph) · 5 unmodified lines
7575 int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
7676 {
7777 AVFilterContext **filters = av_realloc(graph->filters,
78− sizeof(AVFilterContext*) * (graph->filter_count+1));
78+ sizeof(AVFilterContext*) * (graph->nb_filters + 1));
7979 if (!filters)
8080 return AVERROR(ENOMEM);
8181
8282 graph->filters = filters;
83− graph->filters[graph->filter_count++] = filter;
83+ graph->filters[graph->nb_filters++] = filter;
8484
8585 return 0;
8686 }
@@ -124,7 +124,7 @@ static int graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx) · 37 unmodified lines
124124 AVFilterContext *filt;
125125 int i, j;
126126
127− for (i = 0; i < graph->filter_count; i++) {
127+ for (i = 0; i < graph->nb_filters; i++) {
128128 const AVFilterPad *pad;
129129 filt = graph->filters[i];
130130
@@ -162,7 +162,7 @@ static int graph_config_links(AVFilterGraph *graph, AVClass *log_ctx) · 31 unmodified lines
162162 AVFilterContext *filt;
163163 int i, ret;
164164
165− for (i=0; i < graph->filter_count; i++) {
165+ for (i = 0; i < graph->nb_filters; i++) {
166166 filt = graph->filters[i];
167167
168168 if (!filt->nb_outputs) {
@@ -178,7 +178,7 @@ AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name) · 9 unmodified lines
178178 {
179179 int i;
180180
181− for (i = 0; i < graph->filter_count; i++)
181+ for (i = 0; i < graph->nb_filters; i++)
182182 if (graph->filters[i]->name && !strcmp(name, graph->filters[i]->name))
183183 return graph->filters[i];
184184
@@ -245,7 +245,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 60 unmodified lines
245245
246246 for (j = 0; j < 2; j++) {
247247 /* ask all the sub-filters for their supported media formats */
248− for (i = 0; i < graph->filter_count; i++) {
248+ for (i = 0; i < graph->nb_filters; i++) {
249249 /* Call query_formats on sources first.
250250 This is a temporary workaround for amerge,
251251 until format renegociation is implemented. */
@@ -261,7 +261,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 9 unmodified lines
261261 }
262262
263263 /* go through and merge as many format lists as possible */
264− for (i = 0; i < graph->filter_count; i++) {
264+ for (i = 0; i < graph->nb_filters; i++) {
265265 AVFilterContext *filter = graph->filters[i];
266266
267267 for (j = 0; j < filter->nb_inputs; j++) {
@@ -519,7 +519,7 @@ static void reduce_formats(AVFilterGraph *graph) · 251 unmodified lines
519519 do {
520520 reduced = 0;
521521
522− for (i = 0; i < graph->filter_count; i++)
522+ for (i = 0; i < graph->nb_filters; i++)
523523 reduced |= reduce_formats_on_filter(graph->filters[i]);
524524 } while (reduced);
525525 }
@@ -567,7 +567,7 @@ static void swap_samplerates(AVFilterGraph *graph) · 41 unmodified lines
567567 {
568568 int i;
569569
570− for (i = 0; i < graph->filter_count; i++)
570+ for (i = 0; i < graph->nb_filters; i++)
571571 swap_samplerates_on_filter(graph->filters[i]);
572572 }
573573
@@ -698,7 +698,7 @@ static void swap_channel_layouts(AVFilterGraph *graph) · 124 unmodified lines
698698 {
699699 int i;
700700
701− for (i = 0; i < graph->filter_count; i++)
701+ for (i = 0; i < graph->nb_filters; i++)
702702 swap_channel_layouts_on_filter(graph->filters[i]);
703703 }
704704
@@ -766,7 +766,7 @@ static void swap_sample_fmts(AVFilterGraph *graph) · 61 unmodified lines
766766 {
767767 int i;
768768
769− for (i = 0; i < graph->filter_count; i++)
769+ for (i = 0; i < graph->nb_filters; i++)
770770 swap_sample_fmts_on_filter(graph->filters[i]);
771771
772772 }
@@ -778,7 +778,7 @@ static int pick_formats(AVFilterGraph *graph) · 5 unmodified lines
778778
779779 do{
780780 change = 0;
781− for (i = 0; i < graph->filter_count; i++) {
781+ for (i = 0; i < graph->nb_filters; i++) {
782782 AVFilterContext *filter = graph->filters[i];
783783 if (filter->nb_inputs){
784784 for (j = 0; j < filter->nb_inputs; j++){
@@ -810,7 +810,7 @@ static int pick_formats(AVFilterGraph *graph) · 25 unmodified lines
810810 }
811811 }while(change);
812812
813− for (i = 0; i < graph->filter_count; i++) {
813+ for (i = 0; i < graph->nb_filters; i++) {
814814 AVFilterContext *filter = graph->filters[i];
815815
816816 for (j = 0; j < filter->nb_inputs; j++)
@@ -859,7 +859,7 @@ static int ff_avfilter_graph_config_pointers(AVFilterGraph *graph, · 42 unmodified lines
859859 AVFilterContext *f;
860860 AVFilterLink **sinks;
861861
862− for (i = 0; i < graph->filter_count; i++) {
862+ for (i = 0; i < graph->nb_filters; i++) {
863863 f = graph->filters[i];
864864 for (j = 0; j < f->nb_inputs; j++) {
865865 f->inputs[j]->graph = graph;
@@ -878,7 +878,7 @@ static int ff_avfilter_graph_config_pointers(AVFilterGraph *graph, · 12 unmodified lines
878878 sinks = av_calloc(sink_links_count, sizeof(*sinks));
879879 if (!sinks)
880880 return AVERROR(ENOMEM);
881− for (i = 0; i < graph->filter_count; i++) {
881+ for (i = 0; i < graph->nb_filters; i++) {
882882 f = graph->filters[i];
883883 if (!f->nb_outputs) {
884884 for (j = 0; j < f->nb_inputs; j++) {
@@ -899,7 +899,7 @@ static int graph_insert_fifos(AVFilterGraph *graph, AVClass *log_ctx) · 14 unmodified lines
899899 int i, j, ret;
900900 int fifo_count = 0;
901901
902− for (i = 0; i < graph->filter_count; i++) {
902+ for (i = 0; i < graph->nb_filters; i++) {
903903 f = graph->filters[i];
904904
905905 for (j = 0; j < f->nb_inputs; j++) {
@@ -965,7 +965,7 @@ int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const · 59 unmodified lines
965965 if(res_len && res)
966966 res[0]= 0;
967967
968− for (i = 0; i < graph->filter_count; i++) {
968+ for (i = 0; i < graph->nb_filters; i++) {
969969 AVFilterContext *filter = graph->filters[i];
970970 if(!strcmp(target, "all") || (filter->name && !strcmp(target, filter->name)) || !strcmp(target, filter->filter->name)){
971971 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 · 14 unmodified lines
986986 if(!graph)
987987 return 0;
988988
989− for (i = 0; i < graph->filter_count; i++) {
989+ for (i = 0; i < graph->nb_filters; i++) {
990990 AVFilterContext *filter = graph->filters[i];
991991 if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){
992992 AVFilterCommand **queue = &filter->command_queue, *next;
libavfilter/avfiltergraph.h+10−1
@@ -27,11 +27,20 @@ · 26 unmodified lines
2727
2828 typedef struct AVFilterGraph {
2929 const AVClass *av_class;
30− unsigned filter_count;
30+#if FF_API_FOO_COUNT
31+ attribute_deprecated
32+ unsigned filter_count_unused;
33+#endif
3134 AVFilterContext **filters;
35+#if !FF_API_FOO_COUNT
36+ unsigned nb_filters;
37+#endif
3238
3339 char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters
3440 char *resample_lavr_opts; ///< libavresample options to use for the auto-inserted resample filters
41+#if FF_API_FOO_COUNT
42+ unsigned nb_filters;
43+#endif
3544 char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions
3645
3746 /**
libavfilter/graphdump.c+1−1
@@ -62,7 +62,7 @@ static void avfilter_graph_dump_to_buf(AVBPrint *buf, AVFilterGraph *graph) · 61 unmodified lines
6262 {
6363 unsigned i, j, x, e;
6464
65− for (i = 0; i < graph->filter_count; i++) {
65+ for (i = 0; i < graph->nb_filters; i++) {
6666 AVFilterContext *filter = graph->filters[i];
6767 unsigned max_src_name = 0, max_dst_name = 0;
6868 unsigned max_in_name = 0, max_out_name = 0;
libavfilter/graphparser.c+6−6
@@ -436,8 +436,8 @@ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, · 435 unmodified lines
436436 return 0;
437437
438438 fail:end:
439− for (; graph->filter_count > 0; graph->filter_count--)
440− avfilter_free(graph->filters[graph->filter_count - 1]);
439+ for (; graph->nb_filters > 0; graph->nb_filters--)
440+ avfilter_free(graph->filters[graph->nb_filters - 1]);
441441 av_freep(&graph->filters);
442442 avfilter_inout_free(&open_inputs);
443443 avfilter_inout_free(&open_outputs);
@@ -504,8 +504,8 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, · 60 unmodified lines
504504
505505 fail:
506506 if (ret < 0) {
507− for (; graph->filter_count > 0; graph->filter_count--)
508− avfilter_free(graph->filters[graph->filter_count - 1]);
507+ for (; graph->nb_filters > 0; graph->nb_filters--)
508+ avfilter_free(graph->filters[graph->nb_filters - 1]);
509509 av_freep(&graph->filters);
510510 }
511511 avfilter_inout_free(&inputs);
@@ -591,8 +591,8 @@ end: · 79 unmodified lines
591591 avfilter_inout_free(&curr_inputs);
592592
593593 if (ret < 0) {
594− for (; graph->filter_count > 0; graph->filter_count--)
595− avfilter_free(graph->filters[graph->filter_count - 1]);
594+ for (; graph->nb_filters > 0; graph->nb_filters--)
595+ avfilter_free(graph->filters[graph->nb_filters - 1]);
596596 av_freep(&graph->filters);
597597 }
598598 return ret;
libavfilter/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 #include "libavutil/avutil.h"
3030
3131 #define LIBAVFILTER_VERSION_MAJOR 3
32−#define LIBAVFILTER_VERSION_MINOR 46
32+#define LIBAVFILTER_VERSION_MINOR 47
3333 #define LIBAVFILTER_VERSION_MICRO 100
3434
3535 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
tools/graph2dot.c+1−1
@@ -58,7 +58,7 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph) · 57 unmodified lines
5858 fprintf(outfile, "node [shape=box]\n");
5959 fprintf(outfile, "rankdir=LR\n");
6060
61− for (i = 0; i < graph->filter_count; i++) {
61+ for (i = 0; i < graph->nb_filters; i++) {
6262 char filter_ctx_label[128];
6363 const AVFilterContext *filter_ctx = graph->filters[i];
6464

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t