Browse code

Merge commit 'f6974fe651d29ef6eb68d66d73f7b6c011062aa0'

* commit 'f6974fe651d29ef6eb68d66d73f7b6c011062aa0':
lavfi: Drop deprecated AVFilterBuffer* code

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>

Hendrik Leppkes authored on 2015/09/05 23:22:03
Showing 11 changed files
... ...
@@ -14,7 +14,6 @@ OBJS = allfilters.o                                                     \
14 14
        audio.o                                                          \
15 15
        avfilter.o                                                       \
16 16
        avfiltergraph.o                                                  \
17
-       buffer.o                                                         \
18 17
        buffersink.o                                                     \
19 18
        buffersrc.o                                                      \
20 19
        drawutils.o                                                      \
... ...
@@ -28,15 +28,6 @@
28 28
 #include "avfilter.h"
29 29
 #include "internal.h"
30 30
 
31
-#if FF_API_AVFILTERBUFFER
32
-FF_DISABLE_DEPRECATION_WARNINGS
33
-int avfilter_ref_get_channels(AVFilterBufferRef *ref)
34
-{
35
-    return ref->audio ? ref->audio->channels : 0;
36
-}
37
-FF_ENABLE_DEPRECATION_WARNINGS
38
-#endif
39
-
40 31
 AVFrame *ff_null_get_audio_buffer(AVFilterLink *link, int nb_samples)
41 32
 {
42 33
     return ff_get_audio_buffer(link->dst->outputs[0], nb_samples);
... ...
@@ -83,94 +74,3 @@ AVFrame *ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
83 83
 
84 84
     return ret;
85 85
 }
86
-
87
-#if FF_API_AVFILTERBUFFER
88
-FF_DISABLE_DEPRECATION_WARNINGS
89
-AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays_channels(uint8_t **data,
90
-                                                                      int linesize,int perms,
91
-                                                                      int nb_samples,
92
-                                                                      enum AVSampleFormat sample_fmt,
93
-                                                                      int channels,
94
-                                                                      uint64_t channel_layout)
95
-{
96
-    int planes;
97
-    AVFilterBuffer    *samples    = av_mallocz(sizeof(*samples));
98
-    AVFilterBufferRef *samplesref = av_mallocz(sizeof(*samplesref));
99
-
100
-    if (!samples || !samplesref)
101
-        goto fail;
102
-
103
-    av_assert0(channels);
104
-    av_assert0(channel_layout == 0 ||
105
-               channels == av_get_channel_layout_nb_channels(channel_layout));
106
-
107
-    samplesref->buf         = samples;
108
-    samplesref->buf->free   = ff_avfilter_default_free_buffer;
109
-    if (!(samplesref->audio = av_mallocz(sizeof(*samplesref->audio))))
110
-        goto fail;
111
-
112
-    samplesref->audio->nb_samples     = nb_samples;
113
-    samplesref->audio->channel_layout = channel_layout;
114
-    samplesref->audio->channels       = channels;
115
-
116
-    planes = av_sample_fmt_is_planar(sample_fmt) ? channels : 1;
117
-
118
-    /* make sure the buffer gets read permission or it's useless for output */
119
-    samplesref->perms = perms | AV_PERM_READ;
120
-
121
-    samples->refcount  = 1;
122
-    samplesref->type   = AVMEDIA_TYPE_AUDIO;
123
-    samplesref->format = sample_fmt;
124
-
125
-    memcpy(samples->data, data,
126
-           FFMIN(FF_ARRAY_ELEMS(samples->data), planes)*sizeof(samples->data[0]));
127
-    memcpy(samplesref->data, samples->data, sizeof(samples->data));
128
-
129
-    samples->linesize[0] = samplesref->linesize[0] = linesize;
130
-
131
-    if (planes > FF_ARRAY_ELEMS(samples->data)) {
132
-        samples->   extended_data = av_mallocz_array(sizeof(*samples->extended_data),
133
-                                               planes);
134
-        samplesref->extended_data = av_mallocz_array(sizeof(*samplesref->extended_data),
135
-                                               planes);
136
-
137
-        if (!samples->extended_data || !samplesref->extended_data)
138
-            goto fail;
139
-
140
-        memcpy(samples->   extended_data, data, sizeof(*data)*planes);
141
-        memcpy(samplesref->extended_data, data, sizeof(*data)*planes);
142
-    } else {
143
-        samples->extended_data    = samples->data;
144
-        samplesref->extended_data = samplesref->data;
145
-    }
146
-
147
-    samplesref->pts = AV_NOPTS_VALUE;
148
-
149
-    return samplesref;
150
-
151
-fail:
152
-    if (samples && samples->extended_data != samples->data)
153
-        av_freep(&samples->extended_data);
154
-    if (samplesref) {
155
-        av_freep(&samplesref->audio);
156
-        if (samplesref->extended_data != samplesref->data)
157
-            av_freep(&samplesref->extended_data);
158
-    }
159
-    av_freep(&samplesref);
160
-    av_freep(&samples);
161
-    return NULL;
162
-}
163
-
164
-AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data,
165
-                                                             int linesize,int perms,
166
-                                                             int nb_samples,
167
-                                                             enum AVSampleFormat sample_fmt,
168
-                                                             uint64_t channel_layout)
169
-{
170
-    int channels = av_get_channel_layout_nb_channels(channel_layout);
171
-    return avfilter_get_audio_buffer_ref_from_arrays_channels(data, linesize, perms,
172
-                                                              nb_samples, sample_fmt,
173
-                                                              channels, channel_layout);
174
-}
175
-FF_ENABLE_DEPRECATION_WARNINGS
176
-#endif
... ...
@@ -66,182 +66,6 @@ typedef struct AVFilterLink    AVFilterLink;
66 66
 typedef struct AVFilterPad     AVFilterPad;
