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