diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-09-05 16:22:03 +0200 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-09-05 16:22:03 +0200 |
commit | 033764e015e33b9ce9583317092337367b3fea2b (patch) | |
tree | 50184fa2019695d048931943373bce81bbd41ac5 /libavfilter/buffersrc.c | |
parent | 43e2e172dfbd734947c30bdbfa8f19b7ca95576d (diff) | |
parent | f6974fe651d29ef6eb68d66d73f7b6c011062aa0 (diff) | |
download | ffmpeg-033764e015e33b9ce9583317092337367b3fea2b.tar.gz |
Merge commit 'f6974fe651d29ef6eb68d66d73f7b6c011062aa0'
* commit 'f6974fe651d29ef6eb68d66d73f7b6c011062aa0':
lavfi: Drop deprecated AVFilterBuffer* code
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavfilter/buffersrc.c')
-rw-r--r-- | libavfilter/buffersrc.c | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index bf77b88fec..36cf763dc2 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -184,127 +184,6 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx, return 0; } -#if FF_API_AVFILTERBUFFER -FF_DISABLE_DEPRECATION_WARNINGS -static void compat_free_buffer(void *opaque, uint8_t *data) -{ - AVFilterBufferRef *buf = opaque; - AV_NOWARN_DEPRECATED( - avfilter_unref_buffer(buf); - ) -} - -static void compat_unref_buffer(void *opaque, uint8_t *data) -{ - AVBufferRef *buf = opaque; - AV_NOWARN_DEPRECATED( - av_buffer_unref(&buf); - ) -} - -int av_buffersrc_add_ref(AVFilterContext *ctx, AVFilterBufferRef *buf, - int flags) -{ - BufferSourceContext *s = ctx->priv; - AVFrame *frame = NULL; - AVBufferRef *dummy_buf = NULL; - int ret = 0, planes, i; - - if (!buf) { - s->eof = 1; - return 0; - } else if (s->eof) - return AVERROR(EINVAL); - - frame = av_frame_alloc(); - if (!frame) - return AVERROR(ENOMEM); - - dummy_buf = av_buffer_create(NULL, 0, compat_free_buffer, buf, - (buf->perms & AV_PERM_WRITE) ? 0 : AV_BUFFER_FLAG_READONLY); - if (!dummy_buf) { - ret = AVERROR(ENOMEM); - goto fail; - } - - AV_NOWARN_DEPRECATED( - if ((ret = avfilter_copy_buf_props(frame, buf)) < 0) - 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_unref_buffer, \ - dummy_ref, (buf->perms & AV_PERM_WRITE) ? 0 : AV_BUFFER_FLAG_READONLY); \ - if (!ref_out) { \ - av_buffer_unref(&dummy_ref); \ - av_frame_unref(frame); \ - ret = AVERROR(ENOMEM); \ - goto fail; \ - } \ -} while (0) - - if (ctx->outputs[0]->type == AVMEDIA_TYPE_VIDEO) { - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); - - planes = av_pix_fmt_count_planes(frame->format); - 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); - int channels = av_get_channel_layout_nb_channels(frame->channel_layout); - - planes = planar ? channels : 1; - - if (planes > FF_ARRAY_ELEMS(frame->buf)) { - frame->nb_extended_buf = planes - FF_ARRAY_ELEMS(frame->buf); - frame->extended_buf = av_mallocz_array(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 < planes - FF_ARRAY_ELEMS(frame->buf); i++) - WRAP_PLANE(frame->extended_buf[i], - frame->extended_data[i + FF_ARRAY_ELEMS(frame->buf)], - frame->linesize[0]); - } - - ret = av_buffersrc_add_frame_flags(ctx, frame, flags); - -fail: - av_buffer_unref(&dummy_buf); - av_frame_free(&frame); - - return ret; -} -FF_ENABLE_DEPRECATION_WARNINGS - -int av_buffersrc_buffer(AVFilterContext *ctx, AVFilterBufferRef *buf) -{ - return av_buffersrc_add_ref(ctx, buf, 0); -} -#endif - static av_cold int init_video(AVFilterContext *ctx) { BufferSourceContext *c = ctx->priv; |