---
 libavfilter/af_amix.c        |    4 +-
 libavfilter/af_asyncts.c     |    6 +--
 libavfilter/af_resample.c    |    4 +-
 libavfilter/audio.c          |   68 ++++++++++++++++-------------
 libavfilter/audio.h          |   10 ++---
 libavfilter/avfilter.c       |   38 +++++++---------
 libavfilter/avfilter.h       |   28 +++++++++---
 libavfilter/buffersink.c     |    2 +-
 libavfilter/buffersrc.c      |    6 +--
 libavfilter/fifo.c           |    3 +-
 libavfilter/internal.h       |   29 ++-----------
 libavfilter/version.h        |    3 ++
 libavfilter/vf_boxblur.c     |    2 +-
 libavfilter/vf_delogo.c      |    2 +-
 libavfilter/vf_fieldorder.c  |    4 +-
 libavfilter/vf_frei0r.c      |    4 +-
 libavfilter/vf_gradfun.c     |    2 +-
 libavfilter/vf_hflip.c       |    2 +-
 libavfilter/vf_hqdn3d.c      |    2 +-
 libavfilter/vf_libopencv.c   |    2 +-
 libavfilter/vf_lut.c         |    2 +-
 libavfilter/vf_pad.c         |    6 +--
 libavfilter/vf_pixdesctest.c |    3 +-
 libavfilter/vf_scale.c       |    2 +-
 libavfilter/vf_transpose.c   |    2 +-
 libavfilter/vf_unsharp.c     |    2 +-
 libavfilter/vf_vflip.c       |   20 ++++-----
 libavfilter/vf_yadif.c       |   20 ++++-----
 libavfilter/video.c          |   98 +++++++++++++-----------------------------
 libavfilter/video.h          |    9 ++--
 libavfilter/vsrc_color.c     |    2 +-
 libavfilter/vsrc_movie.c     |    3 +-
 libavfilter/vsrc_testsrc.c   |    2 +-
 33 files changed, 165 insertions(+), 227 deletions(-)

diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index c2fb158..ac9ee91 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -280,11 +280,11 @@ static int output_frame(AVFilterLink *outlink, int 
nb_samples)
 
     calculate_scales(s, nb_samples);
 
-    out_buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE, nb_samples);
+    out_buf = ff_get_audio_buffer(outlink, nb_samples);
     if (!out_buf)
         return AVERROR(ENOMEM);
 
-    in_buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE, nb_samples);
+    in_buf = ff_get_audio_buffer(outlink, nb_samples);
     if (!in_buf) {
         avfilter_unref_buffer(out_buf);
         return AVERROR(ENOMEM);
diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c
index 5d009f0..e83069b 100644
--- a/libavfilter/af_asyncts.c
+++ b/libavfilter/af_asyncts.c
@@ -129,8 +129,7 @@ static int request_frame(AVFilterLink *link)
 
     /* flush the fifo */
     if (ret == AVERROR_EOF && (nb_samples = avresample_get_delay(s->avr))) {
-        AVFilterBufferRef *buf = ff_get_audio_buffer(link, AV_PERM_WRITE,
-                                                     nb_samples);
+        AVFilterBufferRef *buf = ff_get_audio_buffer(link, nb_samples);
         if (!buf)
             return AVERROR(ENOMEM);
         ret = avresample_convert(s->avr, buf->extended_data,
@@ -203,8 +202,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *buf)
     }
 
     if (out_size > 0) {
-        AVFilterBufferRef *buf_out = ff_get_audio_buffer(outlink, 
AV_PERM_WRITE,
-                                                         out_size);
+        AVFilterBufferRef *buf_out = ff_get_audio_buffer(outlink, out_size);
         if (!buf_out) {
             ret = AVERROR(ENOMEM);
             goto fail;
diff --git a/libavfilter/af_resample.c b/libavfilter/af_resample.c
index c712b46..10d16d0 100644
--- a/libavfilter/af_resample.c
+++ b/libavfilter/af_resample.c
@@ -149,7 +149,7 @@ static int request_frame(AVFilterLink *outlink)
         if (!nb_samples)
             return ret;
 
-        buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE, nb_samples);
+        buf = ff_get_audio_buffer(outlink, nb_samples);
         if (!buf)
             return AVERROR(ENOMEM);
 
@@ -184,7 +184,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *buf)
                                     outlink->sample_rate, inlink->sample_rate,
                                     AV_ROUND_UP);
 