67 67
 typedef struct AVFilterFormats AVFilterFormats;
68 68
 
69
-#if FF_API_AVFILTERBUFFER
70
-/**
71
- * A reference-counted buffer data type used by the filter system. Filters
72
- * should not store pointers to this structure directly, but instead use the
73
- * AVFilterBufferRef structure below.
74
- */
75
-typedef struct AVFilterBuffer {
76
-    uint8_t *data[8];           ///< buffer data for each plane/channel
77
-
78
-    /**
79
-     * pointers to the data planes/channels.
80
-     *
81
-     * For video, this should simply point to data[].
82
-     *
83
-     * For planar audio, each channel has a separate data pointer, and
84
-     * linesize[0] contains the size of each channel buffer.
85
-     * For packed audio, there is just one data pointer, and linesize[0]
86
-     * contains the total size of the buffer for all channels.
87
-     *
88
-     * Note: Both data and extended_data will always be set, but for planar
89
-     * audio with more channels that can fit in data, extended_data must be used
90
-     * in order to access all channels.
91
-     */
92
-    uint8_t **extended_data;
93
-    int linesize[8];            ///< number of bytes per line
94
-
95
-    /** private data to be used by a custom free function */
96
-    void *priv;
97
-    /**
98
-     * A pointer to the function to deallocate this buffer if the default
99
-     * function is not sufficient. This could, for example, add the memory
100
-     * back into a memory pool to be reused later without the overhead of
101
-     * reallocating it from scratch.
102
-     */
103
-    void (*free)(struct AVFilterBuffer *buf);
104
-
105
-    int format;                 ///< media format
106
-    int w, h;                   ///< width and height of the allocated buffer
107
-    unsigned refcount;          ///< number of references to this buffer
108
-} AVFilterBuffer;
109
-
110
-#define AV_PERM_READ     0x01   ///< can read from the buffer
111
-#define AV_PERM_WRITE    0x02   ///< can write to the buffer
112
-#define AV_PERM_PRESERVE 0x04   ///< nobody else can overwrite the buffer
113
-#define AV_PERM_REUSE    0x08   ///< can output the buffer multiple times, with the same contents each time
114
-#define AV_PERM_REUSE2   0x10   ///< can output the buffer multiple times, modified each time
115
-#define AV_PERM_NEG_LINESIZES 0x20  ///< the buffer requested can have negative linesizes
116
-#define AV_PERM_ALIGN    0x40   ///< the buffer must be aligned
117
-
118
-#define AVFILTER_ALIGN 16 //not part of ABI
119
-
120
-/**
121
- * Audio specific properties in a reference to an AVFilterBuffer. Since
122
- * AVFilterBufferRef is common to different media formats, audio specific
123
- * per reference properties must be separated out.
124
- */
125
-typedef struct AVFilterBufferRefAudioProps {
126
-    uint64_t channel_layout;    ///< channel layout of audio buffer
127
-    int nb_samples;             ///< number of audio samples per channel
128
-    int sample_rate;            ///< audio buffer sample rate
129
-    int channels;               ///< number of channels (do not access directly)
130
-} AVFilterBufferRefAudioProps;
131
-
132
-/**
133
- * Video specific properties in a reference to an AVFilterBuffer. Since
134
- * AVFilterBufferRef is common to different media formats, video specific
135
- * per reference properties must be separated out.
136
- */
137
-typedef struct AVFilterBufferRefVideoProps {
138
-    int w;                      ///< image width
139
-    int h;                      ///< image height
140
-    AVRational sample_aspect_ratio; ///< sample aspect ratio
141
-    int interlaced;             ///< is frame interlaced
142
-    int top_field_first;        ///< field order
143
-    enum AVPictureType pict_type; ///< picture type of the frame
144
-    int key_frame;              ///< 1 -> keyframe, 0-> not
145
-    int qp_table_linesize;                ///< qp_table stride
146
-    int qp_table_size;            ///< qp_table size
147
-    int8_t *qp_table;             ///< array of Quantization Parameters
148
-} AVFilterBufferRefVideoProps;
149
-
150
-/**
151
- * A reference to an AVFilterBuffer. Since filters can manipulate the origin of
152
- * a buffer to, for example, crop image without any memcpy, the buffer origin
153
- * and dimensions are per-reference properties. Linesize is also useful for
154
- * image flipping, frame to field filters, etc, and so is also per-reference.
155
- *
156
- * TODO: add anything necessary for frame reordering
157
- */
158
-typedef struct AVFilterBufferRef {
159
-    AVFilterBuffer *buf;        ///< the buffer that this is a reference to
160
-    uint8_t *data[8];           ///< picture/audio data for each plane
161
-    /**
162
-     * pointers to the data planes/channels.
163
-     *
164
-     * For video, this should simply point to data[].
165
-     *
166
-     * For planar audio, each channel has a separate data pointer, and
167
-     * linesize[0] contains the size of each channel buffer.
168
-     * For packed audio, there is just one data pointer, and linesize[0]
169
-     * contains the total size of the buffer for all channels.
170
-     *
171
-     * Note: Both data and extended_data will always be set, but for planar
172
-     * audio with more channels that can fit in data, extended_data must be used
173
-     * in order to access all channels.
174
-     */
175
-    uint8_t **extended_data;
176
-    int linesize[8];            ///< number of bytes per line
177
-
178
-    AVFilterBufferRefVideoProps *video; ///< video buffer specific properties
179
-    AVFilterBufferRefAudioProps *audio; ///< audio buffer specific properties
180
-
181
-    /**
182
-     * presentation timestamp. The time unit may change during
183
-     * filtering, as it is specified in the link and the filter code
184
-     * may need to rescale the PTS accordingly.
185
-     */
186
-    int64_t pts;
187
-    int64_t pos;                ///< byte position in stream, -1 if unknown
188
-
189
-    int format;                 ///< media format
190
-
191
-    int perms;                  ///< permissions, see the AV_PERM_* flags
192
-
193
-    enum AVMediaType type;      ///< media type of buffer data
194
-
195
-    AVDictionary *metadata;     ///< dictionary containing metadata key=value tags
196
-} AVFilterBufferRef;
197
-
198
-/**
199
- * Copy properties of src to dst, without copying the actual data
200
- */
201
-attribute_deprecated
202
-void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, const AVFilterBufferRef *src);
203
-
204
-/**
205
- * Add a new reference to a buffer.
206
- *
207
- * @param ref   an existing reference to the buffer
208
- * @param pmask a bitmask containing the allowable permissions in the new
209
- *              reference
210
- * @return      a new reference to the buffer with the same properties as the
211
- *              old, excluding any permissions denied by pmask
212
- */
213
-attribute_deprecated
214
-AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask);
215
-
216
-/**
217
- * Remove a reference to a buffer. If this is the last reference to the
218
- * buffer, the buffer itself is also automatically freed.
219
- *
220
- * @param ref reference to the buffer, may be NULL
221
- *
222
- * @note it is recommended to use avfilter_unref_bufferp() instead of this
223
- * function
224
- */
225
-attribute_deprecated
226
-void avfilter_unref_buffer(AVFilterBufferRef *ref);
227
-
228
-/**
229
- * Remove a reference to a buffer and set the pointer to NULL.
230
- * If this is the last reference to the buffer, the buffer itself
231
- * is also automatically freed.
232
- *
233
- * @param ref pointer to the buffer reference
234
- */
235
-attribute_deprecated
236
-void avfilter_unref_bufferp(AVFilterBufferRef **ref);
237
-
238
-/**
239
- * Get the number of channels of a buffer reference.
240
- */
241
-attribute_deprecated
242
-int avfilter_ref_get_channels(AVFilterBufferRef *ref);
243
-#endif
244
-
245 69
 /**
246 70
  * Get the number of elements in a NULL-terminated array of AVFilterPads (e.g.
247 71
  * AVFilter.inputs/outputs).
... ...
@@ -742,69 +566,6 @@ void avfilter_link_set_closed(AVFilterLink *link, int closed);
742 742
  */
