Browse code

lavfi: drop planar/packed negotiation support

The planar/packed switch and the packing_formats list is no longer
required, since the planar/packed information is now stored in the sample
format enum.

This is technically a major API break, possibly it should be not too
painful as we marked the audio filtering API as unstable.

Stefano Sabatini authored on 2012/05/13 00:38:47
Showing 28 changed files
... ...
@@ -88,7 +88,6 @@ static int init_filters(const char *filters_descr)
88 88
     AVFilterInOut *outputs = avfilter_inout_alloc();
89 89
     AVFilterInOut *inputs  = avfilter_inout_alloc();
90 90
     const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, -1 };
91
-    const int packing_fmts[]                = { AVFILTER_PACKED, -1 };
92 91
     const int64_t *chlayouts                = avfilter_all_channel_layouts;
93 92
     AVABufferSinkParams *abuffersink_params;
94 93
     const AVFilterLink *outlink;
... ...
@@ -98,7 +97,7 @@ static int init_filters(const char *filters_descr)
98 98
     /* buffer audio source: the decoded frames from the decoder will be inserted here. */
99 99
     if (!dec_ctx->channel_layout)
100 100
         dec_ctx->channel_layout = av_get_default_channel_layout(dec_ctx->channels);
101
-    snprintf(args, sizeof(args), "%d:%d:0x%"PRIx64":packed",
101
+    snprintf(args, sizeof(args), "%d:%d:0x%"PRIx64,
102 102
              dec_ctx->sample_rate, dec_ctx->sample_fmt, dec_ctx->channel_layout);
103 103
     ret = avfilter_graph_create_filter(&buffersrc_ctx, abuffersrc, "in",
104 104
                                        args, NULL, filter_graph);
... ...
@@ -111,7 +110,6 @@ static int init_filters(const char *filters_descr)
111 111
     abuffersink_params = av_abuffersink_params_alloc();
112 112
     abuffersink_params->sample_fmts     = sample_fmts;
113 113
     abuffersink_params->channel_layouts = chlayouts;
114
-    abuffersink_params->packing_fmts    = packing_fmts;
115 114
     ret = avfilter_graph_create_filter(&buffersink_ctx, abuffersink, "out",
116 115
                                        NULL, abuffersink_params, filter_graph);
117 116
     av_free(abuffersink_params);
... ...
@@ -15,7 +15,8 @@ Format negotiation
15 15
   the list supported formats.
16 16
 
17 17
   For video links, that means pixel format. For audio links, that means
18
-  channel layout, sample format and sample packing.
18
+  channel layout, and sample format (the sample packing is implied by the
19
+  sample format).
19 20
 
20 21
   The lists are not just lists, they are references to shared objects. When
21 22
   the negotiation mechanism computes the intersection of the formats
... ...
@@ -146,7 +146,7 @@ Convert the input audio to one of the specified formats. The framework will
146 146
 negotiate the most appropriate format to minimize conversions.
147 147
 
148 148
 The filter accepts three lists of formats, separated by ":", in the form:
149
-"@var{sample_formats}:@var{channel_layouts}:@var{packing_formats}".
149
+"@var{sample_formats}:@var{channel_layouts}".
150 150
 
151 151
 Elements in each list are separated by "," which has to be escaped in the
152 152
 filtergraph specification.
... ...
@@ -156,9 +156,9 @@ supported formats.
156 156
 
157 157
 Some examples follow:
158 158
 @example
159
-aformat=u8\\,s16:mono:packed
159
+aformat=u8\\,s16:mono
160 160
 
161
-aformat=s16:mono\\,stereo:all
161
+aformat=s16:mono\\,stereo
162 162
 @end example
163 163
 
164 164
 @section amerge
... ...
@@ -184,7 +184,7 @@ On the other hand, if both input are in stereo, the output channels will be
184 184
 in the default order: a1, a2, b1, b2, and the channel layout will be
185 185
 arbitrarily set to 4.0, which may or may not be the expected value.
186 186
 
187
-Both inputs must have the same sample rate, format and packing.
187
+Both inputs must have the same sample rate, and format.
188 188
 
189 189
 If inputs do not have the same duration, the output will stop with the
190 190
 shortest.
... ...
@@ -293,9 +293,6 @@ number of samples (per each channel) contained in the filtered frame
293 293
 @item rate
294 294
 sample rate for the audio frame
295 295
 
296
-@item planar
297
-if the packing format is planar, 0 if packed
298
-
299 296
 @item checksum
300 297
 Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
301 298
 
... ...
@@ -566,7 +563,7 @@ This source is mainly intended for a programmatic use, in particular
566 566
 through the interface defined in @file{libavfilter/asrc_abuffer.h}.
567 567
 
568 568
 It accepts the following mandatory parameters:
569
-@var{sample_rate}:@var{sample_fmt}:@var{channel_layout}:@var{packing}
569
+@var{sample_rate}:@var{sample_fmt}:@var{channel_layout}
570 570
 
571 571
 @table @option
572 572
 
... ...
@@ -584,23 +581,19 @@ Either a channel layout name from channel_layout_map in
584 584
 @file{libavutil/audioconvert.c} or its corresponding integer representation
585 585
 from the AV_CH_LAYOUT_* macros in @file{libavutil/audioconvert.h}
586 586
 
587
-@item packing
588
-Either "packed" or "planar", or their integer representation: 0 or 1
589
-respectively.
590
-
591 587
 @end table
592 588
 
593 589
 For example:
594 590
 @example
595
-abuffer=44100:s16:stereo:planar
591
+abuffer=44100:s16p:stereo
596 592
 @end example
597 593
 
598 594
 will instruct the source to accept planar 16bit signed stereo at 44100Hz.
599
-Since the sample format with name "s16" corresponds to the number
600
-1 and the "stereo" channel layout corresponds to the value 0x3, this is
595
+Since the sample format with name "s16p" corresponds to the number
596
+6 and the "stereo" channel layout corresponds to the value 0x3, this is
601 597
 equivalent to:
602 598
 @example
603
-abuffer=44100:1:0x3:1
599
+abuffer=44100:6:0x3
604 600
 @end example
605 601
 
606 602
 @section aevalsrc
... ...
@@ -211,11 +211,9 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
211 211
                                                   AV_SAMPLE_FMT_S32,
212 212
                                                   AV_SAMPLE_FMT_FLT,
213 213
                                                   AV_SAMPLE_FMT_DBL, -1 };