-        buf_out = ff_get_audio_buffer(outlink, AV_PERM_WRITE, nb_samples);
+        buf_out = ff_get_audio_buffer(outlink, nb_samples);
         if (!buf_out) {
             ret = AVERROR(ENOMEM);
             goto fail;
diff --git a/libavfilter/audio.c b/libavfilter/audio.c
index bbe12b2..5295423 100644
--- a/libavfilter/audio.c
+++ b/libavfilter/audio.c
@@ -23,60 +23,65 @@
 #include "avfilter.h"
 #include "internal.h"
 
-AVFilterBufferRef *ff_null_get_audio_buffer(AVFilterLink *link, int perms,
-                                            int nb_samples)
+AVFrame *ff_null_get_audio_buffer(AVFilterLink *link, int nb_samples)
 {
-    return ff_get_audio_buffer(link->dst->outputs[0], perms, nb_samples);
+    return ff_get_audio_buffer(link->dst->outputs[0], nb_samples);
 }
 
-AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,
-                                               int nb_samples)
+AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples)
 {
-    AVFilterBufferRef *samplesref = NULL;
-    uint8_t **data;
-    int planar      = av_sample_fmt_is_planar(link->format);
-    int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
-    int planes      = planar ? nb_channels : 1;
-    int linesize;
-
-    if (!(data = av_mallocz(sizeof(*data) * planes)))
+    AVFrame *frame = av_frame_alloc();
+    int channels = av_get_channel_layout_nb_channels(link->channel_layout);
+    int buf_size, ret;
+
+    if (!frame)
+        return NULL;
+
+    buf_size = av_samples_get_buffer_size(NULL, channels, nb_samples,
+                                          link->format, 0);
+    if (buf_size < 0)
         goto fail;
 
-    if (av_samples_alloc(data, &linesize, nb_channels, nb_samples, 
link->format, 0) < 0)
+    frame->buf[0] = av_buffer_alloc(buf_size);
+    if (!frame->buf[0])
         goto fail;
 
-    samplesref = avfilter_get_audio_buffer_ref_from_arrays(data, linesize, 
perms,
-                                                           nb_samples, 
link->format,
-                                                           
link->channel_layout);
-    if (!samplesref)
+    frame->nb_samples = nb_samples;
+    ret = avcodec_fill_audio_frame(frame, channels, link->format,
+                                   frame->buf[0]->data, buf_size, 0);
+    if (ret < 0)
         goto fail;
 
-    av_freep(&data);
+    av_samples_set_silence(frame->extended_data, 0, nb_samples, channels,
+                           link->format);
+
+    frame->nb_samples     = nb_samples;
+    frame->format         = link->format;
+    frame->channel_layout = link->channel_layout;
+    frame->sample_rate    = link->sample_rate;
+
+    return frame;
 
 fail:
-    if (data)
-        av_freep(&data[0]);
-    av_freep(&data);
-    return samplesref;
+    av_buffer_unref(&frame->buf[0]);
+    av_frame_free(&frame);
+    return NULL;
 }
 
-AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,
-                                       int nb_samples)
+AVFrame *ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
 {
-    AVFilterBufferRef *ret = NULL;
+    AVFrame *ret = NULL;
 
     if (link->dstpad->get_audio_buffer)
-        ret = link->dstpad->get_audio_buffer(link, perms, nb_samples);
+        ret = link->dstpad->get_audio_buffer(link, nb_samples);
 
     if (!ret)
-        ret = ff_default_get_audio_buffer(link, perms, nb_samples);
-
-    if (ret)
-        ret->type = AVMEDIA_TYPE_AUDIO;
+        ret = ff_default_get_audio_buffer(link, nb_samples);
 
     return ret;
 }
 
+#if FF_API_AVFILTERBUFFER
 AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data,
                                                              int linesize,int 
perms,
                                                              int nb_samples,
@@ -146,3 +151,4 @@ fail:
     av_freep(&samples);
     return NULL;
 }
+#endif
diff --git a/libavfilter/audio.h b/libavfilter/audio.h
index a377503..4684b6c 100644
--- a/libavfilter/audio.h
+++ b/libavfilter/audio.h
@@ -22,24 +22,20 @@
 #include "avfilter.h"
 
 /** default handler for get_audio_buffer() for audio inputs */
-AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,
-                                                     int nb_samples);
+AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples);
 
 /** get_audio_buffer() handler for filters which simply pass audio along */
-AVFilterBufferRef *ff_null_get_audio_buffer(AVFilterLink *link, int perms,
-                                                  int nb_samples);
+AVFrame *ff_null_get_audio_buffer(AVFilterLink *link, int nb_samples);
 
 /**
  * Request an audio samples buffer with a specific set of permissions.
  *
  * @param link           the output link to the filter from which the buffer 
will
  *                       be requested
- * @param perms          the required access permissions
  * @param nb_samples     the number of samples per channel
  * @return               A reference to the samples. This must be unreferenced 
with
  *                       avfilter_unref_buffer when you are finished with it.
  */
-AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,
-                                             int nb_samples);
+AVFrame *ff_get_audio_buffer(AVFilterLink *link, int nb_samples);
 
 #endif /* AVFILTER_AUDIO_H */
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 93302cc..af9d9ee 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -451,17 +451,16 @@ enum AVMediaType avfilter_pad_get_type(AVFilterPad *pads, 
int pad_idx)
     return pads[pad_idx].type;
 }
 
-static int default_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
+static int default_filter_frame(AVFilterLink *link, AVFrame *frame)
 {
     return ff_filter_frame(link->dst->outputs[0], frame);
 }
 
