[FFmpeg-cvslog] lavfi: rename AVFilterFormats.format_count to nb_formats

Anton Khirnov git at videolan.org
Sat May 18 11:57:44 CEST 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Mar 31 16:38:07 2013 +0200| [b01f6041f4260fba053c2f96ce1611ea77e833a0] | committer: Anton Khirnov

lavfi: rename AVFilterFormats.format_count to nb_formats

This is more consistent with naming in the rest of Libav.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b01f6041f4260fba053c2f96ce1611ea77e833a0
---

 libavfilter/avfiltergraph.c |   22 +++++++++++-----------
 libavfilter/filtfmts.c      |    4 ++--
 libavfilter/formats.c       |   12 ++++++------
 libavfilter/formats.h       |    2 +-
 libavfilter/vf_format.c     |    2 +-
 5 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 9131026..9e4c407 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -341,17 +341,17 @@ static int pick_format(AVFilterLink *link)
     if (!link || !link->in_formats)
         return 0;
 
-    link->in_formats->format_count = 1;
+    link->in_formats->nb_formats = 1;
     link->format = link->in_formats->formats[0];
 
     if (link->type == AVMEDIA_TYPE_AUDIO) {
-        if (!link->in_samplerates->format_count) {
+        if (!link->in_samplerates->nb_formats) {
             av_log(link->src, AV_LOG_ERROR, "Cannot select sample rate for"
                    " the link between filters %s and %s.\n", link->src->name,
                    link->dst->name);
             return AVERROR(EINVAL);
         }
-        link->in_samplerates->format_count = 1;
+        link->in_samplerates->nb_formats = 1;
         link->sample_rate = link->in_samplerates->formats[0];
 
         if (!link->in_channel_layouts->nb_channel_layouts) {
@@ -414,9 +414,9 @@ static int reduce_formats_on_filter(AVFilterContext *filter)
     int i, j, k, ret = 0;
 
     REDUCE_FORMATS(int,      AVFilterFormats,        formats,         formats,
-                   format_count, ff_add_format);
+                   nb_formats, ff_add_format);
     REDUCE_FORMATS(int,      AVFilterFormats,        samplerates,     formats,
-                   format_count, ff_add_format);
+                   nb_formats, ff_add_format);
     REDUCE_FORMATS(uint64_t, AVFilterChannelLayouts, channel_layouts,
                    channel_layouts, nb_channel_layouts, ff_add_channel_layout);
 
@@ -445,7 +445,7 @@ static void swap_samplerates_on_filter(AVFilterContext *filter)
         link = filter->inputs[i];
 
         if (link->type == AVMEDIA_TYPE_AUDIO &&
-            link->out_samplerates->format_count == 1)
+            link->out_samplerates->nb_formats== 1)
             break;
     }
     if (i == filter->nb_inputs)
@@ -458,10 +458,10 @@ static void swap_samplerates_on_filter(AVFilterContext *filter)
         int best_idx, best_diff = INT_MAX;
 
         if (outlink->type != AVMEDIA_TYPE_AUDIO ||
-            outlink->in_samplerates->format_count < 2)
+            outlink->in_samplerates->nb_formats < 2)
             continue;
 
-        for (j = 0; j < outlink->in_samplerates->format_count; j++) {
+        for (j = 0; j < outlink->in_samplerates->nb_formats; j++) {
             int diff = abs(sample_rate - outlink->in_samplerates->formats[j]);
 
             if (diff < best_diff) {
@@ -607,7 +607,7 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter)
         link = filter->inputs[i];
 
         if (link->type == AVMEDIA_TYPE_AUDIO &&
-            link->out_formats->format_count == 1)
+            link->out_formats->nb_formats == 1)
             break;
     }
     if (i == filter->nb_inputs)
@@ -621,10 +621,10 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter)
         int best_idx = -1, best_score = INT_MIN;
 
         if (outlink->type != AVMEDIA_TYPE_AUDIO ||
-            outlink->in_formats->format_count < 2)
+            outlink->in_formats->nb_formats < 2)
             continue;
 