214
-            const int packing_fmts[] = { AVFILTER_PACKED, -1 };
215 214
             const int64_t *chlayouts = avfilter_all_channel_layouts;
216 215
             AVABufferSinkParams *abuffersink_params = av_abuffersink_params_alloc();
217 216
             abuffersink_params->sample_fmts = sample_fmts;
218
-            abuffersink_params->packing_fmts = packing_fmts;
219 217
             abuffersink_params->channel_layouts = chlayouts;
220 218
 
221 219
             ret = avfilter_graph_create_filter(&sink, abuffersink,
... ...
@@ -73,7 +73,6 @@ static int query_formats(AVFilterContext *ctx)
73 73
     AConvertContext *aconvert = ctx->priv;
74 74
     AVFilterLink *inlink  = ctx->inputs[0];
75 75
     AVFilterLink *outlink = ctx->outputs[0];
76
-    int out_packing = av_sample_fmt_is_planar(aconvert->out_sample_fmt);
77 76
     AVFilterChannelLayouts *layouts;
78 77
 
79 78
     avfilter_formats_ref(avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO),
... ...
@@ -96,12 +95,6 @@ static int query_formats(AVFilterContext *ctx)
96 96
         ff_channel_layouts_ref(ff_all_channel_layouts(),
97 97
                              &outlink->in_channel_layouts);
98 98
 
99
-    avfilter_formats_ref(avfilter_make_all_packing_formats(),
100
-                         &inlink->out_packing);
101
-    formats = NULL;
102
-    avfilter_add_format(&formats, out_packing);
103
-    avfilter_formats_ref(formats, &outlink->in_packing);
104
-
105 99
     return 0;
106 100
 }
107 101
 
... ...
@@ -134,9 +127,9 @@ static int config_output(AVFilterLink *outlink)
134 134
     av_get_channel_layout_string(buf2, sizeof(buf2),
135 135
                                  -1, outlink->channel_layout);
136 136
     av_log(ctx, AV_LOG_INFO,
137
-           "fmt:%s cl:%s planar:%i -> fmt:%s cl:%s planar:%i\n",
138
-           av_get_sample_fmt_name(inlink ->format), buf1, inlink ->planar,
139
-           av_get_sample_fmt_name(outlink->format), buf2, outlink->planar);
137
+           "fmt:%s cl:%s -> fmt:%s cl:%s\n",
138
+           av_get_sample_fmt_name(inlink ->format), buf1,
139
+           av_get_sample_fmt_name(outlink->format), buf2);
140 140
 
141 141
     return 0;
142 142
 }
... ...
@@ -153,7 +146,6 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamplesref
153 153
 
154 154
     avfilter_copy_buffer_ref_props(outsamplesref, insamplesref);
155 155
     outsamplesref->audio->channel_layout = outlink->channel_layout;
156
-    outsamplesref->audio->planar         = outlink->planar;
157 156
 
158 157
     ff_filter_samples(outlink, outsamplesref);
159 158
     avfilter_unref_buffer(insamplesref);
... ...
@@ -161,7 +153,7 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamplesref
161 161
 
162 162
 AVFilter avfilter_af_aconvert = {
163 163
     .name          = "aconvert",
164
-    .description   = NULL_IF_CONFIG_SMALL("Convert the input audio to sample_fmt:channel_layout:packed_fmt."),
164
+    .description   = NULL_IF_CONFIG_SMALL("Convert the input audio to sample_fmt:channel_layout."),
165 165
     .priv_size     = sizeof(AConvertContext),
166 166
     .init          = init,
167 167
     .uninit        = uninit,
... ...
@@ -54,7 +54,6 @@ static int query_formats(AVFilterContext *ctx)
54 54
 {
55 55
     AMergeContext *am = ctx->priv;
56 56
     int64_t inlayout[2], outlayout;
57
-    const int packing_fmts[] = { AVFILTER_PACKED, -1 };
58 57
     AVFilterFormats *formats;
59 58
     AVFilterChannelLayouts *layouts;
60 59
     int i;
... ...
@@ -97,10 +96,8 @@ static int query_formats(AVFilterContext *ctx)
97 97
                 if ((inlayout[i] >> c) & 1)
98 98
                     *(route[i]++) = out_ch_number++;
99 99
     }
100
-    formats = avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO);
100
+    formats = avfilter_make_format_list(ff_packed_sample_fmts);
101 101
     avfilter_set_common_sample_formats(ctx, formats);