-int ff_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
+int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
 {
-    int (*filter_frame)(AVFilterLink *, AVFilterBufferRef *);
+    int (*filter_frame)(AVFilterLink *, AVFrame *);
     AVFilterPad *dst = link->dstpad;
-    AVFilterBufferRef *out;
-    int perms = frame->perms;
+    AVFrame *out;
 
     FF_DPRINTF_START(NULL, filter_frame);
     ff_dlog_link(NULL, link, 1);
@@ -469,47 +468,40 @@ int ff_filter_frame(AVFilterLink *link, AVFilterBufferRef 
*frame)
     if (!(filter_frame = dst->filter_frame))
         filter_frame = default_filter_frame;
 
-    if (frame->linesize[0] < 0)
-        perms |= AV_PERM_NEG_LINESIZES;
-    /* prepare to copy the frame if the buffer has insufficient permissions */
-    if ((dst->min_perms & perms) != dst->min_perms ||
-        dst->rej_perms & perms) {
-        av_log(link->dst, AV_LOG_DEBUG,
-               "Copying data in avfilter (have perms %x, need %x, reject 
%x)\n",
-               perms, link->dstpad->min_perms, link->dstpad->rej_perms);
+    /* copy the frame if needed */
+    if (dst->needs_writable && !av_frame_is_writable(frame)) {
+        av_log(link->dst, AV_LOG_DEBUG, "Copying data in avfilter.\n");
 
         switch (link->type) {
         case AVMEDIA_TYPE_VIDEO:
-            out = ff_get_video_buffer(link, dst->min_perms,
-                                      link->w, link->h);
+            out = ff_get_video_buffer(link, link->w, link->h);
             break;
         case AVMEDIA_TYPE_AUDIO:
-            out = ff_get_audio_buffer(link, dst->min_perms,
-                                      frame->audio->nb_samples);
+            out = ff_get_audio_buffer(link, frame->nb_samples);
             break;
         default: return AVERROR(EINVAL);
         }
         if (!out) {
-            avfilter_unref_buffer(frame);
+            av_frame_free(&frame);
             return AVERROR(ENOMEM);
         }
-        avfilter_copy_buffer_ref_props(out, frame);
+        av_frame_copy_props(out, frame);
 
         switch (link->type) {
         case AVMEDIA_TYPE_VIDEO:
             av_image_copy(out->data, out->linesize, frame->data, 
frame->linesize,
-                          frame->format, frame->video->w, frame->video->h);
+                          frame->format, frame->width, frame->height);
             break;
         case AVMEDIA_TYPE_AUDIO:
             av_samples_copy(out->extended_data, frame->extended_data,
-                            0, 0, frame->audio->nb_samples,
-                            
av_get_channel_layout_nb_channels(frame->audio->channel_layout),
+                            0, 0, frame->nb_samples,
+                            
av_get_channel_layout_nb_channels(frame->channel_layout),
                             frame->format);
             break;
         default: return AVERROR(EINVAL);
         }
 
-        avfilter_unref_buffer(frame);
+        av_frame_free(&frame);
     } else
         out = frame;
 
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index c5f8d56..b3522f8 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -23,6 +23,7 @@
 #define AVFILTER_AVFILTER_H
 
 #include "libavutil/avutil.h"
+#include "libavutil/frame.h"
 #include "libavutil/log.h"
 #include "libavutil/samplefmt.h"
 #include "libavutil/pixfmt.h"
@@ -54,6 +55,7 @@ typedef struct AVFilterLink    AVFilterLink;
 typedef struct AVFilterPad     AVFilterPad;
 typedef struct AVFilterFormats AVFilterFormats;
 
+#if FF_API_AVFILTERBUFFER
 /**
  * A reference-counted buffer data type used by the filter system. Filters
  * should not store pointers to this structure directly, but instead use the
@@ -177,6 +179,7 @@ typedef struct AVFilterBufferRef {
 /**
  * Copy properties of src to dst, without copying the actual data
  */
+attribute_deprecated
 void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef 
*src);
 
 /**
@@ -188,6 +191,7 @@ void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, 
AVFilterBufferRef *s
  * @return      a new reference to the buffer with the same properties as the
  *              old, excluding any permissions denied by pmask
  */
+attribute_deprecated
 AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask);
 
 /**
@@ -199,6 +203,7 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef 
*ref, int pmask);
  * @note it is recommended to use avfilter_unref_bufferp() instead of this
  * function
  */
+attribute_deprecated
 void avfilter_unref_buffer(AVFilterBufferRef *ref);
 
 /**
@@ -208,7 +213,9 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref);
  *
  * @param ref pointer to the buffer reference
  */
+attribute_deprecated
 void avfilter_unref_bufferp(AVFilterBufferRef **ref);
+#endif
 
 #if FF_API_AVFILTERPAD_PUBLIC
 /**
@@ -239,7 +246,7 @@ struct AVFilterPad {
      *
      * Input pads only.
      */
-    int min_perms;
+    attribute_deprecated int min_perms;
 
     /**
      * Permissions which are not accepted on incoming buffers. Any buffer
@@ -250,7 +257,7 @@ struct AVFilterPad {
      *
      * Input pads only.
      */
-    int rej_perms;
+    attribute_deprecated int rej_perms;
 
     /**
      * @deprecated unused
@@ -263,7 +270,7 @@ struct AVFilterPad {
      *
      * Input video pads only.
      */
-    AVFilterBufferRef *(*get_video_buffer)(AVFilterLink *link, int perms, int 
w, int h);
+    AVFrame *(*get_video_buffer)(AVFilterLink *link, int w, int h);
 
     /**
      * Callback function to get an audio buffer. If NULL, the filter system 
will
@@ -271,8 +278,7 @@ struct AVFilterPad {
      *
      * Input audio pads only.
      */
