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