102
-    formats = avfilter_make_format_list(packing_fmts);
103
-    avfilter_set_common_packing_formats(ctx, formats);
104 102
     for (i = 0; i < 2; i++) {
105 103
         layouts = NULL;
106 104
         ff_add_channel_layout(&layouts, inlayout[i]);
... ...
@@ -222,7 +219,6 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
222 222
     avfilter_copy_buffer_ref_props(outbuf, *inbuf[0]);
223 223
     outbuf->audio->nb_samples     = nb_samples;
224 224
     outbuf->audio->channel_layout = outlink->channel_layout;
225
-    outbuf->audio->planar         = outlink->planar;
226 225
 
227 226
     while (nb_samples) {
228 227
         ns = nb_samples;
... ...
@@ -50,7 +50,7 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
50 50
     int linesize =
51 51
         samplesref->audio->nb_samples *
52 52
         av_get_bytes_per_sample(samplesref->format);
53
-    if (!samplesref->audio->planar) /* packed layout */
53
+    if (!av_sample_fmt_is_planar(samplesref->format))
54 54
         linesize *= av_get_channel_layout_nb_channels(samplesref->audio->channel_layout);
55 55
 
56 56
     for (plane = 0; samplesref->data[plane] && plane < 8; plane++) {
... ...
@@ -66,7 +66,7 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
66 66
 
67 67
     av_log(ctx, AV_LOG_INFO,
68 68
            "n:%d pts:%s pts_time:%s pos:%"PRId64" "
69
-           "fmt:%s chlayout:%s nb_samples:%d rate:%d planar:%d "
69
+           "fmt:%s chlayout:%s nb_samples:%d rate:%d "
70 70
            "checksum:%08X plane_checksum[%08X",
71 71
            showinfo->frame,
72 72
            av_ts2str(samplesref->pts), av_ts2timestr(samplesref->pts, &inlink->time_base),
... ...
@@ -75,7 +75,6 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
75 75
            chlayout_str,
76 76
            samplesref->audio->nb_samples,
77 77
            samplesref->audio->sample_rate,
78
-           samplesref->audio->planar,
79 78
            checksum,
80 79
            plane_checksum[0]);
81 80
 
... ...
@@ -87,9 +87,6 @@ static int query_formats(AVFilterContext *ctx)
87 87
         formats = ctx->inputs[i]->in_formats;
88 88
         avfilter_formats_ref(formats, &ctx->inputs[i]->out_formats);
89 89
         avfilter_formats_ref(formats, &ctx->outputs[i]->in_formats);
90
-        formats = ctx->inputs[i]->in_packing;
91
-        avfilter_formats_ref(formats, &ctx->inputs[i]->out_packing);
92
-        avfilter_formats_ref(formats, &ctx->outputs[i]->in_packing);
93 90
         layouts = ctx->inputs[i]->in_channel_layouts;
94 91
         ff_channel_layouts_ref(layouts, &ctx->inputs[i]->out_channel_layouts);
95 92
         ff_channel_layouts_ref(layouts, &ctx->outputs[i]->in_channel_layouts);
... ...
@@ -86,9 +86,6 @@ static int query_formats(AVFilterContext *ctx)
86 86
     avfilter_set_common_sample_formats(ctx, formats);
87 87
     ff_add_channel_layout(&layout, AV_CH_LAYOUT_STEREO);
88 88
     ff_set_common_channel_layouts(ctx, layout);
89
-    formats = NULL;
90
-    avfilter_add_format(&formats, AVFILTER_PACKED);
91
-    avfilter_set_common_packing_formats(ctx, formats);
92 89
     ff_set_common_samplerates(ctx, avfilter_make_format_list(sample_rates));
93 90
 
94 91
     return 0;
... ...
@@ -218,7 +218,6 @@ static int query_formats(AVFilterContext *ctx)
218 218
     pan->pure_gains = are_gains_pure(pan);
219 219
     /* libswr supports any sample and packing formats */
220 220
     avfilter_set_common_sample_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO));
221
-    avfilter_set_common_packing_formats(ctx, avfilter_make_all_packing_formats());
222 221
 
223 222
     // inlink supports any channel layout
224 223
     layouts = ff_all_channel_layouts();
... ...
@@ -348,7 +347,6 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
348 348
     swr_convert(pan->swr, outsamples->data, n, (void *)insamples->data, n);
349 349
     avfilter_copy_buffer_ref_props(outsamples, insamples);
350 350
     outsamples->audio->channel_layout = outlink->channel_layout;
351
-    outsamples->audio->planar         = outlink->planar;
352 351
 
353 352
     ff_filter_samples(outlink, outsamples);
354 353
     avfilter_unref_buffer(insamples);
... ...
@@ -136,7 +136,6 @@ static int query_formats(AVFilterContext *ctx)
136 136
         AV_SAMPLE_FMT_DBL,
137 137
         AV_SAMPLE_FMT_NONE
138 138
     };