-    AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms,
-                                           int nb_samples);
+    AVFrame *(*get_audio_buffer)(AVFilterLink *link, int nb_samples);
 
     /**
      * @deprecated unused
@@ -294,7 +300,7 @@ struct AVFilterPad {
      * must ensure that samplesref is properly unreferenced on error if it
      * hasn't been passed on to another filter.
      */
-    int (*filter_frame)(AVFilterLink *link, AVFilterBufferRef *frame);
+    int (*filter_frame)(AVFilterLink *link, AVFrame *frame);
 
     /**
      * Frame poll callback. This returns the number of immediately available
@@ -339,6 +345,8 @@ struct AVFilterPad {
      * input pads only.
      */
     int needs_fifo;
+
+    int needs_writable;
 };
 #endif
 
@@ -535,6 +543,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
  */
 int avfilter_config_links(AVFilterContext *filter);
 
+#if FF_API_AVFILTERBUFFER
 /**
  * Create a buffer reference wrapped around an already allocated image
  * buffer.
@@ -546,6 +555,7 @@ int avfilter_config_links(AVFilterContext *filter);
  * @param h the height of the image specified by the data and linesize arrays
  * @param format the pixel format of the image specified by the data and 
linesize arrays
  */
+attribute_deprecated
 AVFilterBufferRef *
 avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], 
int perms,
                                           int w, int h, enum AVPixelFormat 
format);
@@ -561,12 +571,14 @@ avfilter_get_video_buffer_ref_from_arrays(uint8_t 
*data[4], int linesize[4], int
  * @param sample_fmt     the format of each sample in the buffer to allocate
  * @param channel_layout the channel layout of the buffer
  */
+attribute_deprecated
 AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data,
                                                              int linesize,
                                                              int perms,
                                                              int nb_samples,
                                                              enum 
AVSampleFormat sample_fmt,
                                                              uint64_t 
channel_layout);
+#endif
 
 /** Initialize the filter system. Register all builtin filters. */
 void avfilter_register_all(void);
@@ -645,12 +657,14 @@ void avfilter_free(AVFilterContext *filter);
 int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
                            unsigned filt_srcpad_idx, unsigned filt_dstpad_idx);
 
+#if FF_API_AVFILTERBUFFER
 /**
  * Copy the frame properties of src to dst, without copying the actual
  * image data.
  *
  * @return 0 on success, a negative number on error.
  */
+attribute_deprecated
 int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src);
 
 /**
@@ -659,6 +673,8 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const 
AVFrame *src);
  *
  * @return 0 on success, a negative number on error.
  */
+attribute_deprecated
 int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src);
+#endif
 
 #endif /* AVFILTER_AVFILTER_H */
diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index a315cb3..780de35 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -86,7 +86,7 @@ static int read_from_fifo(AVFilterContext *ctx, 
AVFilterBufferRef **pbuf,
     AVFilterLink   *link = ctx->inputs[0];
     AVFilterBufferRef *buf;
 
-    if (!(buf = ff_get_audio_buffer(link, AV_PERM_WRITE, nb_samples)))
+    if (!(buf = ff_get_audio_buffer(link, nb_samples)))
         return AVERROR(ENOMEM);
     av_audio_fifo_read(s->audio_fifo, (void**)buf->extended_data, nb_samples);
 
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 3cee68d..3cc756d 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -90,8 +90,7 @@ int av_buffersrc_write_frame(AVFilterContext *buffer_filter, 
const AVFrame *fram
     case AVMEDIA_TYPE_VIDEO:
         CHECK_VIDEO_PARAM_CHANGE(buffer_filter, c, frame->width, frame->height,
                                  frame->format);
-        buf = ff_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE,
-                                  c->w, c->h);
+        buf = ff_get_video_buffer(buffer_filter->outputs[0], c->w, c->h);
         if (!buf)
             return AVERROR(ENOMEM);
 
@@ -101,8 +100,7 @@ int av_buffersrc_write_frame(AVFilterContext 
*buffer_filter, const AVFrame *fram
     case AVMEDIA_TYPE_AUDIO:
         CHECK_AUDIO_PARAM_CHANGE(buffer_filter, c, frame->sample_rate, 
frame->channel_layout,
                                  frame->format);
-        buf = ff_get_audio_buffer(buffer_filter->outputs[0], AV_PERM_WRITE,
-                                  frame->nb_samples);
+        buf = ff_get_audio_buffer(buffer_filter->outputs[0], 
frame->nb_samples);
         if (!buf)
             return AVERROR(ENOMEM);
 
diff --git a/libavfilter/fifo.c b/libavfilter/fifo.c
index 88c44fe..0ff1578 100644
--- a/libavfilter/fifo.c
+++ b/libavfilter/fifo.c
@@ -169,8 +169,7 @@ static int return_audio_frame(AVFilterContext *ctx)
         int nb_channels = 
av_get_channel_layout_nb_channels(link->channel_layout);
 
         if (!s->buf_out) {
-            s->buf_out = ff_get_audio_buffer(link, AV_PERM_WRITE,
-                                             link->request_samples);
+            s->buf_out = ff_get_audio_buffer(link, link->request_samples);
             if (!s->buf_out)
                 return AVERROR(ENOMEM);
 
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 216a355..62eff72 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -44,32 +44,12 @@ struct AVFilterPad {
     enum AVMediaType type;
 
     /**
-     * Minimum required permissions on incoming buffers. Any buffer with
-     * insufficient permissions will be automatically copied by the filter
-     * system to a new buffer which provides the needed access permissions.
-     *
-     * Input pads only.
-     */
-    int min_perms;
-
-    /**
-     * Permissions which are not accepted on incoming buffers. Any buffer
-     * which has any of these permissions set will be automatically copied
-     * by the filter system to a new buffer which does not have those
-     * permissions. This can be used to easily disallow buffers with
-     * AV_PERM_REUSE.
-     *
-     * Input pads only.
-     */
-    int rej_perms;
-
-    /**
      * Callback function to get a video buffer. If NULL, the filter system will
      * use avfilter_default_get_video_buffer().
      *
      * Input video pads only.
      */
-    AVFilterBufferRef *(*get_video_buffer)(AVFilterLink *link, int perms, int 
w, int h);
+    AVFrame *(*get_video_buffer)(AVFilterLink *link, int w, int h);
 
     /**
      * Callback function to get an audio buffer. If NULL, the filter system 
will
@@ -77,8 +57,7 @@ struct AVFilterPad {
      *
      * Input audio pads only.
      */
-    AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms,
-                                           int nb_samples);
+    AVFrame *(*get_audio_buffer)(AVFilterLink *link, int nb_samples);
 
     /**
      * Filtering callback. This is where a filter receives a frame with
@@ -90,7 +69,7 @@ struct AVFilterPad {
      * must ensure that samplesref is properly unreferenced on error if it
      * hasn't been passed on to another filter.
      */
-    int (*filter_frame)(AVFilterLink *link, AVFilterBufferRef *frame);
+    int (*filter_frame)(AVFilterLink *link, AVFrame *frame);
 
     /**
      * Frame poll callback. This returns the number of immediately available
@@ -215,6 +194,6 @@ int ff_request_frame(AVFilterLink *link);
  * @return >= 0 on success, a negative AVERROR on error. The receiving filter
  * is responsible for unreferencing frame in case of error.
  */
-int ff_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame);
+int ff_filter_frame(AVFilterLink *link, AVFrame *frame);
 
 #endif /* AVFILTER_INTERNAL_H */
diff --git a/libavfilter/version.h b/libavfilter/version.h
index eb5326b..776cdfd 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -52,5 +52,8 @@
 #ifndef FF_API_FOO_COUNT
 #define FF_API_FOO_COUNT                    (LIBAVFILTER_VERSION_MAJOR < 4)
 #endif
+#ifndef FF_API_AVFILTERBUFFER
+#define FF_API_AVFILTERBUFFER               (LIBAVFILTER_VERSION_MAJOR < 4)
+#endif
 
 #endif /* AVFILTER_VERSION_H */
diff --git a/libavfilter/vf_boxblur.c b/libavfilter/vf_boxblur.c
index d72c602..21c73d5 100644
--- a/libavfilter/vf_boxblur.c
+++ b/libavfilter/vf_boxblur.c
@@ -318,7 +318,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *in)
     int w[4] = { inlink->w, cw, cw, inlink->w };
     int h[4] = { in->video->h, ch, ch, in->video->h };
 
-    out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+    out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out) {
         avfilter_unref_bufferp(&in);
         return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index 76848c3..ecc791b 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -230,7 +230,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *in)
         direct = 1;
         out = in;
     } else {
-        out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, 
outlink->h);
+        out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
         if (!out) {
             avfilter_unref_bufferp(&in);
             return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_fieldorder.c b/libavfilter/vf_fieldorder.c
index 5f0cc3b..887cd87 100644
--- a/libavfilter/vf_fieldorder.c
+++ b/libavfilter/vf_fieldorder.c
@@ -113,12 +113,12 @@ static int config_input(AVFilterLink *inlink)
     return 0;
 }
 
-static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, 
int w, int h)
+static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h)
 {
     AVFilterContext   *ctx        = inlink->dst;
     AVFilterLink      *outlink    = ctx->outputs[0];
 
-    return ff_get_video_buffer(outlink, perms, w, h);
+    return ff_get_video_buffer(outlink, w, h);
 }
 
 static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index fd05390..f50a9e4 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -352,7 +352,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *in)
     AVFilterLink *outlink = inlink->dst->outputs[0];
     AVFilterBufferRef *out;
 
-    out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+    out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out) {
         avfilter_unref_bufferp(&in);
         return AVERROR(ENOMEM);
@@ -454,7 +454,7 @@ static int source_config_props(AVFilterLink *outlink)
 static int source_request_frame(AVFilterLink *outlink)
 {
     Frei0rContext *frei0r = outlink->src->priv;
-    AVFilterBufferRef *picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, 
outlink->w, outlink->h);
+    AVFilterBufferRef *picref = ff_get_video_buffer(outlink, outlink->w, 
outlink->h);
 
     if (!picref)
         return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c
index 2c9a976..a06414f 100644
--- a/libavfilter/vf_gradfun.c
+++ b/libavfilter/vf_gradfun.c
@@ -193,7 +193,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *in)
         direct = 1;
         out = in;
     } else {
-        out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, 
outlink->h);
+        out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
         if (!out) {
             avfilter_unref_bufferp(&in);
             return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c
index 85a1d92..ec682c6 100644
--- a/libavfilter/vf_hflip.c
+++ b/libavfilter/vf_hflip.c
@@ -93,7 +93,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *in)
     uint8_t *inrow, *outrow;
     int i, j, plane, step, hsub, vsub;
 
