]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit '42c7c61ab25809620b8c8809b3da73e25f5bbaaf'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 16 Mar 2013 15:09:37 +0000 (16:09 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 16 Mar 2013 15:09:37 +0000 (16:09 +0100)
* 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>
doc/APIchanges
libavfilter/avfiltergraph.c
libavfilter/avfiltergraph.h
libavfilter/graphdump.c
libavfilter/graphparser.c
libavfilter/version.h
tools/graph2dot.c

index 0b2295c5624ce393378c6f9a6dd9b33f80c69899..2bde666c354e01443542eedfaba8a694d4128b44 100644 (file)
@@ -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
index 2764b8c85ad7f58c181e87aeaa7a0efbddfe5595..9b05c6d6d1cbd7b9f23e17fe024c58e61653dc30 100644 (file)
@@ -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;
index 3965412803740083e89060cccacbf88881d9fda4..61110f99a124b21bfab9d530ba5bd8c371e332e7 100644 (file)
 
 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
 
     /**
index 28e9bc9789bbbf7226f7994bde623a8de9ef8cb4..756f63dc494a432947b0e93e8ad441ae4700f171 100644 (file)
@@ -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;
index 3e85261c3828a3b55908c8fe969f773cc1880547..8d2fffc1949d146a6ed5a6b696293f5423a25e60 100644 (file)
@@ -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;
index 3a2fff3bf8138a44ce3e398e58944567720fdc6d..3ec6f2db4635a5ce7e5cba4fb2c270f6fd5ac9ce 100644 (file)
@@ -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, \
index 74075c7af294d23db8f84fbfe9000f258b3cf7df..d53642f9157be34b49bb0590dc1f0100492dbb2a 100644 (file)
@@ -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];