139
-    int packing_fmts[] = { AVFILTER_PACKED, -1 };
140 139
 
141 140
     layouts = ff_all_channel_layouts();
142 141
     if (!layouts)
... ...
@@ -148,11 +147,6 @@ static int query_formats(AVFilterContext *ctx)
148 148
         return AVERROR(ENOMEM);
149 149
     avfilter_set_common_sample_formats(ctx, formats);
150 150
 
151
-    formats = avfilter_make_format_list(packing_fmts);
152
-    if (!formats)
153
-        return AVERROR(ENOMEM);
154
-    avfilter_set_common_packing_formats(ctx, formats);
155
-
156 151
     formats = ff_all_samplerates();
157 152
     if (!formats)
158 153
         return AVERROR(ENOMEM);
... ...
@@ -91,7 +91,6 @@ static int query_formats(AVFilterContext *ctx)
91 91
         AV_SAMPLE_FMT_DBL,
92 92
         AV_SAMPLE_FMT_NONE
93 93
     };
94
-    int packing_fmts[] = { AVFILTER_PACKED, -1 };
95 94
 
96 95
     layouts = ff_all_channel_layouts();
97 96
     if (!layouts)
... ...
@@ -103,11 +102,6 @@ static int query_formats(AVFilterContext *ctx)
103 103
         return AVERROR(ENOMEM);
104 104
     avfilter_set_common_sample_formats(ctx, formats);
105 105
 
106
-    formats = avfilter_make_format_list(packing_fmts);
107
-    if (!formats)
108
-        return AVERROR(ENOMEM);
109
-    avfilter_set_common_packing_formats(ctx, formats);
110
-
111 106
     formats = ff_all_samplerates();
112 107
     if (!formats)
113 108
         return AVERROR(ENOMEM);
... ...
@@ -187,11 +187,9 @@ static int query_formats(AVFilterContext *ctx)
187 187
     EvalContext *eval = ctx->priv;
188 188
     enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE };
189 189
     int64_t chlayouts[] = { eval->chlayout, -1 };
190
-    int packing_fmts[] = { AVFILTER_PLANAR, -1 };
191 190
 
192 191
     avfilter_set_common_sample_formats (ctx, avfilter_make_format_list(sample_fmts));
193 192
     ff_set_common_channel_layouts(ctx, avfilter_make_format64_list(chlayouts));
194
-    avfilter_set_common_packing_formats(ctx, avfilter_make_format_list(packing_fmts));
195 193
 
196 194
     return 0;
197 195
 }
... ...
@@ -100,9 +100,9 @@ AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data,
100 100
 
101 101
     samplesref->audio->nb_samples     = nb_samples;
102 102
     samplesref->audio->channel_layout = channel_layout;
103
-    samplesref->audio->planar         = av_sample_fmt_is_planar(sample_fmt);
104 103
 
105
-    planes = samplesref->audio->planar ? av_get_channel_layout_nb_channels(channel_layout) : 1;
104
+    planes = av_sample_fmt_is_planar(sample_fmt) ?
105
+        av_get_channel_layout_nb_channels(channel_layout) : 1;
106 106
 
107 107
     /* make sure the buffer gets read permission or it's useless for output */
108 108
     samplesref->perms = perms | AV_PERM_READ;
... ...
@@ -24,6 +24,23 @@
24 24
 
25 25
 #include "avfilter.h"
26 26
 
27
+static const enum AVSampleFormat ff_packed_sample_fmts[] = {
28
+    AV_SAMPLE_FMT_U8,
29
+    AV_SAMPLE_FMT_S16,
30
+    AV_SAMPLE_FMT_S32,
31
+    AV_SAMPLE_FMT_FLT,
32
+    AV_SAMPLE_FMT_DBL,
33
+    AV_SAMPLE_FMT_NONE
34
+};
35
+
36
+static const enum AVSampleFormat ff_planar_sample_fmts[] = {
37
+    AV_SAMPLE_FMT_U8P,
38
+    AV_SAMPLE_FMT_S16P,
39
+    AV_SAMPLE_FMT_S32P,
40
+    AV_SAMPLE_FMT_FLTP,
41
+    AV_SAMPLE_FMT_DBLP,
42
+    AV_SAMPLE_FMT_NONE
43
+};
27 44
 
28 45
 /** default handler for get_audio_buffer() for audio inputs */
29 46
 AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,
... ...
@@ -148,9 +148,6 @@ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
148 148
     if (link->out_channel_layouts)
149 149
         ff_channel_layouts_changeref(&link->out_channel_layouts,
150 150
                                      &filt->outputs[filt_dstpad_idx]->out_channel_layouts);
