summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-07-28 14:30:24 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-08-28 16:01:16 +0200
commit9f90b24877016e7140b9b14e4b1acee663bb6d8a (patch)
tree0f9ff174759bb67a12a749a27705ac10151cf8b6 /libavcodec
parent01bcc2d5c23fa757d163530abb396fd02f1be7c8 (diff)
downloadffmpeg-9f90b24877016e7140b9b14e4b1acee663bb6d8a.tar.gz
lavc: Drop deprecated get_buffer related functions
Deprecated in 11/2012.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h114
-rw-r--r--libavcodec/pthread_frame.c32
-rw-r--r--libavcodec/utils.c164
-rw-r--r--libavcodec/version.h3
4 files changed, 5 insertions, 308 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1d18c36e0b..8390bdaff6 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1039,18 +1039,6 @@ typedef struct AVPanScan{
#define FF_QSCALE_TYPE_VP56 3
#endif
-#if FF_API_GET_BUFFER
-#define FF_BUFFER_TYPE_INTERNAL 1
-#define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user)
-#define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
-#define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
-
-#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore).
-#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
-#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
-#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
-#endif
-
/**
* The decoder will keep a reference to the frame and may reuse it later.
*/
@@ -2086,102 +2074,6 @@ typedef struct AVCodecContext {
*/
enum AVSampleFormat request_sample_fmt;
-#if FF_API_GET_BUFFER
- /**
- * Called at the beginning of each frame to get a buffer for it.
- *
- * The function will set AVFrame.data[], AVFrame.linesize[].
- * AVFrame.extended_data[] must also be set, but it should be the same as
- * AVFrame.data[] except for planar audio with more channels than can fit
- * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as
- * many data pointers as it can hold.
- *
- * if CODEC_CAP_DR1 is not set then get_buffer() must call
- * avcodec_default_get_buffer() instead of providing buffers allocated by
- * some other means.
- *
- * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't
- * need it. avcodec_default_get_buffer() aligns the output buffer properly,
- * but if get_buffer() is overridden then alignment considerations should
- * be taken into account.
- *
- * @see avcodec_default_get_buffer()
- *
- * Video:
- *
- * If pic.reference is set then the frame will be read later by libavcodec.
- * avcodec_align_dimensions2() should be used to find the required width and
- * height, as they normally need to be rounded up to the next multiple of 16.
- *
- * If frame multithreading is used and thread_safe_callbacks is set,
- * it may be called from a different thread, but not from more than one at
- * once. Does not need to be reentrant.
- *
- * @see release_buffer(), reget_buffer()
- * @see avcodec_align_dimensions2()
- *
- * Audio:
- *
- * Decoders request a buffer of a particular size by setting
- * AVFrame.nb_samples prior to calling get_buffer(). The decoder may,
- * however, utilize only part of the buffer by setting AVFrame.nb_samples
- * to a smaller value in the output frame.
- *
- * Decoders cannot use the buffer after returning from
- * avcodec_decode_audio4(), so they will not call release_buffer(), as it
- * is assumed to be released immediately upon return. In some rare cases,
- * a decoder may need to call get_buffer() more than once in a single
- * call to avcodec_decode_audio4(). In that case, when get_buffer() is
- * called again after it has already been called once, the previously
- * acquired buffer is assumed to be released at that time and may not be
- * reused by the decoder.
- *
- * As a convenience, av_samples_get_buffer_size() and
- * av_samples_fill_arrays() in libavutil may be used by custom get_buffer()
- * functions to find the required data size and to fill data pointers and
- * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
- * since all planes must be the same size.
- *
- * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
- *
- * - encoding: unused
- * - decoding: Set by libavcodec, user can override.
- *
- * @deprecated use get_buffer2()
- */
- attribute_deprecated
- int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
-
- /**
- * Called to release buffers which were allocated with get_buffer.
- * A released buffer can be reused in get_buffer().
- * pic.data[*] must be set to NULL.
- * May be called from a different thread if frame multithreading is used,
- * but not by more than one thread at once, so does not need to be reentrant.
- * - encoding: unused
- * - decoding: Set by libavcodec, user can override.
- *
- * @deprecated custom freeing callbacks should be set from get_buffer2()
- */
- attribute_deprecated
- void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
-
- /**
- * Called at the beginning of a frame to get cr buffer for it.
- * Buffer type (size, hints) must be the same. libavcodec won't check it.
- * libavcodec will pass previous buffer in pic, function should return
- * same buffer or new buffer with old frame "painted" into it.
- * If pic.data[0] == NULL must behave like get_buffer().
- * if CODEC_CAP_DR1 is not set then reget_buffer() must call
- * avcodec_default_reget_buffer() instead of providing buffers allocated by
- * some other means.
- * - encoding: unused
- * - decoding: Set by libavcodec, user can override.
- */
- attribute_deprecated
- int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
-#endif
-
/**
* This callback is called at the beginning of each frame to get data
* buffer(s) for it. There may be one contiguous buffer for all the data or
@@ -3766,12 +3658,6 @@ AVCodec *avcodec_find_decoder(enum AVCodecID id);
*/
AVCodec *avcodec_find_decoder_by_name(const char *name);
-#if FF_API_GET_BUFFER
-attribute_deprecated int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
-attribute_deprecated void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
-attribute_deprecated int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
-#endif
-
/**
* The default callback for AVCodecContext.get_buffer2(). It is made public so
* it can be called by custom get_buffer2() implementations for decoders without
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 64b8aa552f..c72da533aa 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -242,12 +242,6 @@ static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
dst->draw_horiz_band= src->draw_horiz_band;
dst->get_buffer2 = src->get_buffer2;
-#if FF_API_GET_BUFFER
-FF_DISABLE_DEPRECATION_WARNINGS
- dst->get_buffer = src->get_buffer;
- dst->release_buffer = src->release_buffer;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
dst->opaque = src->opaque;
dst->debug = src->debug;
@@ -340,13 +334,8 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
* and it calls back to the client here.
*/
-FF_DISABLE_DEPRECATION_WARNINGS
- if (!p->avctx->thread_safe_callbacks && (
-#if FF_API_GET_BUFFER
- p->avctx->get_buffer ||
-#endif
- p->avctx->get_buffer2 != avcodec_default_get_buffer2)) {
-FF_ENABLE_DEPRECATION_WARNINGS
+ if (!p->avctx->thread_safe_callbacks &&
+ p->avctx->get_buffer2 != avcodec_default_get_buffer2) {
while (p->state != STATE_SETUP_FINISHED && p->state != STATE_INPUT_READY) {
pthread_mutex_lock(&p->progress_mutex);
while (p->state == STATE_SETTING_UP)
@@ -728,13 +717,8 @@ int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
}
pthread_mutex_lock(&p->parent->buffer_mutex);
-FF_DISABLE_DEPRECATION_WARNINGS
- if (avctx->thread_safe_callbacks || (
-#if FF_API_GET_BUFFER
- !avctx->get_buffer &&
-#endif
- avctx->get_buffer2 == avcodec_default_get_buffer2)) {
-FF_ENABLE_DEPRECATION_WARNINGS
+ if (avctx->thread_safe_callbacks ||
+ avctx->get_buffer2 == avcodec_default_get_buffer2) {
err = ff_get_buffer(avctx, f->f, flags);
} else {
p->requested_frame = f->f;
@@ -767,15 +751,9 @@ void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
PerThreadContext *p = avctx->internal->thread_ctx;
FrameThreadContext *fctx;
AVFrame *dst, *tmp;
-FF_DISABLE_DEPRECATION_WARNINGS
int can_direct_free = !(avctx->active_thread_type & FF_THREAD_FRAME) ||
avctx->thread_safe_callbacks ||
- (
-#if FF_API_GET_BUFFER
- !avctx->get_buffer &&
-#endif
- avctx->get_buffer2 == avcodec_default_get_buffer2);
-FF_ENABLE_DEPRECATION_WARNINGS
+ avctx->get_buffer2 == avcodec_default_get_buffer2;
if (!f->f || !f->f->buf[0])
return;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 6779e1a544..c5f60dc407 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -514,12 +514,6 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags
if ((ret = update_frame_pool(avctx, frame)) < 0)
return ret;
-#if FF_API_GET_BUFFER
-FF_DISABLE_DEPRECATION_WARNINGS
- frame->type = FF_BUFFER_TYPE_INTERNAL;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
switch (avctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:
return video_get_buffer(avctx, frame);
@@ -530,34 +524,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
}
-#if FF_API_GET_BUFFER
-FF_DISABLE_DEPRECATION_WARNINGS
-int avcodec_default_get_buffer(AVCodecContext *avctx, AVFrame *frame)
-{
- return avcodec_default_get_buffer2(avctx, frame, 0);
-}
-
-typedef struct CompatReleaseBufPriv {
- AVCodecContext avctx;
- AVFrame frame;
-} CompatReleaseBufPriv;
-
-static void compat_free_buffer(void *opaque, uint8_t *data)
-{
- CompatReleaseBufPriv *priv = opaque;
- if (priv->avctx.release_buffer)
- priv->avctx.release_buffer(&priv->avctx, &priv->frame);
- av_freep(&priv);
-}
-
-static void compat_release_buffer(void *opaque, uint8_t *data)
-{
- AVBufferRef *buf = opaque;
- av_buffer_unref(&buf);
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
{
AVPacket *pkt = avctx->internal->pkt;
@@ -675,123 +641,6 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
} else
avctx->sw_pix_fmt = avctx->pix_fmt;
-#if FF_API_GET_BUFFER
-FF_DISABLE_DEPRECATION_WARNINGS
- /*
- * Wrap an old get_buffer()-allocated buffer in an bunch of AVBuffers.
- * We wrap each plane in its own AVBuffer. Each of those has a reference to
- * a dummy AVBuffer as its private data, unreffing it on free.
- * When all the planes are freed, the dummy buffer's free callback calls
- * release_buffer().
- */
- if (avctx->get_buffer) {
- CompatReleaseBufPriv *priv = NULL;
- AVBufferRef *dummy_buf = NULL;
- int planes, i, ret;
-
- if (flags & AV_GET_BUFFER_FLAG_REF)
- frame->reference = 1;
-
- ret = avctx->get_buffer(avctx, frame);
- if (ret < 0)
- return ret;
-
- /* return if the buffers are already set up
- * this would happen e.g. when a custom get_buffer() calls
- * avcodec_default_get_buffer
- */
- if (frame->buf[0])
- return 0;
-
- priv = av_mallocz(sizeof(*priv));
- if (!priv) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- priv->avctx = *avctx;
- priv->frame = *frame;
-
- dummy_buf = av_buffer_create(NULL, 0, compat_free_buffer, priv, 0);
- if (!dummy_buf) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
-
-#define WRAP_PLANE(ref_out, data, data_size) \
-do { \
- AVBufferRef *dummy_ref = av_buffer_ref(dummy_buf); \
- if (!dummy_ref) { \
- ret = AVERROR(ENOMEM); \
- goto fail; \
- } \
- ref_out = av_buffer_create(data, data_size, compat_release_buffer, \
- dummy_ref, 0); \
- if (!ref_out) { \
- av_buffer_unref(&dummy_ref); \
- av_frame_unref(frame); \
- ret = AVERROR(ENOMEM); \
- goto fail; \
- } \
-} while (0)
-
- if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
-
- planes = av_pix_fmt_count_planes(frame->format);
- /* workaround for AVHWAccel plane count of 0, buf[0] is used as
- check for allocated buffers: make libavcodec happy */
- if (desc && desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
- planes = 1;
- if (!desc || planes <= 0) {
- ret = AVERROR(EINVAL);
- goto fail;
- }
-
- for (i = 0; i < planes; i++) {
- int v_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
- int plane_size = (frame->height >> v_shift) * frame->linesize[i];
-
- WRAP_PLANE(frame->buf[i], frame->data[i], plane_size);
- }
- } else {
- int planar = av_sample_fmt_is_planar(frame->format);
- planes = planar ? avctx->channels : 1;
-
- if (planes > FF_ARRAY_ELEMS(frame->buf)) {
- frame->nb_extended_buf = planes - FF_ARRAY_ELEMS(frame->buf);
- frame->extended_buf = av_malloc(sizeof(*frame->extended_buf) *
- frame->nb_extended_buf);
- if (!frame->extended_buf) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- }
-
- for (i = 0; i < FFMIN(planes, FF_ARRAY_ELEMS(frame->buf)); i++)
- WRAP_PLANE(frame->buf[i], frame->extended_data[i], frame->linesize[0]);
-
- for (i = 0; i < frame->nb_extended_buf; i++)
- WRAP_PLANE(frame->extended_buf[i],
- frame->extended_data[i + FF_ARRAY_ELEMS(frame->buf)],
- frame->linesize[0]);
- }
-
- av_buffer_unref(&dummy_buf);
-
- frame->width = avctx->width;
- frame->height = avctx->height;
-
- return 0;
-
-fail:
- avctx->release_buffer(avctx, frame);
- av_freep(&priv);
- av_buffer_unref(&dummy_buf);
- return ret;
- }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
ret = avctx->get_buffer2(avctx, frame, flags);
end:
@@ -834,19 +683,6 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
return 0;
}
-#if FF_API_GET_BUFFER
-void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)
-{
- av_frame_unref(pic);
-}
-
-int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic)
-{
- av_assert0(0);
- return AVERROR_BUG;
-}
-#endif
-
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
{
int i;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 14a354d36e..2d26d4f19e 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -51,9 +51,6 @@
#ifndef FF_API_DEINTERLACE
#define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 57)
#endif
-#ifndef FF_API_GET_BUFFER
-#define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 57)
-#endif
#ifndef FF_API_MISSING_SAMPLE
#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 57)
#endif