743 743
 int avfilter_config_links(AVFilterContext *filter);
744 744
 
745
-#if FF_API_AVFILTERBUFFER
746
-/**
747
- * Create a buffer reference wrapped around an already allocated image
748
- * buffer.
749
- *
750
- * @param data pointers to the planes of the image to reference
751
- * @param linesize linesizes for the planes of the image to reference
752
- * @param perms the required access permissions
753
- * @param w the width of the image specified by the data and linesize arrays
754
- * @param h the height of the image specified by the data and linesize arrays
755
- * @param format the pixel format of the image specified by the data and linesize arrays
756
- */
757
-attribute_deprecated
758
-AVFilterBufferRef *
759
-avfilter_get_video_buffer_ref_from_arrays(uint8_t * const data[4], const int linesize[4], int perms,
760
-                                          int w, int h, enum AVPixelFormat format);
761
-
762
-/**
763
- * Create an audio buffer reference wrapped around an already
764
- * allocated samples buffer.
765
- *
766
- * See avfilter_get_audio_buffer_ref_from_arrays_channels() for a version
767
- * that can handle unknown channel layouts.
768
- *
769
- * @param data           pointers to the samples plane buffers
770
- * @param linesize       linesize for the samples plane buffers
771
- * @param perms          the required access permissions
772
- * @param nb_samples     number of samples per channel
773
- * @param sample_fmt     the format of each sample in the buffer to allocate
774
- * @param channel_layout the channel layout of the buffer
775
- */
776
-attribute_deprecated
777
-AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data,
778
-                                                             int linesize,
779
-                                                             int perms,
780
-                                                             int nb_samples,
781
-                                                             enum AVSampleFormat sample_fmt,
782
-                                                             uint64_t channel_layout);
783
-/**
784
- * Create an audio buffer reference wrapped around an already
785
- * allocated samples buffer.
786
- *
787
- * @param data           pointers to the samples plane buffers
788
- * @param linesize       linesize for the samples plane buffers
789
- * @param perms          the required access permissions
790
- * @param nb_samples     number of samples per channel
791
- * @param sample_fmt     the format of each sample in the buffer to allocate
792
- * @param channels       the number of channels of the buffer
793
- * @param channel_layout the channel layout of the buffer,
794
- *                       must be either 0 or consistent with channels
795
- */
796
-attribute_deprecated
797
-AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays_channels(uint8_t **data,
798
-                                                                      int linesize,
799
-                                                                      int perms,
800
-                                                                      int nb_samples,
801
-                                                                      enum AVSampleFormat sample_fmt,
802
-                                                                      int channels,
803
-                                                                      uint64_t channel_layout);
804
-
805
-#endif
806
-
807
-
808 745
 #define AVFILTER_CMD_FLAG_ONE   1 ///< Stop once a filter understood the command (for target=all for example), fast filters are favored automatically
809 746
 #define AVFILTER_CMD_FLAG_FAST  2 ///< Only execute command when its fast (like a video out that supports contrast adjustment in hw)