151
-    if (link->out_packing)
152
-        avfilter_formats_changeref(&link->out_packing,
153
-                                   &filt->outputs[filt_dstpad_idx]->out_packing);
154 151
     if (link->out_samplerates)
155 152
         avfilter_formats_changeref(&link->out_samplerates,
156 153
                                    &filt->outputs[filt_dstpad_idx]->out_samplerates);
... ...
@@ -121,7 +121,9 @@ typedef struct AVFilterBufferRefAudioProps {
121 121
     uint64_t channel_layout;    ///< channel layout of audio buffer
122 122
     int nb_samples;             ///< number of audio samples per channel
123 123
     int sample_rate;            ///< audio buffer sample rate
124
+#if FF_API_PACKING
124 125
     int planar;                 ///< audio buffer - planar or packed
126
+#endif
125 127
 } AVFilterBufferRefAudioProps;
126 128
 
127 129
 /**
... ...
@@ -303,10 +305,12 @@ AVFilterFormats *avfilter_make_all_formats(enum AVMediaType type);
303 303
  */
304 304
 extern const int64_t avfilter_all_channel_layouts[];
305 305
 
306
+#if FF_API_PACKING
306 307
 /**
307 308
  * Return a list of all audio packing formats.
308 309
  */
309 310
 AVFilterFormats *avfilter_make_all_packing_formats(void);
311
+#endif
310 312
 
311 313
 /**
312 314
  * Return a format list which contains the intersection of the formats of
... ...
@@ -519,7 +523,9 @@ void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
519 519
 void avfilter_set_common_pixel_formats(AVFilterContext *ctx, AVFilterFormats *formats);
520 520
 void avfilter_set_common_sample_formats(AVFilterContext *ctx, AVFilterFormats *formats);
521 521
 void avfilter_set_common_channel_layouts(AVFilterContext *ctx, AVFilterFormats *formats);
522
+#if FF_API_PACKING
522 523
 void avfilter_set_common_packing_formats(AVFilterContext *ctx, AVFilterFormats *formats);
524
+#endif
523 525
 
524 526
 /** Default handler for query_formats() */
525 527
 int avfilter_default_query_formats(AVFilterContext *ctx);
... ...
@@ -616,10 +622,12 @@ struct AVFilterContext {
616 616
     struct AVFilterCommand *command_queue;
617 617
 };
618 618
 
619
+#if FF_API_PACKING
619 620
 enum AVFilterPacking {
620 621
     AVFILTER_PACKED = 0,
621 622
     AVFILTER_PLANAR,
622 623
 };
624
+#endif
623 625
 
