It will allow to refernce it as a whole without clunky macros. Most of the changes have been automatically made with sed: sed -i ' s/-> *in_formats/->incfg.formats/g; s/-> *out_formats/->outcfg.formats/g; s/-> *in_channel_layouts/->incfg.channel_layouts/g; s/-> *out_channel_layouts/->outcfg.channel_layouts/g; s/-> *in_samplerates/->incfg.samplerates/g; s/-> *out_samplerates/->outcfg.samplerates/g; ' src/libavfilter/*(.)
Showing the changes to libavfilter/avfiltergraph.c (1 of 70 files). Show all
Unified · Split
| @@ -331,9 +331,9 @@ static int filter_query_formats(AVFilterContext *ctx) · 330 unmodified lines | |||
| 331 | } | 331 | } |
| 332 | 332 | ||
| 333 | for (i = 0; i < ctx->nb_inputs; i++) | 333 | for (i = 0; i < ctx->nb_inputs; i++) |
| 334 | sanitize_channel_layouts(ctx, ctx->inputs[i]->out_channel_layouts); | 334 | sanitize_channel_layouts(ctx, ctx->inputs[i]->outcfg.channel_layouts); |
| 335 | for (i = 0; i < ctx->nb_outputs; i++) | 335 | for (i = 0; i < ctx->nb_outputs; i++) |
| 336 | sanitize_channel_layouts(ctx, ctx->outputs[i]->in_channel_layouts); | 336 | sanitize_channel_layouts(ctx, ctx->outputs[i]->incfg.channel_layouts); |
| 337 | 337 | ||
| 338 | formats = ff_all_formats(type); | 338 | formats = ff_all_formats(type); |
| 339 | if ((ret = ff_set_common_formats(ctx, formats)) < 0) | 339 | if ((ret = ff_set_common_formats(ctx, formats)) < 0) |
| @@ -354,19 +354,19 @@ static int formats_declared(AVFilterContext *f) · 14 unmodified lines | |||
| 354 | int i; | 354 | int i; |
| 355 | 355 | ||
| 356 | for (i = 0; i < f->nb_inputs; i++) { | 356 | for (i = 0; i < f->nb_inputs; i++) { |
| 357 | if (!f->inputs[i]->out_formats) | 357 | if (!f->inputs[i]->outcfg.formats) |
| 358 | return 0; | 358 | return 0; |
| 359 | if (f->inputs[i]->type == AVMEDIA_TYPE_AUDIO && | 359 | if (f->inputs[i]->type == AVMEDIA_TYPE_AUDIO && |
| 360 | !(f->inputs[i]->out_samplerates && | 360 | !(f->inputs[i]->outcfg.samplerates && |
| 361 | f->inputs[i]->out_channel_layouts)) | 361 | f->inputs[i]->outcfg.channel_layouts)) |
| 362 | return 0; | 362 | return 0; |
| 363 | } | 363 | } |
| 364 | for (i = 0; i < f->nb_outputs; i++) { | 364 | for (i = 0; i < f->nb_outputs; i++) { |
| 365 | if (!f->outputs[i]->in_formats) | 365 | if (!f->outputs[i]->incfg.formats) |
| 366 | return 0; | 366 | return 0; |
| 367 | if (f->outputs[i]->type == AVMEDIA_TYPE_AUDIO && | 367 | if (f->outputs[i]->type == AVMEDIA_TYPE_AUDIO && |
| 368 | !(f->outputs[i]->in_samplerates && | 368 | !(f->outputs[i]->incfg.samplerates && |
| 369 | f->outputs[i]->in_channel_layouts)) | 369 | f->outputs[i]->incfg.channel_layouts)) |
| 370 | return 0; | 370 | return 0; |
| 371 | } | 371 | } |
| 372 | return 1; | 372 | return 1; |
| @@ -416,24 +416,24 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 43 unmodified lines | |||
| 416 | if (!link) | 416 | if (!link) |
| 417 | continue; | 417 | continue; |
| 418 | 418 | ||
| 419 | if (link->in_formats != link->out_formats | 419 | if (link->incfg.formats != link->outcfg.formats |
| 420 | && link->in_formats && link->out_formats) | 420 | && link->incfg.formats && link->outcfg.formats) |
| 421 | if (!ff_can_merge_formats(link->in_formats, link->out_formats, | 421 | if (!ff_can_merge_formats(link->incfg.formats, link->outcfg.formats, |
| 422 | link->type)) | 422 | link->type)) |
| 423 | convert_needed = 1; | 423 | convert_needed = 1; |
| 424 | if (link->type == AVMEDIA_TYPE_AUDIO) { | 424 | if (link->type == AVMEDIA_TYPE_AUDIO) { |
| 425 | if (link->in_samplerates != link->out_samplerates | 425 | if (link->incfg.samplerates != link->outcfg.samplerates |
| 426 | && link->in_samplerates && link->out_samplerates) | 426 | && link->incfg.samplerates && link->outcfg.samplerates) |
| 427 | if (!ff_can_merge_samplerates(link->in_samplerates, | 427 | if (!ff_can_merge_samplerates(link->incfg.samplerates, |
| 428 | link->out_samplerates)) | 428 | link->outcfg.samplerates)) |
| 429 | convert_needed = 1; | 429 | convert_needed = 1; |
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | #define CHECKED_MERGE(field, ...) ((ret = ff_merge_ ## field(__VA_ARGS__)) <= 0) | 432 | #define CHECKED_MERGE(field, ...) ((ret = ff_merge_ ## field(__VA_ARGS__)) <= 0) |
| 433 | #define MERGE_DISPATCH(field, ...) \ | 433 | #define MERGE_DISPATCH(field, ...) \ |
| 434 | if (!(link->in_ ## field && link->out_ ## field)) { \ | 434 | if (!(link->incfg.field && link->outcfg.field)) { \ |
| 435 | count_delayed++; \ | 435 | count_delayed++; \ |
| 436 | } else if (link->in_ ## field == link->out_ ## field) { \ | 436 | } else if (link->incfg.field == link->outcfg.field) { \ |
| 437 | count_already_merged++; \ | 437 | count_already_merged++; \ |
| 438 | } else if (!convert_needed) { \ | 438 | } else if (!convert_needed) { \ |
| 439 | count_merged++; \ | 439 | count_merged++; \ |
| @@ -445,13 +445,13 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 5 unmodified lines | |||
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | if (link->type == AVMEDIA_TYPE_AUDIO) { | 447 | if (link->type == AVMEDIA_TYPE_AUDIO) { |
| 448 | MERGE_DISPATCH(channel_layouts, link->in_channel_layouts, | 448 | MERGE_DISPATCH(channel_layouts, link->incfg.channel_layouts, |
| 449 | link->out_channel_layouts) | 449 | link->outcfg.channel_layouts) |
| 450 | MERGE_DISPATCH(samplerates, link->in_samplerates, | 450 | MERGE_DISPATCH(samplerates, link->incfg.samplerates, |
| 451 | link->out_samplerates) | 451 | link->outcfg.samplerates) |
| 452 | } | 452 | } |
| 453 | MERGE_DISPATCH(formats, link->in_formats, | 453 | MERGE_DISPATCH(formats, link->incfg.formats, |
| 454 | link->out_formats, link->type) | 454 | link->outcfg.formats, link->type) |
| 455 | #undef MERGE_DISPATCH | 455 | #undef MERGE_DISPATCH |
| 456 | 456 | ||
| 457 | if (convert_needed) { | 457 | if (convert_needed) { |
| @@ -511,34 +511,34 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 53 unmodified lines | |||
| 511 | 511 | ||
| 512 | inlink = convert->inputs[0]; | 512 | inlink = convert->inputs[0]; |
| 513 | outlink = convert->outputs[0]; | 513 | outlink = convert->outputs[0]; |
| 514 | av_assert0( inlink-> in_formats->refcount > 0); | 514 | av_assert0( inlink->incfg.formats->refcount > 0); |
| 515 | av_assert0( inlink->out_formats->refcount > 0); | 515 | av_assert0( inlink->outcfg.formats->refcount > 0); |
| 516 | av_assert0(outlink-> in_formats->refcount > 0); | 516 | av_assert0(outlink->incfg.formats->refcount > 0); |
| 517 | av_assert0(outlink->out_formats->refcount > 0); | 517 | av_assert0(outlink->outcfg.formats->refcount > 0); |
| 518 | if (outlink->type == AVMEDIA_TYPE_AUDIO) { | 518 | if (outlink->type == AVMEDIA_TYPE_AUDIO) { |
| 519 | av_assert0( inlink-> in_samplerates->refcount > 0); | 519 | av_assert0( inlink-> incfg.samplerates->refcount > 0); |
| 520 | av_assert0( inlink->out_samplerates->refcount > 0); | 520 | av_assert0( inlink->outcfg.samplerates->refcount > 0); |
| 521 | av_assert0(outlink-> in_samplerates->refcount > 0); | 521 | av_assert0(outlink-> incfg.samplerates->refcount > 0); |
| 522 | av_assert0(outlink->out_samplerates->refcount > 0); | 522 | av_assert0(outlink->outcfg.samplerates->refcount > 0); |
| 523 | av_assert0( inlink-> in_channel_layouts->refcount > 0); | 523 | av_assert0( inlink-> incfg.channel_layouts->refcount > 0); |
| 524 | av_assert0( inlink->out_channel_layouts->refcount > 0); | 524 | av_assert0( inlink->outcfg.channel_layouts->refcount > 0); |
| 525 | av_assert0(outlink-> in_channel_layouts->refcount > 0); | 525 | av_assert0(outlink-> incfg.channel_layouts->refcount > 0); |
| 526 | av_assert0(outlink->out_channel_layouts->refcount > 0); | 526 | av_assert0(outlink->outcfg.channel_layouts->refcount > 0); |
| 527 | } | 527 | } |
| 528 | if (CHECKED_MERGE(formats, inlink->in_formats, | 528 | if (CHECKED_MERGE(formats, inlink->incfg.formats, |
| 529 | inlink->out_formats, inlink->type) || | 529 | inlink->outcfg.formats, inlink->type) || |
| 530 | CHECKED_MERGE(formats, outlink->in_formats, | 530 | CHECKED_MERGE(formats, outlink->incfg.formats, |
| 531 | outlink->out_formats, outlink->type) || | 531 | outlink->outcfg.formats, outlink->type) || |
| 532 | inlink->type == AVMEDIA_TYPE_AUDIO && | 532 | inlink->type == AVMEDIA_TYPE_AUDIO && |
| 533 | (CHECKED_MERGE(samplerates, inlink->in_samplerates, | 533 | (CHECKED_MERGE(samplerates, inlink->incfg.samplerates, |
| 534 | inlink->out_samplerates) || | 534 | inlink->outcfg.samplerates) || |
| 535 | CHECKED_MERGE(channel_layouts, inlink->in_channel_layouts, | 535 | CHECKED_MERGE(channel_layouts, inlink->incfg.channel_layouts, |
| 536 | inlink->out_channel_layouts)) || | 536 | inlink->outcfg.channel_layouts)) || |
| 537 | outlink->type == AVMEDIA_TYPE_AUDIO && | 537 | outlink->type == AVMEDIA_TYPE_AUDIO && |
| 538 | (CHECKED_MERGE(samplerates, outlink->in_samplerates, | 538 | (CHECKED_MERGE(samplerates, outlink->incfg.samplerates, |
| 539 | outlink->out_samplerates) || | 539 | outlink->outcfg.samplerates) || |
| 540 | CHECKED_MERGE(channel_layouts, outlink->in_channel_layouts, | 540 | CHECKED_MERGE(channel_layouts, outlink->incfg.channel_layouts, |
| 541 | outlink->out_channel_layouts))) { | 541 | outlink->outcfg.channel_layouts))) { |
| 542 | if (ret < 0) | 542 | if (ret < 0) |
| 543 | return ret; | 543 | return ret; |
| 544 | av_log(log_ctx, AV_LOG_ERROR, | 544 | av_log(log_ctx, AV_LOG_ERROR, |
| @@ -613,7 +613,7 @@ static enum AVSampleFormat find_best_sample_fmt_of_2(enum AVSampleFormat dst_fmt · 68 unmodified lines | |||
| 613 | 613 | ||
| 614 | static int pick_format(AVFilterLink *link, AVFilterLink *ref) | 614 | static int pick_format(AVFilterLink *link, AVFilterLink *ref) |
| 615 | { | 615 | { |
| 616 | if (!link || !link->in_formats) | 616 | if (!link || !link->incfg.formats) |
| 617 | return 0; | 617 | return 0; |
| 618 | 618 | ||
| 619 | if (link->type == AVMEDIA_TYPE_VIDEO) { | 619 | if (link->type == AVMEDIA_TYPE_VIDEO) { |
| @@ -622,67 +622,67 @@ static int pick_format(AVFilterLink *link, AVFilterLink *ref) · 2 unmodified lines | |||
| 622 | int has_alpha= av_pix_fmt_desc_get(ref->format)->nb_components % 2 == 0; | 622 | int has_alpha= av_pix_fmt_desc_get(ref->format)->nb_components % 2 == 0; |
| 623 | enum AVPixelFormat best= AV_PIX_FMT_NONE; | 623 | enum AVPixelFormat best= AV_PIX_FMT_NONE; |
| 624 | int i; | 624 | int i; |
| 625 | for (i=0; i<link->in_formats->nb_formats; i++) { | 625 | for (i = 0; i < link->incfg.formats->nb_formats; i++) { |
| 626 | enum AVPixelFormat p = link->in_formats->formats[i]; | 626 | enum AVPixelFormat p = link->incfg.formats->formats[i]; |
| 627 | best= av_find_best_pix_fmt_of_2(best, p, ref->format, has_alpha, NULL); | 627 | best= av_find_best_pix_fmt_of_2(best, p, ref->format, has_alpha, NULL); |
| 628 | } | 628 | } |
| 629 | av_log(link->src,AV_LOG_DEBUG, "picking %s out of %d ref:%s alpha:%d\n", | 629 | av_log(link->src,AV_LOG_DEBUG, "picking %s out of %d ref:%s alpha:%d\n", |
| 630 | av_get_pix_fmt_name(best), link->in_formats->nb_formats, | 630 | av_get_pix_fmt_name(best), link->incfg.formats->nb_formats, |
| 631 | av_get_pix_fmt_name(ref->format), has_alpha); | 631 | av_get_pix_fmt_name(ref->format), has_alpha); |
| 632 | link->in_formats->formats[0] = best; | 632 | link->incfg.formats->formats[0] = best; |
| 633 | } | 633 | } |
| 634 | } else if (link->type == AVMEDIA_TYPE_AUDIO) { | 634 | } else if (link->type == AVMEDIA_TYPE_AUDIO) { |
| 635 | if(ref && ref->type == AVMEDIA_TYPE_AUDIO){ | 635 | if(ref && ref->type == AVMEDIA_TYPE_AUDIO){ |
| 636 | enum AVSampleFormat best= AV_SAMPLE_FMT_NONE; | 636 | enum AVSampleFormat best= AV_SAMPLE_FMT_NONE; |
| 637 | int i; | 637 | int i; |
| 638 | for (i=0; i<link->in_formats->nb_formats; i++) { | 638 | for (i = 0; i < link->incfg.formats->nb_formats; i++) { |
| 639 | enum AVSampleFormat p = link->in_formats->formats[i]; | 639 | enum AVSampleFormat p = link->incfg.formats->formats[i]; |
| 640 | best = find_best_sample_fmt_of_2(best, p, ref->format); | 640 | best = find_best_sample_fmt_of_2(best, p, ref->format); |
| 641 | } | 641 | } |
| 642 | av_log(link->src,AV_LOG_DEBUG, "picking %s out of %d ref:%s\n", | 642 | av_log(link->src,AV_LOG_DEBUG, "picking %s out of %d ref:%s\n", |
| 643 | av_get_sample_fmt_name(best), link->in_formats->nb_formats, | 643 | av_get_sample_fmt_name(best), link->incfg.formats->nb_formats, |
| 644 | av_get_sample_fmt_name(ref->format)); | 644 | av_get_sample_fmt_name(ref->format)); |
| 645 | link->in_formats->formats[0] = best; | 645 | link->incfg.formats->formats[0] = best; |
| 646 | } | 646 | } |
| 647 | } | 647 | } |
| 648 | 648 | ||
| 649 | link->in_formats->nb_formats = 1; | 649 | link->incfg.formats->nb_formats = 1; |
| 650 | link->format = link->in_formats->formats[0]; | 650 | link->format = link->incfg.formats->formats[0]; |
| 651 | 651 | ||
| 652 | if (link->type == AVMEDIA_TYPE_AUDIO) { | 652 | if (link->type == AVMEDIA_TYPE_AUDIO) { |
| 653 | if (!link->in_samplerates->nb_formats) { | 653 | if (!link->incfg.samplerates->nb_formats) { |
| 654 | av_log(link->src, AV_LOG_ERROR, "Cannot select sample rate for" | 654 | av_log(link->src, AV_LOG_ERROR, "Cannot select sample rate for" |
| 655 | " the link between filters %s and %s.\n", link->src->name, | 655 | " the link between filters %s and %s.\n", link->src->name, |
| 656 | link->dst->name); | 656 | link->dst->name); |
| 657 | return AVERROR(EINVAL); | 657 | return AVERROR(EINVAL); |
| 658 | } | 658 | } |
| 659 | link->in_samplerates->nb_formats = 1; | 659 | link->incfg.samplerates->nb_formats = 1; |
| 660 | link->sample_rate = link->in_samplerates->formats[0]; | 660 | link->sample_rate = link->incfg.samplerates->formats[0]; |
| 661 | 661 | ||
| 662 | if (link->in_channel_layouts->all_layouts) { | 662 | if (link->incfg.channel_layouts->all_layouts) { |
| 663 | av_log(link->src, AV_LOG_ERROR, "Cannot select channel layout for" | 663 | av_log(link->src, AV_LOG_ERROR, "Cannot select channel layout for" |
| 664 | " the link between filters %s and %s.\n", link->src->name, | 664 | " the link between filters %s and %s.\n", link->src->name, |
| 665 | link->dst->name); | 665 | link->dst->name); |
| 666 | if (!link->in_channel_layouts->all_counts) | 666 | if (!link->incfg.channel_layouts->all_counts) |
| 667 | av_log(link->src, AV_LOG_ERROR, "Unknown channel layouts not " | 667 | av_log(link->src, AV_LOG_ERROR, "Unknown channel layouts not " |
| 668 | "supported, try specifying a channel layout using " | 668 | "supported, try specifying a channel layout using " |
| 669 | "'aformat=channel_layouts=something'.\n"); | 669 | "'aformat=channel_layouts=something'.\n"); |
| 670 | return AVERROR(EINVAL); | 670 | return AVERROR(EINVAL); |
| 671 | } | 671 | } |
| 672 | link->in_channel_layouts->nb_channel_layouts = 1; | 672 | link->incfg.channel_layouts->nb_channel_layouts = 1; |
| 673 | link->channel_layout = link->in_channel_layouts->channel_layouts[0]; | 673 | link->channel_layout = link->incfg.channel_layouts->channel_layouts[0]; |
| 674 | if ((link->channels = FF_LAYOUT2COUNT(link->channel_layout))) | 674 | if ((link->channels = FF_LAYOUT2COUNT(link->channel_layout))) |
| 675 | link->channel_layout = 0; | 675 | link->channel_layout = 0; |
| 676 | else | 676 | else |
| 677 | link->channels = av_get_channel_layout_nb_channels(link->channel_layout); | 677 | link->channels = av_get_channel_layout_nb_channels(link->channel_layout); |
| 678 | } | 678 | } |
| 679 | 679 | ||
| 680 | ff_formats_unref(&link->in_formats); | 680 | ff_formats_unref(&link->incfg.formats); |
| 681 | ff_formats_unref(&link->out_formats); | 681 | ff_formats_unref(&link->outcfg.formats); |
| 682 | ff_formats_unref(&link->in_samplerates); | 682 | ff_formats_unref(&link->incfg.samplerates); |
| 683 | ff_formats_unref(&link->out_samplerates); | 683 | ff_formats_unref(&link->outcfg.samplerates); |
| 684 | ff_channel_layouts_unref(&link->in_channel_layouts); | 684 | ff_channel_layouts_unref(&link->incfg.channel_layouts); |
| 685 | ff_channel_layouts_unref(&link->out_channel_layouts); | 685 | ff_channel_layouts_unref(&link->outcfg.channel_layouts); |
| 686 | 686 | ||
| 687 | return 0; | 687 | return 0; |
| 688 | } | 688 | } |
| @@ -693,27 +693,27 @@ do { \ · 4 unmodified lines | |||
| 693 | AVFilterLink *link = filter->inputs[i]; \ | 693 | AVFilterLink *link = filter->inputs[i]; \ |
| 694 | fmt_type fmt; \ | 694 | fmt_type fmt; \ |
| 695 | \ | 695 | \ |
| 696 | if (!link->out_ ## list || link->out_ ## list->nb != 1) \ | 696 | if (!link->outcfg.list || link->outcfg.list->nb != 1) \ |
| 697 | continue; \ | 697 | continue; \ |
| 698 | fmt = link->out_ ## list->var[0]; \ | 698 | fmt = link->outcfg.list->var[0]; \ |
| 699 | \ | 699 | \ |
| 700 | for (j = 0; j < filter->nb_outputs; j++) { \ | 700 | for (j = 0; j < filter->nb_outputs; j++) { \ |
| 701 | AVFilterLink *out_link = filter->outputs[j]; \ | 701 | AVFilterLink *out_link = filter->outputs[j]; \ |
| 702 | list_type *fmts; \ | 702 | list_type *fmts; \ |
| 703 | \ | 703 | \ |
| 704 | if (link->type != out_link->type || \ | 704 | if (link->type != out_link->type || \ |
| 705 | out_link->in_ ## list->nb == 1) \ | 705 | out_link->incfg.list->nb == 1) \ |
| 706 | continue; \ | 706 | continue; \ |
| 707 | fmts = out_link->in_ ## list; \ | 707 | fmts = out_link->incfg.list; \ |
| 708 | \ | 708 | \ |
| 709 | if (!out_link->in_ ## list->nb) { \ | 709 | if (!out_link->incfg.list->nb) { \ |
| 710 | if ((ret = add_format(&out_link->in_ ##list, fmt)) < 0)\ | 710 | if ((ret = add_format(&out_link->incfg.list, fmt)) < 0)\ |
| 711 | return ret; \ | 711 | return ret; \ |
| 712 | ret = 1; \ | 712 | ret = 1; \ |
| 713 | break; \ | 713 | break; \ |
| 714 | } \ | 714 | } \ |
| 715 | \ | 715 | \ |
| 716 | for (k = 0; k < out_link->in_ ## list->nb; k++) \ | 716 | for (k = 0; k < out_link->incfg.list->nb; k++) \ |
| 717 | if (fmts->var[k] == fmt) { \ | 717 | if (fmts->var[k] == fmt) { \ |
| 718 | fmts->var[0] = fmt; \ | 718 | fmts->var[0] = fmt; \ |
| 719 | fmts->nb = 1; \ | 719 | fmts->nb = 1; \ |
| @@ -738,16 +738,16 @@ static int reduce_formats_on_filter(AVFilterContext *filter) · 18 unmodified lines | |||
| 738 | AVFilterLink *inlink = filter->inputs[i]; | 738 | AVFilterLink *inlink = filter->inputs[i]; |
| 739 | uint64_t fmt; | 739 | uint64_t fmt; |
| 740 | 740 | ||
| 741 | if (!inlink->out_channel_layouts || | 741 | if (!inlink->outcfg.channel_layouts || |
| 742 | inlink->out_channel_layouts->nb_channel_layouts != 1) | 742 | inlink->outcfg.channel_layouts->nb_channel_layouts != 1) |
| 743 | continue; | 743 | continue; |
| 744 | fmt = inlink->out_channel_layouts->channel_layouts[0]; | 744 | fmt = inlink->outcfg.channel_layouts->channel_layouts[0]; |
| 745 | 745 | ||
| 746 | for (j = 0; j < filter->nb_outputs; j++) { | 746 | for (j = 0; j < filter->nb_outputs; j++) { |
| 747 | AVFilterLink *outlink = filter->outputs[j]; | 747 | AVFilterLink *outlink = filter->outputs[j]; |
| 748 | AVFilterChannelLayouts *fmts; | 748 | AVFilterChannelLayouts *fmts; |
| 749 | 749 | ||
| 750 | fmts = outlink->in_channel_layouts; | 750 | fmts = outlink->incfg.channel_layouts; |
| 751 | if (inlink->type != outlink->type || fmts->nb_channel_layouts == 1) | 751 | if (inlink->type != outlink->type || fmts->nb_channel_layouts == 1) |
| 752 | continue; | 752 | continue; |
| 753 | 753 | ||
| @@ -755,12 +755,12 @@ static int reduce_formats_on_filter(AVFilterContext *filter) · 1 unmodified line | |||
| 755 | (!FF_LAYOUT2COUNT(fmt) || fmts->all_counts)) { | 755 | (!FF_LAYOUT2COUNT(fmt) || fmts->all_counts)) { |
| 756 | /* Turn the infinite list into a singleton */ | 756 | /* Turn the infinite list into a singleton */ |
| 757 | fmts->all_layouts = fmts->all_counts = 0; | 757 | fmts->all_layouts = fmts->all_counts = 0; |
| 758 | if (ff_add_channel_layout(&outlink->in_channel_layouts, fmt) < 0) | 758 | if (ff_add_channel_layout(&outlink->incfg.channel_layouts, fmt) < 0) |
| 759 | ret = 1; | 759 | ret = 1; |
| 760 | break; | 760 | break; |
| 761 | } | 761 | } |
| 762 | 762 | ||
| 763 | for (k = 0; k < outlink->in_channel_layouts->nb_channel_layouts; k++) { | 763 | for (k = 0; k < outlink->incfg.channel_layouts->nb_channel_layouts; k++) { |
| 764 | if (fmts->channel_layouts[k] == fmt) { | 764 | if (fmts->channel_layouts[k] == fmt) { |
| 765 | fmts->channel_layouts[0] = fmt; | 765 | fmts->channel_layouts[0] = fmt; |
| 766 | fmts->nb_channel_layouts = 1; | 766 | fmts->nb_channel_layouts = 1; |
| @@ -801,24 +801,24 @@ static void swap_samplerates_on_filter(AVFilterContext *filter) · 34 unmodified lines | |||
| 801 | link = filter->inputs[i]; | 801 | link = filter->inputs[i]; |
| 802 | 802 | ||
| 803 | if (link->type == AVMEDIA_TYPE_AUDIO && | 803 | if (link->type == AVMEDIA_TYPE_AUDIO && |
| 804 | link->out_samplerates->nb_formats== 1) | 804 | link->outcfg.samplerates->nb_formats== 1) |
| 805 | break; | 805 | break; |
| 806 | } | 806 | } |
| 807 | if (i == filter->nb_inputs) | 807 | if (i == filter->nb_inputs) |
| 808 | return; | 808 | return; |
| 809 | 809 | ||
| 810 | sample_rate = link->out_samplerates->formats[0]; | 810 | sample_rate = link->outcfg.samplerates->formats[0]; |
| 811 | 811 | ||
| 812 | for (i = 0; i < filter->nb_outputs; i++) { | 812 | for (i = 0; i < filter->nb_outputs; i++) { |
| 813 | AVFilterLink *outlink = filter->outputs[i]; | 813 | AVFilterLink *outlink = filter->outputs[i]; |
| 814 | int best_idx, best_diff = INT_MAX; | 814 | int best_idx, best_diff = INT_MAX; |
| 815 | 815 | ||
| 816 | if (outlink->type != AVMEDIA_TYPE_AUDIO || | 816 | if (outlink->type != AVMEDIA_TYPE_AUDIO || |
| 817 | outlink->in_samplerates->nb_formats < 2) | 817 | outlink->incfg.samplerates->nb_formats < 2) |
| 818 | continue; | 818 | continue; |
| 819 | 819 | ||
| 820 | for (j = 0; j < outlink->in_samplerates->nb_formats; j++) { | 820 | for (j = 0; j < outlink->incfg.samplerates->nb_formats; j++) { |
| 821 | int diff = abs(sample_rate - outlink->in_samplerates->formats[j]); | 821 | int diff = abs(sample_rate - outlink->incfg.samplerates->formats[j]); |
| 822 | 822 | ||
| 823 | av_assert0(diff < INT_MAX); // This would lead to the use of uninitialized best_diff but is only possible with invalid sample rates | 823 | av_assert0(diff < INT_MAX); // This would lead to the use of uninitialized best_diff but is only possible with invalid sample rates |
| 824 | 824 | ||
| @@ -827,8 +827,8 @@ static void swap_samplerates_on_filter(AVFilterContext *filter) · 2 unmodified lines | |||
| 827 | best_idx = j; | 827 | best_idx = j; |
| 828 | } | 828 | } |
| 829 | } | 829 | } |
| 830 | FFSWAP(int, outlink->in_samplerates->formats[0], | 830 | FFSWAP(int, outlink->incfg.samplerates->formats[0], |
| 831 | outlink->in_samplerates->formats[best_idx]); | 831 | outlink->incfg.samplerates->formats[best_idx]); |
| 832 | } | 832 | } |
| 833 | } | 833 | } |
| 834 | 834 | ||
| @@ -883,7 +883,7 @@ static void swap_channel_layouts_on_filter(AVFilterContext *filter) · 48 unmodified lines | |||
| 883 | link = filter->inputs[i]; | 883 | link = filter->inputs[i]; |
| 884 | 884 | ||
| 885 | if (link->type == AVMEDIA_TYPE_AUDIO && | 885 | if (link->type == AVMEDIA_TYPE_AUDIO && |
| 886 | link->out_channel_layouts->nb_channel_layouts == 1) | 886 | link->outcfg.channel_layouts->nb_channel_layouts == 1) |
| 887 | break; | 887 | break; |
| 888 | } | 888 | } |
| 889 | if (i == filter->nb_inputs) | 889 | if (i == filter->nb_inputs) |
| @@ -894,12 +894,12 @@ static void swap_channel_layouts_on_filter(AVFilterContext *filter) · 4 unmodified lines | |||
| 894 | int best_idx = -1, best_score = INT_MIN, best_count_diff = INT_MAX; | 894 | int best_idx = -1, best_score = INT_MIN, best_count_diff = INT_MAX; |
| 895 | 895 | ||
| 896 | if (outlink->type != AVMEDIA_TYPE_AUDIO || | 896 | if (outlink->type != AVMEDIA_TYPE_AUDIO || |
| 897 | outlink->in_channel_layouts->nb_channel_layouts < 2) | 897 | outlink->incfg.channel_layouts->nb_channel_layouts < 2) |
| 898 | continue; | 898 | continue; |
| 899 | 899 | ||
| 900 | for (j = 0; j < outlink->in_channel_layouts->nb_channel_layouts; j++) { | 900 | for (j = 0; j < outlink->incfg.channel_layouts->nb_channel_layouts; j++) { |
| 901 | uint64_t in_chlayout = link->out_channel_layouts->channel_layouts[0]; | 901 | uint64_t in_chlayout = link->outcfg.channel_layouts->channel_layouts[0]; |
| 902 | uint64_t out_chlayout = outlink->in_channel_layouts->channel_layouts[j]; | 902 | uint64_t out_chlayout = outlink->incfg.channel_layouts->channel_layouts[j]; |
| 903 | int in_channels = av_get_channel_layout_nb_channels(in_chlayout); | 903 | int in_channels = av_get_channel_layout_nb_channels(in_chlayout); |
| 904 | int out_channels = av_get_channel_layout_nb_channels(out_chlayout); | 904 | int out_channels = av_get_channel_layout_nb_channels(out_chlayout); |
| 905 | int count_diff = out_channels - in_channels; | 905 | int count_diff = out_channels - in_channels; |
| @@ -957,8 +957,8 @@ static void swap_channel_layouts_on_filter(AVFilterContext *filter) · 51 unmodified lines | |||
| 957 | } | 957 | } |
| 958 | } | 958 | } |
| 959 | av_assert0(best_idx >= 0); | 959 | av_assert0(best_idx >= 0); |
| 960 | FFSWAP(uint64_t, outlink->in_channel_layouts->channel_layouts[0], | 960 | FFSWAP(uint64_t, outlink->incfg.channel_layouts->channel_layouts[0], |
| 961 | outlink->in_channel_layouts->channel_layouts[best_idx]); | 961 | outlink->incfg.channel_layouts->channel_layouts[best_idx]); |
| 962 | } | 962 | } |
| 963 | 963 | ||
| 964 | } | 964 | } |
| @@ -981,13 +981,13 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter) · 16 unmodified lines | |||
| 981 | link = filter->inputs[i]; | 981 | link = filter->inputs[i]; |
| 982 | 982 | ||
| 983 | if (link->type == AVMEDIA_TYPE_AUDIO && | 983 | if (link->type == AVMEDIA_TYPE_AUDIO && |
| 984 | link->out_formats->nb_formats == 1) | 984 | link->outcfg.formats->nb_formats == 1) |
| 985 | break; | 985 | break; |
| 986 | } | 986 | } |
| 987 | if (i == filter->nb_inputs) | 987 | if (i == filter->nb_inputs) |
| 988 | return; | 988 | return; |
| 989 | 989 | ||
| 990 | format = link->out_formats->formats[0]; | 990 | format = link->outcfg.formats->formats[0]; |
| 991 | bps = av_get_bytes_per_sample(format); | 991 | bps = av_get_bytes_per_sample(format); |
| 992 | 992 | ||
| 993 | for (i = 0; i < filter->nb_outputs; i++) { | 993 | for (i = 0; i < filter->nb_outputs; i++) { |
| @@ -995,11 +995,11 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter) · 1 unmodified line | |||
| 995 | int best_idx = -1, best_score = INT_MIN; | 995 | int best_idx = -1, best_score = INT_MIN; |
| 996 | 996 | ||
| 997 | if (outlink->type != AVMEDIA_TYPE_AUDIO || | 997 | if (outlink->type != AVMEDIA_TYPE_AUDIO || |
| 998 | outlink->in_formats->nb_formats < 2) | 998 | outlink->incfg.formats->nb_formats < 2) |
| 999 | continue; | 999 | continue; |
| 1000 | 1000 | ||
| 1001 | for (j = 0; j < outlink->in_formats->nb_formats; j++) { | 1001 | for (j = 0; j < outlink->incfg.formats->nb_formats; j++) { |
| 1002 | int out_format = outlink->in_formats->formats[j]; | 1002 | int out_format = outlink->incfg.formats->formats[j]; |
| 1003 | int out_bps = av_get_bytes_per_sample(out_format); | 1003 | int out_bps = av_get_bytes_per_sample(out_format); |
| 1004 | int score; | 1004 | int score; |
| 1005 | 1005 | ||
| @@ -1026,8 +1026,8 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter) · 20 unmodified lines | |||
| 1026 | } | 1026 | } |
| 1027 | } | 1027 | } |
| 1028 | av_assert0(best_idx >= 0); | 1028 | av_assert0(best_idx >= 0); |
| 1029 | FFSWAP(int, outlink->in_formats->formats[0], | 1029 | FFSWAP(int, outlink->incfg.formats->formats[0], |
| 1030 | outlink->in_formats->formats[best_idx]); | 1030 | outlink->incfg.formats->formats[best_idx]); |
| 1031 | } | 1031 | } |
| 1032 | } | 1032 | } |
| 1033 | 1033 | ||
| @@ -1051,7 +1051,7 @@ static int pick_formats(AVFilterGraph *graph) · 17 unmodified lines | |||
| 1051 | AVFilterContext *filter = graph->filters[i]; | 1051 | AVFilterContext *filter = graph->filters[i]; |
| 1052 | if (filter->nb_inputs){ | 1052 | if (filter->nb_inputs){ |
| 1053 | for (j = 0; j < filter->nb_inputs; j++){ | 1053 | for (j = 0; j < filter->nb_inputs; j++){ |
| 1054 | if(filter->inputs[j]->in_formats && filter->inputs[j]->in_formats->nb_formats == 1) { | 1054 | if (filter->inputs[j]->incfg.formats && filter->inputs[j]->incfg.formats->nb_formats == 1) { |
| 1055 | if ((ret = pick_format(filter->inputs[j], NULL)) < 0) | 1055 | if ((ret = pick_format(filter->inputs[j], NULL)) < 0) |
| 1056 | return ret; | 1056 | return ret; |
| 1057 | change = 1; | 1057 | change = 1; |
| @@ -1060,7 +1060,7 @@ static int pick_formats(AVFilterGraph *graph) · 2 unmodified lines | |||
| 1060 | } | 1060 | } |
| 1061 | if (filter->nb_outputs){ | 1061 | if (filter->nb_outputs){ |
| 1062 | for (j = 0; j < filter->nb_outputs; j++){ | 1062 | for (j = 0; j < filter->nb_outputs; j++){ |
| 1063 | if(filter->outputs[j]->in_formats && filter->outputs[j]->in_formats->nb_formats == 1) { | 1063 | if (filter->outputs[j]->incfg.formats && filter->outputs[j]->incfg.formats->nb_formats == 1) { |
| 1064 | if ((ret = pick_format(filter->outputs[j], NULL)) < 0) | 1064 | if ((ret = pick_format(filter->outputs[j], NULL)) < 0) |
| 1065 | return ret; | 1065 | return ret; |
| 1066 | change = 1; | 1066 | change = 1; |
| @@ -1069,7 +1069,7 @@ static int pick_formats(AVFilterGraph *graph) · 2 unmodified lines | |||
| 1069 | } | 1069 | } |
| 1070 | if (filter->nb_inputs && filter->nb_outputs && filter->inputs[0]->format>=0) { | 1070 | if (filter->nb_inputs && filter->nb_outputs && filter->inputs[0]->format>=0) { |
| 1071 | for (j = 0; j < filter->nb_outputs; j++) { | 1071 | for (j = 0; j < filter->nb_outputs; j++) { |
| 1072 | if(filter->outputs[j]->format<0) { | 1072 | if (filter->outputs[j]->format<0) { |
| 1073 | if ((ret = pick_format(filter->outputs[j], filter->inputs[0])) < 0) | 1073 | if ((ret = pick_format(filter->outputs[j], filter->inputs[0])) < 0) |
| 1074 | return ret; | 1074 | return ret; |
| 1075 | change = 1; | 1075 | change = 1; |