-        for (j = 0; j < outlink->in_formats->format_count; j++) {
+        for (j = 0; j < outlink->in_formats->nb_formats; j++) {
             int out_format = outlink->in_formats->formats[j];
             int out_bps    = av_get_bytes_per_sample(out_format);
             int score;
diff --git a/libavfilter/filtfmts.c b/libavfilter/filtfmts.c
index 1ac3116..424811a 100644
--- a/libavfilter/filtfmts.c
+++ b/libavfilter/filtfmts.c
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
     /* print the supported formats in input */
     for (i = 0; i < filter_ctx->input_count; i++) {
         AVFilterFormats *fmts = filter_ctx->inputs[i]->out_formats;
-        for (j = 0; j < fmts->format_count; j++)
+        for (j = 0; j < fmts->nb_formats; j++)
             printf("INPUT[%d] %s: %s\n",
                    i, filter_ctx->filter->inputs[i].name,
                    av_get_pix_fmt_name(fmts->formats[j]));
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
     /* print the supported formats in output */
     for (i = 0; i < filter_ctx->output_count; i++) {
         AVFilterFormats *fmts = filter_ctx->outputs[i]->in_formats;
-        for (j = 0; j < fmts->format_count; j++)
+        for (j = 0; j < fmts->nb_formats; j++)
             printf("OUTPUT[%d] %s: %s\n",
                    i, filter_ctx->filter->outputs[i].name,
                    av_get_pix_fmt_name(fmts->formats[j]));
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index c7b8075..1441161 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -84,7 +84,7 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
     if (a == b)
         return a;
 
-    MERGE_FORMATS(ret, a, b, formats, format_count, AVFilterFormats, fail);
+    MERGE_FORMATS(ret, a, b, formats, nb_formats, AVFilterFormats, fail);
 
     return ret;
 fail:
@@ -103,9 +103,9 @@ AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a,
 
     if (a == b) return a;
 
-    if (a->format_count && b->format_count) {
-        MERGE_FORMATS(ret, a, b, formats, format_count, AVFilterFormats, fail);
-    } else if (a->format_count) {
+    if (a->nb_formats && b->nb_formats) {
+        MERGE_FORMATS(ret, a, b, formats, nb_formats, AVFilterFormats, fail);
+    } else if (a->nb_formats) {
         MERGE_REF(a, b, formats, AVFilterFormats, fail);
         ret = a;
     } else {
@@ -173,7 +173,7 @@ AVFilterFormats *ff_make_format_list(const int *fmts)
     formats               = av_mallocz(sizeof(*formats));
     if (count)
         formats->formats  = av_malloc(sizeof(*formats->formats) * count);
-    formats->format_count = count;
+    formats->nb_formats = count;
     memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);
 
     return formats;
@@ -198,7 +198,7 @@ do {                                                        \
 
 int ff_add_format(AVFilterFormats **avff, int fmt)
 {
-    ADD_FORMAT(avff, fmt, int, formats, format_count);
+    ADD_FORMAT(avff, fmt, int, formats, nb_formats);
 }
 
 int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
diff --git a/libavfilter/formats.h b/libavfilter/formats.h
index 0e1628c..2e44792 100644
--- a/libavfilter/formats.h
+++ b/libavfilter/formats.h
@@ -62,7 +62,7 @@
  * pointer to each of the pointers to itself.
  */
 struct AVFilterFormats {
-    unsigned format_count;      ///< number of formats
+    unsigned nb_formats;        ///< number of formats
     int *formats;               ///< list of media formats
 
     unsigned refcount;          ///< number of references to this list
diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c
index 339dbcc..7fcc7d6 100644
--- a/libavfilter/vf_format.c
+++ b/libavfilter/vf_format.c
@@ -91,7 +91,7 @@ static AVFilterFormats *make_format_list(FormatContext *s, int flag)
 
     for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
         if (s->listed_pix_fmt_flags[pix_fmt] == flag)
-            formats->formats[formats->format_count++] = pix_fmt;
+            formats->formats[formats->nb_formats++] = pix_fmt;
 
     return formats;
 }



More information about the ffmpeg-cvslog mailing list