624 626
 /**
625 627
  * A link between two filters. This contains pointers to the source and
... ...
@@ -655,7 +663,9 @@ struct AVFilterLink {
655 655
 #else
656 656
     int sample_rate;            ///< samples per second
657 657
 #endif
658
+#if FF_API_PACKING
658 659
     int planar;                 ///< agreed upon packing mode of audio buffers. true if planar.
660
+#endif
659 661
 
660 662
     int format;                 ///< agreed upon media format
661 663
 
... ...
@@ -669,8 +679,10 @@ struct AVFilterLink {
669 669
     AVFilterFormats *in_formats;
670 670
     AVFilterFormats *out_formats;
671 671
 
672
+#if FF_API_PACKING
672 673
     AVFilterFormats *in_packing;
673 674
     AVFilterFormats *out_packing;
675
+#endif
674 676
 
675 677
     /**
676 678
      * The buffer reference currently being sent across the link by the source
... ...
@@ -200,14 +200,12 @@ static int insert_conv_filter(AVFilterGraph *graph, AVFilterLink *link,
200 200
 
201 201
     if (link->type == AVMEDIA_TYPE_AUDIO &&
202 202
          (((link = filt_ctx-> inputs[0]) &&
203
-           (!ff_merge_channel_layouts(link->in_channel_layouts, link->out_channel_layouts) ||
204
-            !avfilter_merge_formats(link->in_packing,   link->out_packing))) ||
203
+           !ff_merge_channel_layouts(link->in_channel_layouts, link->out_channel_layouts)) ||
205 204
          ((link = filt_ctx->outputs[0]) &&
206
-           (!ff_merge_channel_layouts(link->in_channel_layouts, link->out_channel_layouts) ||
207
-            !avfilter_merge_formats(link->in_packing,   link->out_packing))))
205
+           !ff_merge_channel_layouts(link->in_channel_layouts, link->out_channel_layouts)))
208 206
        ) {
209 207
         av_log(NULL, AV_LOG_ERROR,
210
-               "Impossible to convert between the channel layouts/packing formats supported by the filter "
208
+               "Impossible to convert between the channel layouts formats supported by the filter "
211 209
                "'%s' and the filter '%s'\n", link->src->name, link->dst->name);
212 210
         return AVERROR(EINVAL);
213 211
     }
... ...
@@ -219,7 +217,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
219 219
 {
220 220
     int i, j, ret;
221 221
     char filt_args[128];
222
-    AVFilterFormats *formats, *packing;
222
+    AVFilterFormats *formats;
223 223
     AVFilterChannelLayouts *chlayouts;
224 224
     AVFilterFormats *samplerates;
225 225
     int scaler_count = 0, resampler_count = 0;
... ...
@@ -254,8 +252,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
254 254
                     return ret;
255 255
             }
256 256
             else if (link->type == AVMEDIA_TYPE_AUDIO) {
257
-                if (!link->in_channel_layouts || !link->out_channel_layouts ||
258
-                    !link->in_packing   || !link->out_packing)
257
+                if (!link->in_channel_layouts || !link->out_channel_layouts)
259 258
                     return AVERROR(EINVAL);
260 259
 
261 260
                 /* Merge all three list before checking: that way, in all
... ...
@@ -264,9 +261,8 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
264 264
                 formats   = avfilter_merge_formats(link->in_formats,   link->out_formats);
265 265
                 chlayouts   = ff_merge_channel_layouts(link->in_channel_layouts  , link->out_channel_layouts);
266 266
                 samplerates = ff_merge_samplerates    (link->in_samplerates, link->out_samplerates);
267
-                packing   = avfilter_merge_formats(link->in_packing,   link->out_packing);
268 267
 
269
-                if (!formats || !chlayouts || !packing || !samplerates)
268
+                if (!formats || !chlayouts || !samplerates)
270 269
                     if (ret = insert_conv_filter(graph, link, "aconvert", NULL))
271 270
                        return ret;
272 271
 #else
... ...
@@ -46,7 +46,9 @@ AVBufferSinkParams *av_buffersink_params_alloc(void);
46 46
 typedef struct {
47 47
     const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats, terminated by AV_SAMPLE_FMT_NONE
48 48
     const int64_t *channel_layouts;         ///< list of allowed channel layouts, terminated by -1
49
+#if FF_API_PACKING
49 50
     const int *packing_fmts;                ///< list of allowed packing formats
51
+#endif
50 52
 } AVABufferSinkParams;
51 53
 
52 54
 /**
... ...
@@ -70,9 +70,11 @@ void avfilter_set_common_channel_layouts(AVFilterContext *ctx, AVFilterFormats *
70 70
                        offsetof(AVFilterLink, out_channel_layouts));
71 71
 }
72 72
 
73
+#if FF_API_PACKING
73 74
 void avfilter_set_common_packing_formats(AVFilterContext *ctx, AVFilterFormats *formats)
74 75
 {
75 76
     set_common_formats(ctx, formats, AVMEDIA_TYPE_AUDIO,
76 77
                        offsetof(AVFilterLink, in_packing),
77 78
                        offsetof(AVFilterLink, out_packing));
78 79
 }
80
+#endif
... ...
@@ -289,6 +289,7 @@ const int64_t avfilter_all_channel_layouts[] = {
289 289
 //     return avfilter_make_format64_list(avfilter_all_channel_layouts);
290 290
 // }
291 291
 
292
+#if FF_API_PACKING
292 293
 AVFilterFormats *avfilter_make_all_packing_formats(void)
293 294
 {
294 295
     static const int packing[] = {
... ...
@@ -299,6 +300,7 @@ AVFilterFormats *avfilter_make_all_packing_formats(void)
299 299
 
300 300
     return avfilter_make_format_list(packing);
301 301
 }
302
+#endif
302 303
 
303 304
 AVFilterFormats *ff_all_samplerates(void)
304 305
 {
... ...
@@ -518,23 +520,6 @@ int ff_parse_channel_layout(int64_t *ret, const char *arg, void *log_ctx)
518 518
     return 0;
519 519
 }
520 520
 
521
-int ff_parse_packing_format(int *ret, const char *arg, void *log_ctx)
522
-{
523
-    char *tail;
524
-    int planar = strtol(arg, &tail, 10);
525
-    if (*tail) {
526
-        planar = !strcmp(arg, "packed") ? 0:
527
-                 !strcmp(arg, "planar") ? 1: -1;
528
-    }
529
-
530
-    if (planar != 0 && planar != 1) {
531
-        av_log(log_ctx, AV_LOG_ERROR, "Invalid packing format '%s'\n", arg);
532
-        return AVERROR(EINVAL);
533
-    }
534
-    *ret = planar;
535
-    return 0;
536
-}
537
-
538 521
 #ifdef TEST
539 522
 
540 523
 #undef printf
... ...
@@ -46,9 +46,8 @@ static int print_link_prop(AVBPrint *buf, AVFilterLink *link)
46 46
             av_get_channel_layout_string(layout, sizeof(layout),
47 47
                                          -1, link->channel_layout);
48 48
             format = av_x_if_null(av_get_sample_fmt_name(link->format), "?");
49
-            av_bprintf(buf, "[%dHz %s:%s:%s]",
50
-                    (int)link->sample_rate, format, layout,
51
-                    link->planar ? "planar" : "packed");
49
+            av_bprintf(buf, "[%dHz %s:%s]",
50
+                       (int)link->sample_rate, format, layout);
52 51
             break;
53 52
 
54 53
         default:
... ...
@@ -132,16 +132,6 @@ int ff_parse_sample_format(int *ret, const char *arg, void *log_ctx);
132 132
 int ff_parse_channel_layout(int64_t *ret, const char *arg, void *log_ctx);
133 133
 
134 134
 /**
135
- * Parse a packing format or a corresponding integer representation.
136
- *
137
- * @param ret integer pointer to where the value should be written
138
- * @param arg string to parse
139
- * @param log_ctx log context
140
- * @return 0 in case of success, a negative AVERROR code on error
141
- */
142
-int ff_parse_packing_format(int *ret, const char *arg, void *log_ctx);
143
-
144
-/**
145 135
  * Pass video frame along and keep an internal reference for later use.
146 136
  */
