* commit 'b01f6041f4260fba053c2f96ce1611ea77e833a0': lavfi: rename AVFilterFormats.format_count to nb_formats Conflicts: libavfilter/avfiltergraph.c libavfilter/filtfmts.c libavfilter/formats.c
Unified · Split
| @@ -503,28 +503,28 @@ static int pick_format(AVFilterLink *link, AVFilterLink *ref) · 502 unmodified lines | ||
| 503 | 503 | int has_alpha= av_pix_fmt_desc_get(ref->format)->nb_components % 2 == 0; |
| 504 | 504 | enum AVPixelFormat best= AV_PIX_FMT_NONE; |
| 505 | 505 | int i; |
| 506 | − for (i=0; i<link->in_formats->format_count; i++) { | |
| 506 | + for (i=0; i<link->in_formats->nb_formats; i++) { | |
| 507 | 507 | enum AVPixelFormat p = link->in_formats->formats[i]; |
| 508 | 508 | best= avcodec_find_best_pix_fmt_of_2(best, p, ref->format, has_alpha, NULL); |
| 509 | 509 | } |
| 510 | 510 | av_log(link->src,AV_LOG_DEBUG, "picking %s out of %d ref:%s alpha:%d\n", |
| 511 | − av_get_pix_fmt_name(best), link->in_formats->format_count, | |
| 511 | + av_get_pix_fmt_name(best), link->in_formats->nb_formats, | |
| 512 | 512 | av_get_pix_fmt_name(ref->format), has_alpha); |
| 513 | 513 | link->in_formats->formats[0] = best; |
| 514 | 514 | } |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | − link->in_formats->format_count = 1; | |
| 517 | + link->in_formats->nb_formats = 1; | |
| 518 | 518 | link->format = link->in_formats->formats[0]; |
| 519 | 519 | |
| 520 | 520 | if (link->type == AVMEDIA_TYPE_AUDIO) { |
| 521 | − if (!link->in_samplerates->format_count) { | |
| 521 | + if (!link->in_samplerates->nb_formats) { | |
| 522 | 522 | av_log(link->src, AV_LOG_ERROR, "Cannot select sample rate for" |
| 523 | 523 | " the link between filters %s and %s.\n", link->src->name, |
| 524 | 524 | link->dst->name); |
| 525 | 525 | return AVERROR(EINVAL); |
| 526 | 526 | } |
| 527 | − link->in_samplerates->format_count = 1; | |
| 527 | + link->in_samplerates->nb_formats = 1; | |
| 528 | 528 | link->sample_rate = link->in_samplerates->formats[0]; |
| 529 | 529 | |
| 530 | 530 | if (link->in_channel_layouts->all_layouts) { |
| @@ -591,9 +591,9 @@ static int reduce_formats_on_filter(AVFilterContext *filter) · 60 unmodified lines | ||
| 591 | 591 | int i, j, k, ret = 0; |
| 592 | 592 | |
| 593 | 593 | REDUCE_FORMATS(int, AVFilterFormats, formats, formats, |
| 594 | − format_count, ff_add_format); | |
| 594 | + nb_formats, ff_add_format); | |
| 595 | 595 | REDUCE_FORMATS(int, AVFilterFormats, samplerates, formats, |
| 596 | − format_count, ff_add_format); | |
| 596 | + nb_formats, ff_add_format); | |
| 597 | 597 | |
| 598 | 598 | /* reduce channel layouts */ |
| 599 | 599 | for (i = 0; i < filter->nb_inputs; i++) { |
| @@ -656,7 +656,7 @@ static void swap_samplerates_on_filter(AVFilterContext *filter) · 56 unmodified lines | ||
| 656 | 656 | link = filter->inputs[i]; |
| 657 | 657 | |
| 658 | 658 | if (link->type == AVMEDIA_TYPE_AUDIO && |
| 659 | − link->out_samplerates->format_count == 1) | |
| 659 | + link->out_samplerates->nb_formats== 1) | |
| 660 | 660 | break; |
| 661 | 661 | } |
| 662 | 662 | if (i == filter->nb_inputs) |
| @@ -669,10 +669,10 @@ static void swap_samplerates_on_filter(AVFilterContext *filter) · 6 unmodified lines | ||
| 669 | 669 | int best_idx, best_diff = INT_MAX; |
| 670 | 670 | |
| 671 | 671 | if (outlink->type != AVMEDIA_TYPE_AUDIO || |
| 672 | − outlink->in_samplerates->format_count < 2) | |
| 672 | + outlink->in_samplerates->nb_formats < 2) | |
| 673 | 673 | continue; |
| 674 | 674 | |
| 675 | − for (j = 0; j < outlink->in_samplerates->format_count; j++) { | |
| 675 | + for (j = 0; j < outlink->in_samplerates->nb_formats; j++) { | |
| 676 | 676 | int diff = abs(sample_rate - outlink->in_samplerates->formats[j]); |
| 677 | 677 | |
| 678 | 678 | if (diff < best_diff) { |
| @@ -834,7 +834,7 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter) · 155 unmodified lines | ||
| 834 | 834 | link = filter->inputs[i]; |
| 835 | 835 | |
| 836 | 836 | if (link->type == AVMEDIA_TYPE_AUDIO && |
| 837 | − link->out_formats->format_count == 1) | |
| 837 | + link->out_formats->nb_formats == 1) | |
| 838 | 838 | break; |
| 839 | 839 | } |
| 840 | 840 | if (i == filter->nb_inputs) |
| @@ -848,10 +848,10 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter) · 7 unmodified lines | ||
| 848 | 848 | int best_idx = -1, best_score = INT_MIN; |
| 849 | 849 | |
| 850 | 850 | if (outlink->type != AVMEDIA_TYPE_AUDIO || |
| 851 | − outlink->in_formats->format_count < 2) | |
| 851 | + outlink->in_formats->nb_formats < 2) | |
| 852 | 852 | continue; |
| 853 | 853 | |
| 854 | − for (j = 0; j < outlink->in_formats->format_count; j++) { | |
| 854 | + for (j = 0; j < outlink->in_formats->nb_formats; j++) { | |
| 855 | 855 | int out_format = outlink->in_formats->formats[j]; |
| 856 | 856 | int out_bps = av_get_bytes_per_sample(out_format); |
| 857 | 857 | int score; |
| @@ -904,7 +904,7 @@ static int pick_formats(AVFilterGraph *graph) · 46 unmodified lines | ||
| 904 | 904 | AVFilterContext *filter = graph->filters[i]; |
| 905 | 905 | if (filter->nb_inputs){ |
| 906 | 906 | for (j = 0; j < filter->nb_inputs; j++){ |
| 907 | − if(filter->inputs[j]->in_formats && filter->inputs[j]->in_formats->format_count == 1) { | |
| 907 | + if(filter->inputs[j]->in_formats && filter->inputs[j]->in_formats->nb_formats == 1) { | |
| 908 | 908 | if ((ret = pick_format(filter->inputs[j], NULL)) < 0) |
| 909 | 909 | return ret; |
| 910 | 910 | change = 1; |
| @@ -913,7 +913,7 @@ static int pick_formats(AVFilterGraph *graph) · 2 unmodified lines | ||
| 913 | 913 | } |
| 914 | 914 | if (filter->nb_outputs){ |
| 915 | 915 | for (j = 0; j < filter->nb_outputs; j++){ |
| 916 | − if(filter->outputs[j]->in_formats && filter->outputs[j]->in_formats->format_count == 1) { | |
| 916 | + if(filter->outputs[j]->in_formats && filter->outputs[j]->in_formats->nb_formats == 1) { | |
| 917 | 917 | if ((ret = pick_format(filter->outputs[j], NULL)) < 0) |
| 918 | 918 | return ret; |
| 919 | 919 | change = 1; |
| @@ -35,7 +35,7 @@ static void print_formats(AVFilterContext *filter_ctx) · 34 unmodified lines | ||
| 35 | 35 | if (filter_ctx->inout##puts[i]->type == AVMEDIA_TYPE_VIDEO) { \ |
| 36 | 36 | AVFilterFormats *fmts = \ |
| 37 | 37 | filter_ctx->inout##puts[i]->outin##_formats; \ |
| 38 | − for (j = 0; j < fmts->format_count; j++) \ | |
| 38 | + for (j = 0; j < fmts->nb_formats; j++) \ | |
| 39 | 39 | if(av_get_pix_fmt_name(fmts->formats[j])) \ |
| 40 | 40 | printf(#INOUT "PUT[%d] %s: fmt:%s\n", \ |
| 41 | 41 | i, filter_ctx->filter->inout##puts[i].name, \ |
| @@ -45,7 +45,7 @@ static void print_formats(AVFilterContext *filter_ctx) · 3 unmodified lines | ||
| 45 | 45 | AVFilterChannelLayouts *layouts; \ |
| 46 | 46 | \ |
| 47 | 47 | fmts = filter_ctx->inout##puts[i]->outin##_formats; \ |
| 48 | − for (j = 0; j < fmts->format_count; j++) \ | |
| 48 | + for (j = 0; j < fmts->nb_formats; j++) \ | |
| 49 | 49 | printf(#INOUT "PUT[%d] %s: fmt:%s\n", \ |
| 50 | 50 | i, filter_ctx->filter->inout##puts[i].name, \ |
| 51 | 51 | av_get_sample_fmt_name(fmts->formats[j])); \ |
| @@ -108,8 +108,8 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b, · 107 unmodified lines | ||
| 108 | 108 | To avoid that, pretend that there are no common formats to force the |
| 109 | 109 | insertion of a conversion filter. */ |
| 110 | 110 | if (type == AVMEDIA_TYPE_VIDEO) |
| 111 | − for (i = 0; i < a->format_count; i++) | |
| 112 | − for (j = 0; j < b->format_count; j++) { | |
| 111 | + for (i = 0; i < a->nb_formats; i++) | |
| 112 | + for (j = 0; j < b->nb_formats; j++) { | |
| 113 | 113 | const AVPixFmtDescriptor *adesc = av_pix_fmt_desc_get(a->formats[i]); |
| 114 | 114 | const AVPixFmtDescriptor *bdesc = av_pix_fmt_desc_get(b->formats[j]); |
| 115 | 115 | alpha2 |= adesc->flags & bdesc->flags & AV_PIX_FMT_FLAG_ALPHA; |
| @@ -124,7 +124,7 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b, · 8 unmodified lines | ||
| 124 | 124 | if (alpha2 > alpha1 || chroma2 > chroma1) |
| 125 | 125 | return NULL; |
| 126 | 126 | |
| 127 | − MERGE_FORMATS(ret, a, b, formats, format_count, AVFilterFormats, fail); | |
| 127 | + MERGE_FORMATS(ret, a, b, formats, nb_formats, AVFilterFormats, fail); | |
| 128 | 128 | |
| 129 | 129 | return ret; |
| 130 | 130 | fail: |
| @@ -143,9 +143,9 @@ AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a, · 12 unmodified lines | ||
| 143 | 143 | |
| 144 | 144 | if (a == b) return a; |
| 145 | 145 | |
| 146 | − if (a->format_count && b->format_count) { | |
| 147 | − MERGE_FORMATS(ret, a, b, formats, format_count, AVFilterFormats, fail); | |
| 148 | − } else if (a->format_count) { | |
| 146 | + if (a->nb_formats && b->nb_formats) { | |
| 147 | + MERGE_FORMATS(ret, a, b, formats, nb_formats, AVFilterFormats, fail); | |
| 148 | + } else if (a->nb_formats) { | |
| 149 | 149 | MERGE_REF(a, b, formats, AVFilterFormats, fail); |
| 150 | 150 | ret = a; |
| 151 | 151 | } else { |
| @@ -307,7 +307,7 @@ int64_t *ff_copy_int64_list(const int64_t * const list) · 155 unmodified lines | ||
| 307 | 307 | |
| 308 | 308 | AVFilterFormats *ff_make_format_list(const int *fmts) |
| 309 | 309 | { |
| 310 | − MAKE_FORMAT_LIST(AVFilterFormats, formats, format_count); | |
| 310 | + MAKE_FORMAT_LIST(AVFilterFormats, formats, nb_formats); | |
| 311 | 311 | while (count--) |
| 312 | 312 | formats->formats[count] = fmts[count]; |
| 313 | 313 | |
| @@ -343,7 +343,7 @@ do { \ · 29 unmodified lines | ||
| 343 | 343 | |
| 344 | 344 | int ff_add_format(AVFilterFormats **avff, int64_t fmt) |
| 345 | 345 | { |
| 346 | − ADD_FORMAT(avff, fmt, int, formats, format_count); | |
| 346 | + ADD_FORMAT(avff, fmt, int, formats, nb_formats); | |
| 347 | 347 | return 0; |
| 348 | 348 | } |
| 349 | 349 | |
| @@ -62,7 +62,7 @@ · 61 unmodified lines | ||
| 62 | 62 | * pointer to each of the pointers to itself. |
| 63 | 63 | */ |
| 64 | 64 | struct AVFilterFormats { |
| 65 | − unsigned format_count; ///< number of formats | |
| 65 | + unsigned nb_formats; ///< number of formats | |
| 66 | 66 | int *formats; ///< list of media formats |
| 67 | 67 | |
| 68 | 68 | unsigned refcount; ///< number of references to this list |
| @@ -100,7 +100,7 @@ static int query_formats(AVFilterContext *ctx) · 99 unmodified lines | ||
| 100 | 100 | int i, depth = 0, be = 0; |
| 101 | 101 | |
| 102 | 102 | if (!ctx->inputs[0]->in_formats || |
| 103 | − !ctx->inputs[0]->in_formats->format_count) { | |
| 103 | + !ctx->inputs[0]->in_formats->nb_formats) { | |
| 104 | 104 | return AVERROR(EAGAIN); |
| 105 | 105 | } |
| 106 | 106 | |
| @@ -111,7 +111,7 @@ static int query_formats(AVFilterContext *ctx) · 4 unmodified lines | ||
| 111 | 111 | desc = av_pix_fmt_desc_get(avff->formats[0]); |
| 112 | 112 | depth = desc->comp[0].depth_minus1; |
| 113 | 113 | be = desc->flags & AV_PIX_FMT_FLAG_BE; |
| 114 | − for (i = 1; i < avff->format_count; i++) { | |
| 114 | + for (i = 1; i < avff->nb_formats; i++) { | |
| 115 | 115 | desc = av_pix_fmt_desc_get(avff->formats[i]); |
| 116 | 116 | if (depth != desc->comp[0].depth_minus1 || |
| 117 | 117 | be != (desc->flags & AV_PIX_FMT_FLAG_BE)) { |
| @@ -89,7 +89,7 @@ static AVFilterFormats *make_format_list(FormatContext *s, int flag) · 88 unmodified lines | ||
| 89 | 89 | |
| 90 | 90 | for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) |
| 91 | 91 | if (s->listed_pix_fmt_flags[pix_fmt] == flag) |
| 92 | − formats->formats[formats->format_count++] = pix_fmt; | |
| 92 | + formats->formats[formats->nb_formats++] = pix_fmt; | |
| 93 | 93 | |
| 94 | 94 | return formats; |
| 95 | 95 | } |