Browse code

lavfi/ebur128: use same ref for inputs and outputs.

Fixes Ticket2342.

Clément Bœsch authored on 2013/03/14 22:36:32
Showing 1 changed files
... ...
@@ -665,22 +665,6 @@ static int query_formats(AVFilterContext *ctx)
665 665
     static const int input_srate[] = {48000, -1}; // ITU-R BS.1770 provides coeff only for 48kHz
666 666
     static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE };
667 667
 
668
-    /* set input audio formats */
669
-    formats = ff_make_format_list(sample_fmts);
670
-    if (!formats)
671
-        return AVERROR(ENOMEM);
672
-    ff_formats_ref(formats, &inlink->out_formats);
673
-
674
-    layouts = ff_all_channel_layouts();
675
-    if (!layouts)
676
-        return AVERROR(ENOMEM);
677
-    ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts);
678
-
679
-    formats = ff_make_format_list(input_srate);
680
-    if (!formats)
681
-        return AVERROR(ENOMEM);
682
-    ff_formats_ref(formats, &inlink->out_samplerates);
683
-
684 668
     /* set optional output video format */
685 669
     if (ebur128->do_video) {
686 670
         formats = ff_make_format_list(pix_fmts);
... ...
@@ -690,20 +674,25 @@ static int query_formats(AVFilterContext *ctx)
690 690
         outlink = ctx->outputs[1];
691 691
     }
692 692
 
693
-    /* set audio output formats (same as input since it's just a passthrough) */
693
+    /* set input and output audio formats
694
+     * Note: ff_set_common_* functions are not used because they affect all the
695
+     * links, and thus break the video format negociation */
694 696
     formats = ff_make_format_list(sample_fmts);
695 697
     if (!formats)
696 698
         return AVERROR(ENOMEM);
699
+    ff_formats_ref(formats, &inlink->out_formats);
697 700
     ff_formats_ref(formats, &outlink->in_formats);
698 701
 
699 702
     layouts = ff_all_channel_layouts();
700 703
     if (!layouts)
701 704
         return AVERROR(ENOMEM);
705
+    ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts);
702 706
     ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts);
703 707
 
704 708
     formats = ff_make_format_list(input_srate);
705 709
     if (!formats)
706 710
         return AVERROR(ENOMEM);
711
+    ff_formats_ref(formats, &inlink->out_samplerates);
707 712
     ff_formats_ref(formats, &outlink->in_samplerates);
708 713
 
709 714
     return 0;