147 137
 static inline void ff_null_start_frame_keep_ref(AVFilterLink *inlink,
... ...
@@ -42,7 +42,6 @@ AVBufferSinkParams *av_buffersink_params_alloc(void)
42 42
 AVABufferSinkParams *av_abuffersink_params_alloc(void)
43 43
 {
44 44
     static const int sample_fmts[] = { -1 };
45
-    static const int packing_fmts[] = { -1 };
46 45
     static const int64_t channel_layouts[] = { -1 };
47 46
     AVABufferSinkParams *params = av_malloc(sizeof(AVABufferSinkParams));
48 47
 
... ...
@@ -51,7 +50,6 @@ AVABufferSinkParams *av_abuffersink_params_alloc(void)
51 51
 
52 52
     params->sample_fmts = sample_fmts;
53 53
     params->channel_layouts = channel_layouts;
54
-    params->packing_fmts = packing_fmts;
55 54
     return params;
56 55
 }
57 56
 
... ...
@@ -64,7 +62,6 @@ typedef struct {
64 64
     /* only used for audio */
65 65
     enum AVSampleFormat *sample_fmts;       ///< list of accepted sample formats, terminated by AV_SAMPLE_FMT_NONE
66 66
     int64_t *channel_layouts;               ///< list of accepted channel layouts, terminated by -1
67
-    int *packing_fmts;                      ///< list of accepted packing formats, terminated by -1
68 67
 } BufferSinkContext;
69 68
 
70 69
 #define FIFO_INIT_SIZE 8
... ...
@@ -244,11 +241,9 @@ static av_cold int asink_init(AVFilterContext *ctx, const char *args, void *opaq
244 244
 
245 245
     buf->sample_fmts     = ff_copy_int_list  (params->sample_fmts);
246 246
     buf->channel_layouts = ff_copy_int64_list(params->channel_layouts);
247
-    buf->packing_fmts    = ff_copy_int_list  (params->packing_fmts);
248
-    if (!buf->sample_fmts || !buf->channel_layouts || !buf->sample_fmts) {
247
+    if (!buf->sample_fmts || !buf->channel_layouts) {
249 248
         av_freep(&buf->sample_fmts);
250 249
         av_freep(&buf->channel_layouts);
251
-        av_freep(&buf->packing_fmts);
252 250
         return AVERROR(ENOMEM);
253 251
     }
254 252
 
... ...
@@ -261,7 +256,6 @@ static av_cold void asink_uninit(AVFilterContext *ctx)
261 261
 
262 262
     av_freep(&buf->sample_fmts);
263 263
     av_freep(&buf->channel_layouts);
264
-    av_freep(&buf->packing_fmts);
265 264
     return common_uninit(ctx);
266 265
 }
267 266
 
... ...
@@ -278,11 +272,6 @@ static int asink_query_formats(AVFilterContext *ctx)
278 278
     if (!(layouts = avfilter_make_format64_list(buf->channel_layouts)))
279 279
         return AVERROR(ENOMEM);
280 280
     ff_set_common_channel_layouts(ctx, layouts);
281
-
282
-    if (!(formats = avfilter_make_format_list(buf->packing_fmts)))
283
-        return AVERROR(ENOMEM);
284
-    avfilter_set_common_packing_formats(ctx, formats);
285
-
286 281
     ff_set_common_samplerates          (ctx, ff_all_samplerates());
287 282
 
288 283
     return 0;
... ...
@@ -55,7 +55,6 @@ typedef struct {
55 55
     int sample_rate;
56 56
     unsigned int sample_format;
57 57
     int64_t channel_layout;
58
-    int packing_format;
59 58
 
60 59
     // Normalization filters
61 60
     AVFilterContext *aconvert;
... ...
@@ -91,7 +90,6 @@ static int reconfigure_filter(BufferSourceContext *abuffer, AVFilterContext *fil
91 91
 
92 92
     inlink->format         = abuffer->sample_format;
93 93
     inlink->channel_layout = abuffer->channel_layout;
94
-    inlink->planar         = abuffer->packing_format;
95 94
     inlink->sample_rate    = abuffer->sample_rate;
96 95
 
97 96
     filt_ctx->filter->uninit(filt_ctx);
... ...
@@ -239,14 +237,12 @@ static int check_format_change_audio(AVFilterContext *ctx,
239 239
 
240 240
     link = ctx->outputs[0];
241 241
     if (samplesref->format                != link->format         ||
242
-        samplesref->audio->channel_layout != link->channel_layout ||
243
-        samplesref->audio->planar         != link->planar) {
242
+        samplesref->audio->channel_layout != link->channel_layout) {
244 243
 
245 244
         if (!logged) log_input_change(ctx, link, samplesref);
246 245
 
247 246
         abuffer->sample_format  = samplesref->format;
248 247
         abuffer->channel_layout = samplesref->audio->channel_layout;
249
-        abuffer->packing_format = samplesref->audio->planar;
250 248
 
251 249
         if (!abuffer->aconvert) {
252 250
             ret = insert_filter(abuffer, link, &abuffer->aconvert, "aconvert");
... ...
@@ -254,9 +250,7 @@ static int check_format_change_audio(AVFilterContext *ctx,
254 254
         } else {
255 255
             link = abuffer->aconvert->outputs[0];
256 256
             if (samplesref->format                == link->format         &&
257
-                samplesref->audio->channel_layout == link->channel_layout &&
258
-                samplesref->audio->planar         == link->planar
259
-               )
257
+                samplesref->audio->channel_layout == link->channel_layout)
260 258
                 remove_filter(&abuffer->aconvert);
261 259
             else
262 260
                 if ((ret = reconfigure_filter(abuffer, abuffer->aconvert)) < 0)
... ...
@@ -456,7 +450,6 @@ static av_cold int init_audio(AVFilterContext *ctx, const char *args0, void *opa
456 456
     ADD_FORMAT(sample_rate);
457 457
     ADD_FORMAT(sample_format);
458 458
     ADD_FORMAT(channel_layout);
459
-    ADD_FORMAT(packing_format);
460 459
 
461 460
     abuffer->fifo = av_fifo_alloc(FIFO_SIZE*sizeof(AVFilterBufferRef*));
462 461
     if (!abuffer->fifo) {
... ...
@@ -475,7 +468,7 @@ static av_cold int init_audio(AVFilterContext *ctx, const char *args0, void *opa
475 475
 
476 476
 arg_fail:
477 477
     av_log(ctx, AV_LOG_ERROR, "Invalid arguments, must be of the form "
478
-                              "sample_rate:sample_fmt:channel_layout:packing\n");
478
+                              "sample_rate:sample_fmt:channel_layout\n");
479 479
     av_freep(&args);
480 480
     return AVERROR(EINVAL);
481 481
 }
... ...
@@ -517,10 +510,6 @@ static int query_formats_audio(AVFilterContext *ctx)
517 517
     ff_add_channel_layout(&layouts, abuffer->channel_layout);
518 518
     ff_set_common_channel_layouts(ctx, layouts);
519 519
 
520
-    formats = NULL;
521
-    avfilter_add_format(&formats, abuffer->packing_format);
522
-    avfilter_set_common_packing_formats(ctx, formats);
523
-
524 520
     return 0;
525 521
 }
526 522
 
... ...
@@ -370,13 +370,11 @@ static int amovie_query_formats(AVFilterContext *ctx)
370 370
     AVCodecContext *c = movie->codec_ctx;
371 371
 
372 372
     enum AVSampleFormat sample_fmts[] = { c->sample_fmt, -1 };
373
-    int packing_fmts[] = { AVFILTER_PACKED, -1 };
374 373
     int sample_rates[] = { c->sample_rate, -1 };
375 374
     int64_t chlayouts[] = { c->channel_layout ? c->channel_layout :
376 375
                             av_get_default_channel_layout(c->channels), -1 };
377 376
 
378 377
     avfilter_set_common_sample_formats (ctx, avfilter_make_format_list(sample_fmts));
379
-    avfilter_set_common_packing_formats(ctx, avfilter_make_format_list(packing_fmts));
380 378
     ff_set_common_samplerates          (ctx, avfilter_make_format_list(sample_rates));
381 379
     ff_set_common_channel_layouts(ctx, avfilter_make_format64_list(chlayouts));
382 380
 
... ...
@@ -53,5 +53,8 @@
53 53
 #ifndef FF_API_VSRC_BUFFER_ADD_FRAME
54 54
 #define FF_API_VSRC_BUFFER_ADD_FRAME        (LIBAVFILTER_VERSION_MAJOR < 3)
55 55
 #endif
56
+#ifndef FF_API_PACKING
57
+#define FF_API_PACKING                  (LIBAVFILTER_VERSION_MAJOR < 3)
58
+#endif
56 59
 
57 60
 #endif // AVFILTER_VERSION_H
... ...
@@ -54,14 +54,6 @@ static void print_formats(AVFilterContext *filter_ctx)
54 54
                 printf(#INOUT "PUT[%d] %s: chlayout:%s\n",              \
55 55
                        i, filter_ctx->filter->inout##puts[i].name, buf); \
56 56
             }                                                           \
57
-                                                                        \
58
-            fmts = filter_ctx->inout##puts[i]->outin##_packing;         \
59
-            for (j = 0; j < fmts->format_count; j++) {                  \
60
-                printf(#INOUT "PUT[%d] %s: packing:%s\n",               \
61
-                       i, filter_ctx->filter->inout##puts[i].name,      \
62
-                       fmts->formats[j] == AVFILTER_PACKED ?            \
63
-                                           "packed" : "planar");        \
64
-            }                                                           \
65 57
         }                                                               \
66 58
     }                                                                   \
67 59