-    out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+    out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out) {
         avfilter_unref_bufferp(&in);
         return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c
index 7365b8d..d3db3dd 100644
--- a/libavfilter/vf_hqdn3d.c
+++ b/libavfilter/vf_hqdn3d.c
@@ -333,7 +333,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *in)
         direct = 1;
         out = in;
     } else {
-        out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, 
outlink->h);
+        out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
         if (!out) {
             avfilter_unref_bufferp(&in);
             return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c
index e558a4a..f7a523e 100644
--- a/libavfilter/vf_libopencv.c
+++ b/libavfilter/vf_libopencv.c
@@ -359,7 +359,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *in)
     AVFilterBufferRef *out;
     IplImage inimg, outimg;
 
-    out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+    out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out) {
         avfilter_unref_bufferp(&in);
         return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index f265795..33df737 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -304,7 +304,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *in)
     uint8_t *inrow, *outrow, *inrow0, *outrow0;
     int i, j, k, plane;
 
-    out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+    out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out) {
         avfilter_unref_bufferp(&in);
         return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index f1a890e..c8a248e 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -253,11 +253,11 @@ static int config_output(AVFilterLink *outlink)
     return 0;
 }
 
-static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, 
int w, int h)
+static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int w, int h)
 {
     PadContext *pad = inlink->dst->priv;
 
-    AVFilterBufferRef *picref = ff_get_video_buffer(inlink->dst->outputs[0], 
perms,
+    AVFilterBufferRef *picref = ff_get_video_buffer(inlink->dst->outputs[0],
                                                     w + (pad->w - pad->in_w),
                                                     h + (pad->h - pad->in_h));
     int plane;
@@ -335,7 +335,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *in)
     if (needs_copy) {
         av_log(inlink->dst, AV_LOG_DEBUG, "Direct padding impossible 
allocating new frame\n");
         avfilter_unref_buffer(out);
-        out = ff_get_video_buffer(inlink->dst->outputs[0], AV_PERM_WRITE | 
AV_PERM_NEG_LINESIZES,
+        out = ff_get_video_buffer(inlink->dst->outputs[0],
                                   FFMAX(inlink->w, pad->w),
                                   FFMAX(inlink->h, pad->h));
         if (!out) {
diff --git a/libavfilter/vf_pixdesctest.c b/libavfilter/vf_pixdesctest.c
index a1e982c..d54752d 100644
--- a/libavfilter/vf_pixdesctest.c
+++ b/libavfilter/vf_pixdesctest.c
@@ -59,8 +59,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *in)
     AVFilterBufferRef *out;
     int i, c, w = inlink->w, h = inlink->h;
 
-    out = ff_get_video_buffer(outlink, AV_PERM_WRITE,
-                              outlink->w, outlink->h);
+    out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out) {
         avfilter_unref_bufferp(&in);
         return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 7f189a2..184cb21 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -270,7 +270,7 @@ static int filter_frame(AVFilterLink *link, 
AVFilterBufferRef *in)
     scale->hsub = desc->log2_chroma_w;
     scale->vsub = desc->log2_chroma_h;
 
-    out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+    out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out) {
         avfilter_unref_bufferp(&in);
         return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index d7a1739..81349f3 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -128,7 +128,7 @@ static int filter_frame(AVFilterLink *inlink, 
AVFilterBufferRef *in)
     AVFilterBufferRef *out;
     int plane;
 
-    out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+    out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out) {
         avfilter_unref_bufferp(&in);
         return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
index b446937..f41414e 100644
--- a/libavfilter/vf_unsharp.c
+++ b/libavfilter/vf_unsharp.c
@@ -222,7 +222,7 @@ static int filter_frame(AVFilterLink *link, 
AVFilterBufferRef *in)
     int cw = SHIFTUP(link->w, unsharp->hsub);
     int ch = SHIFTUP(link->h, unsharp->vsub);
 
-    out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+    out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out) {
         avfilter_unref_bufferp(&in);
         return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c
index 5e6e965..692e838 100644
--- a/libavfilter/vf_vflip.c
+++ b/libavfilter/vf_vflip.c
@@ -43,30 +43,26 @@ static int config_input(AVFilterLink *link)
     return 0;
 }
 
-static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms,
-                                        int w, int h)
+static AVFrame *get_video_buffer(AVFilterLink *link, int w, int h)
 {
     FlipContext *flip = link->dst->priv;
-    AVFilterBufferRef *picref;
+    AVFrame *frame;
     int i;
 
-    if (!(perms & AV_PERM_NEG_LINESIZES))
-        return ff_default_get_video_buffer(link, perms, w, h);
-
-    picref = ff_get_video_buffer(link->dst->outputs[0], perms, w, h);
-    if (!picref)
+    frame = ff_get_video_buffer(link->dst->outputs[0], w, h);
+    if (!frame)
         return NULL;
 
     for (i = 0; i < 4; i ++) {
         int vsub = i == 1 || i == 2 ? flip->vsub : 0;
 
-        if (picref->data[i]) {
-            picref->data[i] += ((h >> vsub)-1) * picref->linesize[i];
-            picref->linesize[i] = -picref->linesize[i];
+        if (frame->data[i]) {
+            frame->data[i] += ((h >> vsub) - 1) * frame->linesize[i];
+            frame->linesize[i] = -frame->linesize[i];
         }
     }
 
-    return picref;
+    return frame;
 }
 
 static int filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index db9c71c..e648556 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -145,23 +145,22 @@ static void filter(AVFilterContext *ctx, 
AVFilterBufferRef *dstpic,
     emms_c();
 }
 
-static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms,
-                                           int w, int h)
+static AVFrame *get_video_buffer(AVFilterLink *link, int w, int h)
 {
-    AVFilterBufferRef *picref;
+    AVFrame *frame;
     int width  = FFALIGN(w, 32);
     int height = FFALIGN(h + 2, 32);
     int i;
 
-    picref = ff_default_get_video_buffer(link, perms, width, height);
+    frame = ff_default_get_video_buffer(link, width, height);
 
-    picref->video->w = w;
-    picref->video->h = h;
+    frame->width  = w;
+    frame->height = h;
 
     for (i = 0; i < 3; i++)
-        picref->data[i] += picref->linesize[i];
+        frame->data[i] += frame->linesize[i];
 
-    return picref;
+    return frame;
 }
 
 static int return_frame(AVFilterContext *ctx, int is_second)
@@ -178,7 +177,7 @@ static int return_frame(AVFilterContext *ctx, int is_second)
     }
 
     if (is_second) {
-        yadif->out = ff_get_video_buffer(link, PERM_RWP, link->w, link->h);
+        yadif->out = ff_get_video_buffer(link, link->w, link->h);
         if (!yadif->out)
             return AVERROR(ENOMEM);
 
@@ -241,8 +240,7 @@ static int filter_frame(AVFilterLink *link, 
AVFilterBufferRef *picref)
         !(yadif->prev = avfilter_ref_buffer(yadif->cur, AV_PERM_READ)))
         return AVERROR(ENOMEM);
 
-    yadif->out = ff_get_video_buffer(ctx->outputs[0], PERM_RWP,
-                                     link->w, link->h);
+    yadif->out = ff_get_video_buffer(ctx->outputs[0], link->w, link->h);
     if (!yadif->out)
         return AVERROR(ENOMEM);
 
diff --git a/libavfilter/video.c b/libavfilter/video.c
index cb68ca4..577d483 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -19,6 +19,7 @@
 #include <string.h>
 #include <stdio.h>
 
+#include "libavutil/buffer.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/mem.h"
 
@@ -26,77 +27,43 @@
 #include "internal.h"
 #include "video.h"
 
-#ifdef DEBUG
-static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
+AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
 {
-    snprintf(buf, buf_size, "%s%s%s%s%s%s",
-             perms & AV_PERM_READ      ? "r" : "",
-             perms & AV_PERM_WRITE     ? "w" : "",
-             perms & AV_PERM_PRESERVE  ? "p" : "",
-             perms & AV_PERM_REUSE     ? "u" : "",
-             perms & AV_PERM_REUSE2    ? "U" : "",
-             perms & AV_PERM_NEG_LINESIZES ? "n" : "");
-    return buf;
-}
-#endif
-
-static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
-{
-    av_unused char buf[16];
-    av_dlog(ctx,
-            "ref[%p buf:%p refcount:%d perms:%s data:%p linesize[%d, %d, %d, 
%d] pts:%"PRId64" pos:%"PRId64,
-            ref, ref->buf, ref->buf->refcount, ff_get_ref_perms_string(buf, 
sizeof(buf), ref->perms), ref->data[0],
-            ref->linesize[0], ref->linesize[1], ref->linesize[2], 
ref->linesize[3],
-            ref->pts, ref->pos);
-
-    if (ref->video) {
-        av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
-                ref->video->pixel_aspect.num, ref->video->pixel_aspect.den,
-                ref->video->w, ref->video->h,
-                !ref->video->interlaced     ? 'P' :         /* Progressive  */
-                ref->video->top_field_first ? 'T' : 'B',    /* Top / Bottom */
-                ref->video->key_frame,
-                av_get_picture_type_char(ref->video->pict_type));
-    }
-    if (ref->audio) {
-        av_dlog(ctx, " cl:%"PRId64"d n:%d r:%d p:%d",
-                ref->audio->channel_layout,
-                ref->audio->nb_samples,
-                ref->audio->sample_rate,
-                ref->audio->planar);
-    }
-
-    av_dlog(ctx, "]%s", end ? "\n" : "");
-}
-
-AVFilterBufferRef *ff_null_get_video_buffer(AVFilterLink *link, int perms, int 
w, int h)
-{
-    return ff_get_video_buffer(link->dst->outputs[0], perms, w, h);
+    return ff_get_video_buffer(link->dst->outputs[0], w, h);
 }
 
 /* TODO: set the buffer's priv member to a context structure for the whole
  * filter chain.  This will allow for a buffer pool instead of the constant
  * alloc & free cycle currently implemented. */