810 747
 
... ...
@@ -951,26 +712,6 @@ void avfilter_free(AVFilterContext *filter);
951 951
 int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
952 952
                            unsigned filt_srcpad_idx, unsigned filt_dstpad_idx);
953 953
 
954
-#if FF_API_AVFILTERBUFFER
955
-/**
956
- * Copy the frame properties of src to dst, without copying the actual
957
- * image data.
958
- *
959
- * @return 0 on success, a negative number on error.
960
- */
961
-attribute_deprecated
962
-int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src);
963
-
964
-/**
965
- * Copy the frame properties and data pointers of src to dst, without copying
966
- * the actual data.
967
- *
968
- * @return 0 on success, a negative number on error.
969
- */
970
-attribute_deprecated
971
-int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src);
972
-#endif
973
-
974 954
 /**
975 955
  * @return AVClass for AVFilterContext.
976 956
  *
977 957
deleted file mode 100644
... ...
@@ -1,179 +0,0 @@
1
-/*
2
- * Copyright Stefano Sabatini <stefasab gmail com>
3
- * Copyright Anton Khirnov <anton khirnov net>
4
- * Copyright Michael Niedermayer <michaelni gmx at>
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-#include "libavutil/channel_layout.h"
24
-#include "libavutil/avassert.h"
25
-#include "libavutil/common.h"
26
-#include "libavutil/imgutils.h"
27
-#include "libavutil/internal.h"
28
-#include "libavcodec/avcodec.h"
29
-
30
-#include "avfilter.h"
31
-#include "internal.h"
32
-#include "audio.h"
33
-#include "avcodec.h"
34
-#include "version.h"
35
-
36
-#if FF_API_AVFILTERBUFFER
37
-void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr)
38
-{
39
-    if (ptr->extended_data != ptr->data)
40
-        av_freep(&ptr->extended_data);
41
-    av_freep(&ptr->data[0]);
42
-    av_free(ptr);
43
-}
44
-
45
-static int copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *src) {
46
-    *dst = *src;
47
-    if (src->qp_table) {
48
-        int qsize = src->qp_table_size;
49
-        dst->qp_table = av_malloc(qsize);
50
-        if (!dst->qp_table) {
51
-            av_log(NULL, AV_LOG_ERROR, "Failed to allocate qp_table\n");
52
-            dst->qp_table_size = 0;
53
-            return AVERROR(ENOMEM);
54
-        }
55
-        memcpy(dst->qp_table, src->qp_table, qsize);
56
-    }
57
-    return 0;
58
-}
59
-
60
-AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
61
-{
62
-    AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));
63
-    if (!ret)
64
-        return NULL;
65
-    *ret = *ref;
66
-
67
-    ret->metadata = NULL;
68
-    av_dict_copy(&ret->metadata, ref->metadata, 0);
69
-
70
-    if (ref->type == AVMEDIA_TYPE_VIDEO) {
71
-        ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps));
72
-        if (!ret->video) {
73
-            av_free(ret);
74
-            return NULL;
75
-        }
76
-        copy_video_props(ret->video, ref->video);
77
-        ret->extended_data = ret->data;
78
-    } else if (ref->type == AVMEDIA_TYPE_AUDIO) {
79
-        ret->audio = av_malloc(sizeof(AVFilterBufferRefAudioProps));
80
-        if (!ret->audio) {
81
-            av_free(ret);
82
-            return NULL;
83
-        }
84
-        *ret->audio = *ref->audio;
85
-
86
-        if (ref->extended_data && ref->extended_data != ref->data) {
87
-            int nb_channels = av_get_channel_layout_nb_channels(ref->audio->channel_layout);
88
-            if (!(ret->extended_data = av_malloc_array(sizeof(*ret->extended_data),
89
-                                                 nb_channels))) {
90
-                av_freep(&ret->audio);
91
-                av_freep(&ret);
92
-                return NULL;
93
-            }
94
-            memcpy(ret->extended_data, ref->extended_data,
95
-                   sizeof(*ret->extended_data) * nb_channels);
96
-        } else
97
-            ret->extended_data = ret->data;
98
-    }
99
-    ret->perms &= pmask;
100
-    ret->buf->refcount ++;
101
-    return ret;
102
-}
103
-
104
-void avfilter_unref_buffer(AVFilterBufferRef *ref)
105
-{
106
-    if (!ref)
107
-        return;
108
-    av_assert0(ref->buf->refcount > 0);
109
-    if (!(--ref->buf->refcount))
110
-        ref->buf->free(ref->buf);
111
-    if (ref->extended_data != ref->data)
112
-        av_freep(&ref->extended_data);
113
-    if (ref->video)
114
-        av_freep(&ref->video->qp_table);
115
-    av_freep(&ref->video);
116
-    av_freep(&ref->audio);
117
-    av_dict_free(&ref->metadata);
118
-    av_free(ref);
119
-}
120
-
121
-void avfilter_unref_bufferp(AVFilterBufferRef **ref)
122
-{
123
-FF_DISABLE_DEPRECATION_WARNINGS
124
-    avfilter_unref_buffer(*ref);
125
-FF_ENABLE_DEPRECATION_WARNINGS
126
-    *ref = NULL;
127
-}
128
-
129
-int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
130
-{
131
-    dst->pts    = src->pts;
132
-    dst->pos    = av_frame_get_pkt_pos(src);
133
-    dst->format = src->format;
134
-
135
-    av_dict_free(&dst->metadata);
136
-    av_dict_copy(&dst->metadata, av_frame_get_metadata(src), 0);
137
-
138
-    switch (dst->type) {
139
-    case AVMEDIA_TYPE_VIDEO:
140
-        dst->video->w                   = src->width;
141
-        dst->video->h                   = src->height;
142
-        dst->video->sample_aspect_ratio = src->sample_aspect_ratio;
143
-        dst->video->interlaced          = src->interlaced_frame;
144
-        dst->video->top_field_first     = src->top_field_first;
145
-        dst->video->key_frame           = src->key_frame;
146
-        dst->video->pict_type           = src->pict_type;
147
-        break;
148
-    case AVMEDIA_TYPE_AUDIO:
149
-        dst->audio->sample_rate         = src->sample_rate;
150
-        dst->audio->channel_layout      = src->channel_layout;
151
-        break;
152
-    default:
153
-        return AVERROR(EINVAL);
154
-    }
155
-
156
-    return 0;
157
-}
158
-
159
-void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, const AVFilterBufferRef *src)
160
-{
161
-    // copy common properties
162
-    dst->pts             = src->pts;
163
-    dst->pos             = src->pos;
164
-
165
-    switch (src->type) {
166
-    case AVMEDIA_TYPE_VIDEO: {
167
-        if (dst->video->qp_table)
168
-            av_freep(&dst->video->qp_table);
169
-        copy_video_props(dst->video, src->video);
170
-        break;
171
-    }
172
-    case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break;
173
-    default: break;
174
-    }
175
-
176
-    av_dict_free(&dst->metadata);
177
-    av_dict_copy(&dst->metadata, src->metadata, 0);
178
-}
179
-#endif /* FF_API_AVFILTERBUFFER */
... ...
@@ -266,95 +266,6 @@ void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size)
266 266
     inlink->partial_buf_size = frame_size;
