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
1442012-03-26 - a67d9cf - lavfi 2.66.1001442012-03-26 - a67d9cf - lavfi 2.66.100
145 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.145 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
146 146
1472013-xx-xx - lavfi 3.6.0
148 Add AVFilterGraph.nb_filters, deprecate AVFilterGraph.filter_count.
149
1472013-03-xx - Reference counted buffers - lavu 52.8.0, lavc 55.0.0, lavf 55.0.0,1502013-03-xx - Reference counted buffers - lavu 52.8.0, lavc 55.0.0, lavf 55.0.0,
148lavd 54.0.0, lavfi 3.5.0151lavd 54.0.0, lavfi 3.5.0
149 xxxxxxx, xxxxxxx - add a new API for reference counted buffers and buffer152 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
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
75int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)75int 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;
libavfilter/avfiltergraph.h+10−1
@@ -27,11 +27,20 @@ · 26 unmodified lines
27 27
28typedef struct AVFilterGraph {28typedef struct AVFilterGraph {
29 const AVClass *av_class;29 const AVClass *av_class;
30 unsigned filter_count;30#if FF_API_FOO_COUNT
31 attribute_deprecated
32 unsigned filter_count_unused;
33#endif
31 AVFilterContext **filters;34 AVFilterContext **filters;
35#if !FF_API_FOO_COUNT
36 unsigned nb_filters;
37#endif
32 38
33 char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters39 char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters
34 char *resample_lavr_opts; ///< libavresample options to use for the auto-inserted resample filters40 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
35 char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions44 char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions
36 45
37 /**46 /**
libavfilter/graphdump.c+1−1
@@ -62,7 +62,7 @@ static void avfilter_graph_dump_to_buf(AVBPrint *buf, AVFilterGraph *graph) · 61 unmodified lines
62{62{
63 unsigned i, j, x, e;63 unsigned i, j, x, e;
64 64
65 for (i = 0; i < graph->filter_count; i++) {65 for (i = 0; i < graph->nb_filters; i++) {
66 AVFilterContext *filter = graph->filters[i];66 AVFilterContext *filter = graph->filters[i];
67 unsigned max_src_name = 0, max_dst_name = 0;67 unsigned max_src_name = 0, max_dst_name = 0;
68 unsigned max_in_name = 0, max_out_name = 0;68 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
436 return 0;436 return 0;
437 437
438 fail:end:438 fail:end:
439 for (; graph->filter_count > 0; graph->filter_count--)439 for (; graph->nb_filters > 0; graph->nb_filters--)
440 avfilter_free(graph->filters[graph->filter_count - 1]);440 avfilter_free(graph->filters[graph->nb_filters - 1]);
441 av_freep(&graph->filters);441 av_freep(&graph->filters);
442 avfilter_inout_free(&open_inputs);442 avfilter_inout_free(&open_inputs);
443 avfilter_inout_free(&open_outputs);443 avfilter_inout_free(&open_outputs);
@@ -504,8 +504,8 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, · 60 unmodified lines
504 504
505 fail:505 fail:
506 if (ret < 0) {506 if (ret < 0) {
507 for (; graph->filter_count > 0; graph->filter_count--)507 for (; graph->nb_filters > 0; graph->nb_filters--)
508 avfilter_free(graph->filters[graph->filter_count - 1]);508 avfilter_free(graph->filters[graph->nb_filters - 1]);
509 av_freep(&graph->filters);509 av_freep(&graph->filters);
510 }510 }
511 avfilter_inout_free(&inputs);511 avfilter_inout_free(&inputs);
@@ -591,8 +591,8 @@ end: · 79 unmodified lines
591 avfilter_inout_free(&curr_inputs);591 avfilter_inout_free(&curr_inputs);
592 592
593 if (ret < 0) {593 if (ret < 0) {
594 for (; graph->filter_count > 0; graph->filter_count--)594 for (; graph->nb_filters > 0; graph->nb_filters--)
595 avfilter_free(graph->filters[graph->filter_count - 1]);595 avfilter_free(graph->filters[graph->nb_filters - 1]);
596 av_freep(&graph->filters);596 av_freep(&graph->filters);
597 }597 }
598 return ret;598 return ret;
libavfilter/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
29#include "libavutil/avutil.h"29#include "libavutil/avutil.h"
30 30
31#define LIBAVFILTER_VERSION_MAJOR 331#define LIBAVFILTER_VERSION_MAJOR 3
32#define LIBAVFILTER_VERSION_MINOR 4632#define LIBAVFILTER_VERSION_MINOR 47
33#define LIBAVFILTER_VERSION_MICRO 10033#define LIBAVFILTER_VERSION_MICRO 100
34 34
35#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \35#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
58 fprintf(outfile, "node [shape=box]\n");58 fprintf(outfile, "node [shape=box]\n");
59 fprintf(outfile, "rankdir=LR\n");59 fprintf(outfile, "rankdir=LR\n");
60 60
61 for (i = 0; i < graph->filter_count; i++) {61 for (i = 0; i < graph->nb_filters; i++) {
62 char filter_ctx_label[128];62 char filter_ctx_label[128];
63 const AVFilterContext *filter_ctx = graph->filters[i];63 const AVFilterContext *filter_ctx = graph->filters[i];
64 64

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