-AVFilterBufferRef *ff_default_get_video_buffer(AVFilterLink *link, int perms, 
int w, int h)
+AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
 {
-    int linesize[4];
-    uint8_t *data[4];
-    AVFilterBufferRef *picref = NULL;
+    AVFrame *frame = av_frame_alloc();
+    int size;
 
-    // +2 is needed for swscaler, +16 to be SIMD-friendly
-    if (av_image_alloc(data, linesize, w, h, link->format, 16) < 0)
+    if (!frame)
         return NULL;
 
-    picref = avfilter_get_video_buffer_ref_from_arrays(data, linesize,
-                                                       perms, w, h, 
link->format);
-    if (!picref) {
-        av_free(data[0]);
-        return NULL;
-    }
+    size = av_image_alloc(frame->data, frame->linesize, w, h, link->format, 
16);
+    if (size < 0)
+        goto fail;
 
-    return picref;
+    frame->buf[0] = av_buffer_create(frame->data[0], size,
+                                     av_buffer_default_free, NULL);
+    if (!frame->buf[0])
+        goto fail;
+
+    frame->width  = w;
+    frame->height = h;
+    frame->format = link->format;
+
+    return frame;
+fail:
+    av_freep(&frame->data[0]);
+    av_frame_free(&frame);
+    return NULL;
 }
 