267 267
 }
268 268
 
269
-#if FF_API_AVFILTERBUFFER
270
-FF_DISABLE_DEPRECATION_WARNINGS
271
-static void compat_free_buffer(AVFilterBuffer *buf)
272
-{
273
-    AVFrame *frame = buf->priv;
274
-    av_frame_free(&frame);
275
-    av_free(buf);
276
-}
277
-
278
-static int compat_read(AVFilterContext *ctx,
279
-                       AVFilterBufferRef **pbuf, int nb_samples, int flags)
280
-{
281
-    AVFilterBufferRef *buf;
282
-    AVFrame *frame;
283
-    int ret;
284
-
285
-    if (!pbuf)
286
-        return ff_poll_frame(ctx->inputs[0]);
287
-
288
-    frame = av_frame_alloc();
289
-    if (!frame)
290
-        return AVERROR(ENOMEM);
291
-
292
-    if (!nb_samples)
293
-        ret = av_buffersink_get_frame_flags(ctx, frame, flags);
294
-    else
295
-        ret = av_buffersink_get_samples(ctx, frame, nb_samples);
296
-
297
-    if (ret < 0)
298
-        goto fail;
299
-
300
-    AV_NOWARN_DEPRECATED(
301
-    if (ctx->inputs[0]->type == AVMEDIA_TYPE_VIDEO) {
302
-        buf = avfilter_get_video_buffer_ref_from_arrays(frame->data, frame->linesize,
303
-                                                        AV_PERM_READ,
304
-                                                        frame->width, frame->height,
305
-                                                        frame->format);
306
-    } else {
307
-        buf = avfilter_get_audio_buffer_ref_from_arrays(frame->extended_data,
308
-                                                        frame->linesize[0], AV_PERM_READ,
309
-                                                        frame->nb_samples,
310
-                                                        frame->format,
311
-                                                        frame->channel_layout);
312
-    }
313
-    if (!buf) {
314
-        ret = AVERROR(ENOMEM);
315
-        goto fail;
316
-    }
317
-
318
-    avfilter_copy_frame_props(buf, frame);
319
-    )
320
-
321
-    buf->buf->priv = frame;
322
-    buf->buf->free = compat_free_buffer;
323
-
324
-    *pbuf = buf;
325
-
326
-    return 0;
327
-fail:
328
-    av_frame_free(&frame);
329
-    return ret;
330
-}
331
-
332
-int attribute_align_arg av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf)
333
-{
334
-    return compat_read(ctx, buf, 0, 0);
335
-}
336
-
337
-int attribute_align_arg av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **buf,
338
-                                                   int nb_samples)
339
-{
340
-    return compat_read(ctx, buf, nb_samples, 0);
341
-}
342
-
343
-int attribute_align_arg av_buffersink_get_buffer_ref(AVFilterContext *ctx,
344
-                                                     AVFilterBufferRef **bufref, int flags)
345
-{
346
-    *bufref = NULL;
347
-
348
-    av_assert0(    !strcmp(ctx->filter->name, "buffersink")
349
-                || !strcmp(ctx->filter->name, "abuffersink")
350
-                || !strcmp(ctx->filter->name, "ffbuffersink")
351
-                || !strcmp(ctx->filter->name, "ffabuffersink"));
352
-
353
-    return compat_read(ctx, bufref, 0, flags);
354
-}
355
-FF_ENABLE_DEPRECATION_WARNINGS
356
-#endif
357
-
358 269
 AVRational av_buffersink_get_frame_rate(AVFilterContext *ctx)
