* 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
Showing the changes to libavfilter/avfiltergraph.c (1 of 7 files). Show all
Unified · Split
| @@ -62,8 +62,8 @@ void avfilter_graph_free(AVFilterGraph **graph) · 61 unmodified lines | |||
| 62 | { | 62 | { |
| 63 | if (!*graph) | 63 | if (!*graph) |
| 64 | return; | 64 | return; |
| 65 | for (; (*graph)->filter_count > 0; (*graph)->filter_count--) | 65 | for (; (*graph)->nb_filters > 0; (*graph)->nb_filters--) |
| 66 | avfilter_free((*graph)->filters[(*graph)->filter_count - 1]); | 66 | avfilter_free((*graph)->filters[(*graph)->nb_filters - 1]); |
| 67 | av_freep(&(*graph)->sink_links); | 67 | av_freep(&(*graph)->sink_links); |
| 68 | av_freep(&(*graph)->scale_sws_opts); | 68 | av_freep(&(*graph)->scale_sws_opts); |
| 69 | av_freep(&(*graph)->aresample_swr_opts); | 69 | av_freep(&(*graph)->aresample_swr_opts); |
| @@ -75,12 +75,12 @@ void avfilter_graph_free(AVFilterGraph **graph) · 5 unmodified lines | |||
| 75 | int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter) | 75 | int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter) |
| 76 | { | 76 | { |
| 77 | AVFilterContext **filters = av_realloc(graph->filters, | 77 | AVFilterContext **filters = av_realloc(graph->filters, |
| 78 | sizeof(AVFilterContext*) * (graph->filter_count+1)); | 78 | sizeof(AVFilterContext*) * (graph->nb_filters + 1)); |
| 79 | if (!filters) | 79 | if (!filters) |
| 80 | return AVERROR(ENOMEM); | 80 | return AVERROR(ENOMEM); |
| 81 | 81 | ||
| 82 | graph->filters = filters; | 82 | graph->filters = filters; |
| 83 | graph->filters[graph->filter_count++] = filter; | 83 | graph->filters[graph->nb_filters++] = filter; |
| 84 | 84 | ||
| 85 | return 0; | 85 | return 0; |
| 86 | } | 86 | } |
| @@ -124,7 +124,7 @@ static int graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx) · 37 unmodified lines | |||
| 124 | AVFilterContext *filt; | 124 | AVFilterContext *filt; |
| 125 | int i, j; | 125 | int i, j; |
| 126 | 126 | ||
| 127 | for (i = 0; i < graph->filter_count; i++) { | 127 | for (i = 0; i < graph->nb_filters; i++) { |
| 128 | const AVFilterPad *pad; | 128 | const AVFilterPad *pad; |
| 129 | filt = graph->filters[i]; | 129 | filt = graph->filters[i]; |
| 130 | 130 | ||
| @@ -162,7 +162,7 @@ static int graph_config_links(AVFilterGraph *graph, AVClass *log_ctx) · 31 unmodified lines | |||
| 162 | AVFilterContext *filt; | 162 | AVFilterContext *filt; |
| 163 | int i, ret; | 163 | int i, ret; |
| 164 | 164 | ||
| 165 | for (i=0; i < graph->filter_count; i++) { | 165 | for (i = 0; i < graph->nb_filters; i++) { |
| 166 | filt = graph->filters[i]; | 166 | filt = graph->filters[i]; |
| 167 | 167 | ||
| 168 | if (!filt->nb_outputs) { | 168 | if (!filt->nb_outputs) { |
| @@ -178,7 +178,7 @@ AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name) · 9 unmodified lines | |||
| 178 | { | 178 | { |
| 179 | int i; | 179 | int i; |
| 180 | 180 | ||
| 181 | for (i = 0; i < graph->filter_count; i++) | 181 | for (i = 0; i < graph->nb_filters; i++) |
| 182 | if (graph->filters[i]->name && !strcmp(name, graph->filters[i]->name)) | 182 | if (graph->filters[i]->name && !strcmp(name, graph->filters[i]->name)) |
| 183 | return graph->filters[i]; | 183 | return graph->filters[i]; |
| 184 | 184 | ||
| @@ -245,7 +245,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 60 unmodified lines | |||
| 245 | 245 | ||
| 246 | for (j = 0; j < 2; j++) { | 246 | for (j = 0; j < 2; j++) { |
| 247 | /* ask all the sub-filters for their supported media formats */ | 247 | /* 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++) { |
| 249 | /* Call query_formats on sources first. | 249 | /* Call query_formats on sources first. |
| 250 | This is a temporary workaround for amerge, | 250 | This is a temporary workaround for amerge, |
| 251 | until format renegociation is implemented. */ | 251 | until format renegociation is implemented. */ |
| @@ -261,7 +261,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 9 unmodified lines | |||
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | /* go through and merge as many format lists as possible */ | 263 | /* 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++) { |
| 265 | AVFilterContext *filter = graph->filters[i]; | 265 | AVFilterContext *filter = graph->filters[i]; |
| 266 | 266 | ||
| 267 | for (j = 0; j < filter->nb_inputs; j++) { | 267 | for (j = 0; j < filter->nb_inputs; j++) { |
| @@ -519,7 +519,7 @@ static void reduce_formats(AVFilterGraph *graph) · 251 unmodified lines | |||
| 519 | do { | 519 | do { |
| 520 | reduced = 0; | 520 | reduced = 0; |
| 521 | 521 | ||
| 522 | for (i = 0; i < graph->filter_count; i++) | 522 | for (i = 0; i < graph->nb_filters; i++) |
| 523 | reduced |= reduce_formats_on_filter(graph->filters[i]); | 523 | reduced |= reduce_formats_on_filter(graph->filters[i]); |
| 524 | } while (reduced); | 524 | } while (reduced); |
| 525 | } | 525 | } |
| @@ -567,7 +567,7 @@ static void swap_samplerates(AVFilterGraph *graph) · 41 unmodified lines | |||
| 567 | { | 567 | { |
| 568 | int i; | 568 | int i; |
| 569 | 569 | ||
| 570 | for (i = 0; i < graph->filter_count; i++) | 570 | for (i = 0; i < graph->nb_filters; i++) |
| 571 | swap_samplerates_on_filter(graph->filters[i]); | 571 | swap_samplerates_on_filter(graph->filters[i]); |
| 572 | } | 572 | } |
| 573 | 573 | ||
| @@ -698,7 +698,7 @@ static void swap_channel_layouts(AVFilterGraph *graph) · 124 unmodified lines | |||
| 698 | { | 698 | { |
| 699 | int i; | 699 | int i; |
| 700 | 700 | ||
| 701 | for (i = 0; i < graph->filter_count; i++) | 701 | for (i = 0; i < graph->nb_filters; i++) |
| 702 | swap_channel_layouts_on_filter(graph->filters[i]); | 702 | swap_channel_layouts_on_filter(graph->filters[i]); |
| 703 | } | 703 | } |
| 704 | 704 | ||
| @@ -766,7 +766,7 @@ static void swap_sample_fmts(AVFilterGraph *graph) · 61 unmodified lines | |||
| 766 | { | 766 | { |
| 767 | int i; | 767 | int i; |
| 768 | 768 | ||
| 769 | for (i = 0; i < graph->filter_count; i++) | 769 | for (i = 0; i < graph->nb_filters; i++) |
| 770 | swap_sample_fmts_on_filter(graph->filters[i]); | 770 | swap_sample_fmts_on_filter(graph->filters[i]); |
| 771 | 771 | ||
| 772 | } | 772 | } |
| @@ -778,7 +778,7 @@ static int pick_formats(AVFilterGraph *graph) · 5 unmodified lines | |||
| 778 | 778 | ||
| 779 | do{ | 779 | do{ |
| 780 | change = 0; | 780 | change = 0; |
| 781 | for (i = 0; i < graph->filter_count; i++) { | 781 | for (i = 0; i < graph->nb_filters; i++) { |
| 782 | AVFilterContext *filter = graph->filters[i]; | 782 | AVFilterContext *filter = graph->filters[i]; |
| 783 | if (filter->nb_inputs){ | 783 | if (filter->nb_inputs){ |
| 784 | for (j = 0; j < filter->nb_inputs; j++){ | 784 | for (j = 0; j < filter->nb_inputs; j++){ |
| @@ -810,7 +810,7 @@ static int pick_formats(AVFilterGraph *graph) · 25 unmodified lines | |||
| 810 | } | 810 | } |
| 811 | }while(change); | 811 | }while(change); |
| 812 | 812 | ||
| 813 | for (i = 0; i < graph->filter_count; i++) { | 813 | for (i = 0; i < graph->nb_filters; i++) { |
| 814 | AVFilterContext *filter = graph->filters[i]; | 814 | AVFilterContext *filter = graph->filters[i]; |
| 815 | 815 | ||
| 816 | for (j = 0; j < filter->nb_inputs; j++) | 816 | for (j = 0; j < filter->nb_inputs; j++) |
| @@ -859,7 +859,7 @@ static int ff_avfilter_graph_config_pointers(AVFilterGraph *graph, · 42 unmodified lines | |||
| 859 | AVFilterContext *f; | 859 | AVFilterContext *f; |
| 860 | AVFilterLink **sinks; | 860 | AVFilterLink **sinks; |
| 861 | 861 | ||
| 862 | for (i = 0; i < graph->filter_count; i++) { | 862 | for (i = 0; i < graph->nb_filters; i++) { |
| 863 | f = graph->filters[i]; | 863 | f = graph->filters[i]; |
| 864 | for (j = 0; j < f->nb_inputs; j++) { | 864 | for (j = 0; j < f->nb_inputs; j++) { |
| 865 | f->inputs[j]->graph = graph; | 865 | f->inputs[j]->graph = graph; |
| @@ -878,7 +878,7 @@ static int ff_avfilter_graph_config_pointers(AVFilterGraph *graph, · 12 unmodified lines | |||
| 878 | sinks = av_calloc(sink_links_count, sizeof(*sinks)); | 878 | sinks = av_calloc(sink_links_count, sizeof(*sinks)); |
| 879 | if (!sinks) | 879 | if (!sinks) |
| 880 | return AVERROR(ENOMEM); | 880 | return AVERROR(ENOMEM); |
| 881 | for (i = 0; i < graph->filter_count; i++) { | 881 | for (i = 0; i < graph->nb_filters; i++) { |
| 882 | f = graph->filters[i]; | 882 | f = graph->filters[i]; |
| 883 | if (!f->nb_outputs) { | 883 | if (!f->nb_outputs) { |
| 884 | for (j = 0; j < f->nb_inputs; j++) { | 884 | 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 | |||
| 899 | int i, j, ret; | 899 | int i, j, ret; |
| 900 | int fifo_count = 0; | 900 | int fifo_count = 0; |
| 901 | 901 | ||
| 902 | for (i = 0; i < graph->filter_count; i++) { | 902 | for (i = 0; i < graph->nb_filters; i++) { |
| 903 | f = graph->filters[i]; | 903 | f = graph->filters[i]; |
| 904 | 904 | ||
| 905 | for (j = 0; j < f->nb_inputs; j++) { | 905 | 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 | |||
| 965 | if(res_len && res) | 965 | if(res_len && res) |
| 966 | res[0]= 0; | 966 | res[0]= 0; |
| 967 | 967 | ||
| 968 | for (i = 0; i < graph->filter_count; i++) { | 968 | for (i = 0; i < graph->nb_filters; i++) { |
| 969 | AVFilterContext *filter = graph->filters[i]; | 969 | AVFilterContext *filter = graph->filters[i]; |
| 970 | if(!strcmp(target, "all") || (filter->name && !strcmp(target, filter->name)) || !strcmp(target, filter->filter->name)){ | 970 | if(!strcmp(target, "all") || (filter->name && !strcmp(target, filter->name)) || !strcmp(target, filter->filter->name)){ |
| 971 | r = avfilter_process_command(filter, cmd, arg, res, res_len, flags); | 971 | 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 | |||
| 986 | if(!graph) | 986 | if(!graph) |
| 987 | return 0; | 987 | return 0; |
| 988 | 988 | ||
| 989 | for (i = 0; i < graph->filter_count; i++) { | 989 | for (i = 0; i < graph->nb_filters; i++) { |
| 990 | AVFilterContext *filter = graph->filters[i]; | 990 | AVFilterContext *filter = graph->filters[i]; |
| 991 | if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){ | 991 | if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){ |
| 992 | AVFilterCommand **queue = &filter->command_queue, *next; | 992 | AVFilterCommand **queue = &filter->command_queue, *next; |