+#if FF_API_AVFILTERBUFFER
 AVFilterBufferRef *
 avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], 
int perms,
                                           int w, int h, enum AVPixelFormat 
format)
@@ -141,25 +108,20 @@ fail:
     av_free(pic);
     return NULL;
 }
+#endif
 
-AVFilterBufferRef *ff_get_video_buffer(AVFilterLink *link, int perms, int w, 
int h)
+AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h)
 {
-    AVFilterBufferRef *ret = NULL;
+    AVFrame *ret = NULL;
 
     av_unused char buf[16];
     FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0);
-    av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, 
sizeof(buf), perms), w, h);
 
     if (link->dstpad->get_video_buffer)
-        ret = link->dstpad->get_video_buffer(link, perms, w, h);
+        ret = link->dstpad->get_video_buffer(link, w, h);
 
     if (!ret)
-        ret = ff_default_get_video_buffer(link, perms, w, h);
-
-    if (ret)
-        ret->type = AVMEDIA_TYPE_VIDEO;
-
-    FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); 
av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1);
+        ret = ff_default_get_video_buffer(link, w, h);
 
     return ret;
 }
diff --git a/libavfilter/video.h b/libavfilter/video.h
index be93810..f7e8e34 100644
--- a/libavfilter/video.h
+++ b/libavfilter/video.h
@@ -21,22 +21,19 @@
 
 #include "avfilter.h"
 
-AVFilterBufferRef *ff_default_get_video_buffer(AVFilterLink *link,
-                                               int perms, int w, int h);
-AVFilterBufferRef *ff_null_get_video_buffer(AVFilterLink *link, int perms, int 
w, int h);
+AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h);
+AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h);
 
 /**
  * Request a picture buffer with a specific set of permissions.
  *
  * @param link  the output link to the filter from which the buffer will
  *              be requested
- * @param perms the required access permissions
  * @param w     the minimum width of the buffer to allocate
  * @param h     the minimum height of the buffer to allocate
  * @return      A reference to the buffer. This must be unreferenced with
  *              avfilter_unref_buffer when you are finished with it.
  */
-AVFilterBufferRef *ff_get_video_buffer(AVFilterLink *link, int perms,
-                                       int w, int h);
+AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h);
 
 #endif /* AVFILTER_VIDEO_H */
diff --git a/libavfilter/vsrc_color.c b/libavfilter/vsrc_color.c
index c0a4e1c..2ccfbeb 100644
--- a/libavfilter/vsrc_color.c
+++ b/libavfilter/vsrc_color.c
@@ -146,7 +146,7 @@ static int color_config_props(AVFilterLink *inlink)
 static int color_request_frame(AVFilterLink *link)
 {
     ColorContext *color = link->src->priv;
-    AVFilterBufferRef *picref = ff_get_video_buffer(link, AV_PERM_WRITE, 
color->w, color->h);
+    AVFilterBufferRef *picref = ff_get_video_buffer(link, color->w, color->h);
 
     if (!picref)
         return AVERROR(ENOMEM);
diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c
index e6185d6..2d5fcef 100644
--- a/libavfilter/vsrc_movie.c
+++ b/libavfilter/vsrc_movie.c
@@ -238,8 +238,7 @@ static int movie_get_frame(AVFilterLink *outlink)
 
             if (frame_decoded) {
                 /* FIXME: avoid the memcpy */
-                movie->picref = ff_get_video_buffer(outlink, AV_PERM_WRITE | 
AV_PERM_PRESERVE |
-                                                    AV_PERM_REUSE2, 
outlink->w, outlink->h);
+                movie->picref = ff_get_video_buffer(outlink, outlink->w, 
outlink->h);
                 av_image_copy(movie->picref->data, movie->picref->linesize,
                               movie->frame->data,  movie->frame->linesize,
                               movie->picref->format, outlink->w, outlink->h);
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 632bd27..23b2d95 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -134,7 +134,7 @@ static int request_frame(AVFilterLink *outlink)
 
     if (test->max_pts >= 0 && test->pts > test->max_pts)
         return AVERROR_EOF;
-    picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, test->w, test->h);
+    picref = ff_get_video_buffer(outlink, test->w, test->h);
     if (!picref)
         return AVERROR(ENOMEM);
 
-- 
1.7.10.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to