359 270
 {
360 271
     av_assert0(   !strcmp(ctx->filter->name, "buffersink")
... ...
@@ -363,23 +274,6 @@ AVRational av_buffersink_get_frame_rate(AVFilterContext *ctx)
363 363
     return ctx->inputs[0]->frame_rate;
364 364
 }
365 365
 
366
-#if FF_API_AVFILTERBUFFER
367
-FF_DISABLE_DEPRECATION_WARNINGS
368
-int attribute_align_arg av_buffersink_poll_frame(AVFilterContext *ctx)
369
-{
370
-    BufferSinkContext *buf = ctx->priv;
371
-    AVFilterLink *inlink = ctx->inputs[0];
372
-
373
-    av_assert0(   !strcmp(ctx->filter->name, "buffersink")
374
-               || !strcmp(ctx->filter->name, "abuffersink")
375
-               || !strcmp(ctx->filter->name, "ffbuffersink")
376
-               || !strcmp(ctx->filter->name, "ffabuffersink"));
377
-
378
-    return av_fifo_size(buf->fifo)/FIFO_INIT_ELEMENT_SIZE + ff_poll_frame(inlink);
379
-}
380
-FF_ENABLE_DEPRECATION_WARNINGS
381
-#endif
382
-
383 366
 static av_cold int vsink_init(AVFilterContext *ctx, void *opaque)
384 367
 {
385 368
     BufferSinkContext *buf = ctx->priv;
... ...
@@ -518,57 +412,6 @@ static const AVOption abuffersink_options[] = {
518 518
 AVFILTER_DEFINE_CLASS(buffersink);
519 519
 AVFILTER_DEFINE_CLASS(abuffersink);
520 520
 
521
-#if FF_API_AVFILTERBUFFER
522
-
523
-#define ffbuffersink_options buffersink_options
524
-#define ffabuffersink_options abuffersink_options
525
-AVFILTER_DEFINE_CLASS(ffbuffersink);
526
-AVFILTER_DEFINE_CLASS(ffabuffersink);
527
-
528
-static const AVFilterPad ffbuffersink_inputs[] = {
529
-    {
530
-        .name      = "default",
531
-        .type      = AVMEDIA_TYPE_VIDEO,
532
-        .filter_frame = filter_frame,
533
-    },
534
-    { NULL },
535
-};
536
-
537
-AVFilter ff_vsink_ffbuffersink = {
538
-    .name      = "ffbuffersink",
539
-    .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
540
-    .priv_size = sizeof(BufferSinkContext),
541
-    .priv_class = &ffbuffersink_class,
542
-    .init_opaque = vsink_init,
543
-    .uninit    = uninit,
544
-
545
-    .query_formats = vsink_query_formats,
546
-    .inputs        = ffbuffersink_inputs,
547
-    .outputs       = NULL,
548
-};
549
-
550
-static const AVFilterPad ffabuffersink_inputs[] = {
551
-    {
552
-        .name           = "default",
553
-        .type           = AVMEDIA_TYPE_AUDIO,
554
-        .filter_frame   = filter_frame,
555
-    },
556
-    { NULL },
557
-};
558
-
559
-AVFilter ff_asink_ffabuffersink = {
560
-    .name      = "ffabuffersink",
561
-    .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
562
-    .init_opaque = asink_init,
563
-    .uninit    = uninit,
564
-    .priv_size = sizeof(BufferSinkContext),
565
-    .priv_class = &ffabuffersink_class,
566
-    .query_formats = asink_query_formats,
567
-    .inputs        = ffabuffersink_inputs,
568
-    .outputs       = NULL,
569
-};
570
-#endif /* FF_API_AVFILTERBUFFER */
571
-
572 521
 static const AVFilterPad avfilter_vsink_buffer_inputs[] = {
573 522
     {
574 523
         .name         = "default",
... ...
@@ -33,63 +33,6 @@
33 33
  * @{
34 34
  */
35 35
 
36
-#if FF_API_AVFILTERBUFFER
37
-/**
38
- * Get an audio/video buffer data from buffer_sink and put it in bufref.
39
- *
40
- * This function works with both audio and video buffer sinks.
41
- *
42
- * @param buffer_sink pointer to a buffersink or abuffersink context
43
- * @param flags a combination of AV_BUFFERSINK_FLAG_* flags
44
- * @return >= 0 in case of success, a negative AVERROR code in case of
45
- * failure
46
- */
47
-attribute_deprecated
48
-int av_buffersink_get_buffer_ref(AVFilterContext *buffer_sink,
49
-                                 AVFilterBufferRef **bufref, int flags);
50
-
51
-/**
52
- * Get the number of immediately available frames.
53
- */
54
-attribute_deprecated
55
-int av_buffersink_poll_frame(AVFilterContext *ctx);
56
-
57
-/**
58
- * Get a buffer with filtered data from sink and put it in buf.
59
- *
60
- * @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
61
- * @param buf pointer to the buffer will be written here if buf is non-NULL. buf
62
- *            must be freed by the caller using avfilter_unref_buffer().
63
- *            Buf may also be NULL to query whether a buffer is ready to be
64
- *            output.
65
- *
66
- * @return >= 0 in case of success, a negative AVERROR code in case of
67
- *         failure.
68
- */
69
-attribute_deprecated
70
-int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf);
71
-
72
-/**
73
- * Same as av_buffersink_read, but with the ability to specify the number of
74
- * samples read. This function is less efficient than av_buffersink_read(),
75
- * because it copies the data around.
76
- *
77
- * @param ctx pointer to a context of the abuffersink AVFilter.
78
- * @param buf pointer to the buffer will be written here if buf is non-NULL. buf
79
- *            must be freed by the caller using avfilter_unref_buffer(). buf
80
- *            will contain exactly nb_samples audio samples, except at the end
81
- *            of stream, when it can contain less than nb_samples.
82
- *            Buf may also be NULL to query whether a buffer is ready to be
83
- *            output.
84
- *
85
- * @warning do not mix this function with av_buffersink_read(). Use only one or
86
- * the other with a single sink, not both.
87
- */
88
-attribute_deprecated
89
-int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **buf,
90
-                               int nb_samples);
91
-#endif
92
-
93 36
 /**
94 37
  * Get a frame with filtered data from sink and put it in frame.
95 38
  *
... ...
@@ -184,127 +184,6 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
184 184
     return 0;
185 185
 }
186 186
 
187
-#if FF_API_AVFILTERBUFFER
188
-FF_DISABLE_DEPRECATION_WARNINGS
189
-static void compat_free_buffer(void *opaque, uint8_t *data)
190
-{
191
-    AVFilterBufferRef *buf = opaque;
192
-    AV_NOWARN_DEPRECATED(
193
-    avfilter_unref_buffer(buf);
194
-    )
195
-}
196
-
197
-static void compat_unref_buffer(void *opaque, uint8_t *data)
198
-{
199
-    AVBufferRef *buf = opaque;
200
-    AV_NOWARN_DEPRECATED(
201
-    av_buffer_unref(&buf);
202
-    )
203
-}
204
-
205
-int av_buffersrc_add_ref(AVFilterContext *ctx, AVFilterBufferRef *buf,
206
-                         int flags)
207
-{
208
-    BufferSourceContext *s = ctx->priv;
209
-    AVFrame *frame = NULL;
210
-    AVBufferRef *dummy_buf = NULL;
211
-    int ret = 0, planes, i;
212
-
213
-    if (!buf) {
214
-        s->eof = 1;
215
-        return 0;
216
-    } else if (s->eof)
217
-        return AVERROR(EINVAL);
218
-
219
-    frame = av_frame_alloc();
220
-    if (!frame)
221
-        return AVERROR(ENOMEM);
222
-
223
-    dummy_buf = av_buffer_create(NULL, 0, compat_free_buffer, buf,
224
-                                 (buf->perms & AV_PERM_WRITE) ? 0 : AV_BUFFER_FLAG_READONLY);
225
-    if (!dummy_buf) {
226
-        ret = AVERROR(ENOMEM);
227
-        goto fail;
228
-    }
229
-
230
-    AV_NOWARN_DEPRECATED(
231
-    if ((ret = avfilter_copy_buf_props(frame, buf)) < 0)
232
-        goto fail;
233
-    )
234
-
235
-#define WRAP_PLANE(ref_out, data, data_size)                            \
236
-do {                                                                    \
237
-    AVBufferRef *dummy_ref = av_buffer_ref(dummy_buf);                  \
238
-    if (!dummy_ref) {                                                   \
239
-        ret = AVERROR(ENOMEM);                                          \
240
-        goto fail;                                                      \
241
-    }                                                                   \
242
-    ref_out = av_buffer_create(data, data_size, compat_unref_buffer,    \
243
-                               dummy_ref, (buf->perms & AV_PERM_WRITE) ? 0 : AV_BUFFER_FLAG_READONLY);                           \
244
-    if (!ref_out) {                                                     \
245
-        av_buffer_unref(&dummy_ref);                                    \
246
-        av_frame_unref(frame);                                          \
247
-        ret = AVERROR(ENOMEM);                                          \
248
-        goto fail;                                                      \
249
-    }                                                                   \
250
-} while (0)
251
-
252
-    if (ctx->outputs[0]->type  == AVMEDIA_TYPE_VIDEO) {
253
-        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
254
-
255
-        planes = av_pix_fmt_count_planes(frame->format);
256
-        if (!desc || planes <= 0) {
257
-            ret = AVERROR(EINVAL);
258
-            goto fail;
259
-        }
260
-
261
-        for (i = 0; i < planes; i++) {
262
-            int v_shift    = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
263
-            int plane_size = (frame->height >> v_shift) * frame->linesize[i];
264
-
265
-            WRAP_PLANE(frame->buf[i], frame->data[i], plane_size);
266
-        }
267
-    } else {
268
-        int planar = av_sample_fmt_is_planar(frame->format);
269
-        int channels = av_get_channel_layout_nb_channels(frame->channel_layout);
270
-
271
-        planes = planar ? channels : 1;
272
-
273
-        if (planes > FF_ARRAY_ELEMS(frame->buf)) {
274
-            frame->nb_extended_buf = planes - FF_ARRAY_ELEMS(frame->buf);
275
-            frame->extended_buf = av_mallocz_array(sizeof(*frame->extended_buf),
276
-                                             frame->nb_extended_buf);
277
-            if (!frame->extended_buf) {
278
-                ret = AVERROR(ENOMEM);
279
-                goto fail;
280
-            }
281
-        }
282
-
283
-        for (i = 0; i < FFMIN(planes, FF_ARRAY_ELEMS(frame->buf)); i++)
284
-            WRAP_PLANE(frame->buf[i], frame->extended_data[i], frame->linesize[0]);
285
-
286
-        for (i = 0; i < planes - FF_ARRAY_ELEMS(frame->buf); i++)
287
-            WRAP_PLANE(frame->extended_buf[i],
288
-                       frame->extended_data[i + FF_ARRAY_ELEMS(frame->buf)],
289
-                       frame->linesize[0]);
290
-    }
291
-
292
-    ret = av_buffersrc_add_frame_flags(ctx, frame, flags);
293
-
294
-fail:
295
-    av_buffer_unref(&dummy_buf);
296
-    av_frame_free(&frame);
297
-
298
-    return ret;
299
-}
300
-FF_ENABLE_DEPRECATION_WARNINGS
301
-
302
-int av_buffersrc_buffer(AVFilterContext *ctx, AVFilterBufferRef *buf)
303
-{
304
-    return av_buffersrc_add_ref(ctx, buf, 0);
305
-}
306
-#endif
307
-
308 187
 static av_cold int init_video(AVFilterContext *ctx)
309 188
 {
310 189
     BufferSourceContext *c = ctx->priv;
... ...
@@ -42,13 +42,6 @@ enum {
42 42
      */
43 43
     AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT = 1,
44 44
 
45
-#if FF_API_AVFILTERBUFFER
46
-    /**
47
-     * Ignored
48
-     */
49
-    AV_BUFFERSRC_FLAG_NO_COPY = 2,
50
-#endif
51
-
52 45
     /**
53 46
      * Immediately push the frame to the output.
54 47
      */
... ...
@@ -63,21 +56,6 @@ enum {
63 63
 
64 64
 };
65 65
 
66
-#if FF_API_AVFILTERBUFFER
67
-/**
68
- * Add buffer data in picref to buffer_src.
69
- *
70
- * @param buffer_src  pointer to a buffer source context
71
- * @param picref      a buffer reference, or NULL to mark EOF
72
- * @param flags       a combination of AV_BUFFERSRC_FLAG_*
73
- * @return            >= 0 in case of success, a negative AVERROR code
74
- *                    in case of failure
75
- */
76
-attribute_deprecated
77
-int av_buffersrc_add_ref(AVFilterContext *buffer_src,
78
-                         AVFilterBufferRef *picref, int flags);
79
-#endif
80
-
81 66
 /**
82 67
  * Get the number of failed requests.
83 68
  *
... ...
@@ -87,21 +65,6 @@ int av_buffersrc_add_ref(AVFilterContext *buffer_src,
87 87
  */
88 88
 unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src);
89 89
 
90
-#if FF_API_AVFILTERBUFFER
91
-/**
92
- * Add a buffer to a filtergraph.
93
- *
94
- * @param ctx an instance of the buffersrc filter
95
- * @param buf buffer containing frame data to be passed down the filtergraph.
96
- * This function will take ownership of buf, the user must not free it.
97
- * A NULL buf signals EOF -- i.e. no more frames will be sent to this filter.
98
- *
99
- * @deprecated use av_buffersrc_write_frame() or av_buffersrc_add_frame()
100
- */
101
-attribute_deprecated
102
-int av_buffersrc_buffer(AVFilterContext *ctx, AVFilterBufferRef *buf);
103
-#endif
104
-
105 90
 /**
106 91
  * Add a frame to the buffer source.
107 92
  *
... ...
@@ -162,11 +162,6 @@ struct AVFilterInternal {
162 162
     avfilter_execute_func *execute;
163 163
 };
164 164
 
165
-#if FF_API_AVFILTERBUFFER
166
-/** default handler for freeing audio/video buffer when there are no references left */
167
-void ff_avfilter_default_free_buffer(AVFilterBuffer *buf);
168
-#endif
169
-
170 165
 /** Tell is a format is contained in the provided list terminated by -1. */
171 166
 int ff_fmt_is_in(int fmt, const int *fmts);
172 167
 
... ...
@@ -49,9 +49,6 @@
49 49
  * the public API and may change, break or disappear at any time.
50 50
  */
51 51
 
52
-#ifndef FF_API_AVFILTERBUFFER
53
-#define FF_API_AVFILTERBUFFER               (LIBAVFILTER_VERSION_MAJOR < 6)
54
-#endif
55 52
 #ifndef FF_API_OLD_FILTER_OPTS
56 53
 #define FF_API_OLD_FILTER_OPTS              (LIBAVFILTER_VERSION_MAJOR < 6)
57 54
 #endif
... ...
@@ -59,53 +59,6 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
59 59
     return frame;
60 60
 }
61 61
 
62
-#if FF_API_AVFILTERBUFFER
63
-AVFilterBufferRef *
64
-avfilter_get_video_buffer_ref_from_arrays(uint8_t * const data[4], const int linesize[4], int perms,
65
-                                          int w, int h, enum AVPixelFormat format)
66
-{
67
-    AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer));
68
-    AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef));
69
-
70
-    if (!pic || !picref)
71
-        goto fail;
72
-
73
-    picref->buf = pic;
74
-    picref->buf->free = ff_avfilter_default_free_buffer;
75
-    if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps))))
76
-        goto fail;
77
-
78
-    pic->w = picref->video->w = w;
79
-    pic->h = picref->video->h = h;
80
-
81
-    /* make sure the buffer gets read permission or it's useless for output */
82
-    picref->perms = perms | AV_PERM_READ;
83
-
84
-    pic->refcount = 1;
85
-    picref->type = AVMEDIA_TYPE_VIDEO;
86
-    pic->format = picref->format = format;
87
-
88
-    memcpy(pic->data,        data,          4*sizeof(data[0]));
89
-    memcpy(pic->linesize,    linesize,      4*sizeof(linesize[0]));
90
-    memcpy(picref->data,     pic->data,     sizeof(picref->data));
91
-    memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize));
92
-
93
-    pic->   extended_data = pic->data;
94
-    picref->extended_data = picref->data;
95
-
96
-    picref->pts = AV_NOPTS_VALUE;
97
-
98
-    return picref;
99
-
100
-fail:
101
-    if (picref && picref->video)
102
-        av_free(picref->video);
103
-    av_free(picref);
104
-    av_free(pic);
105
-    return NULL;
106
-}
107
-#endif
108
-
109 62
 AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h)
110 63
 {
111 64
     AVFrame *ret = NULL;