diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-07-28 14:30:21 +0100 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-08-28 16:01:16 +0200 |
commit | f6974fe651d29ef6eb68d66d73f7b6c011062aa0 (patch) | |
tree | 37a9f0b2d74680e99ac1d3ad3abe8f5b860d36b9 /libavfilter/buffersrc.c | |
parent | e65e4cbbda03ca3c9087f069c9867d518415fca1 (diff) | |
download | ffmpeg-f6974fe651d29ef6eb68d66d73f7b6c011062aa0.tar.gz |
lavfi: Drop deprecated AVFilterBuffer* code
Deprecated in 11/2012.
Diffstat (limited to 'libavfilter/buffersrc.c')
-rw-r--r-- | libavfilter/buffersrc.c | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 8f7032f993..651f2ec4e8 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -145,114 +145,6 @@ int attribute_align_arg av_buffersrc_add_frame(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; - avfilter_unref_buffer(buf); -} - -static void compat_unref_buffer(void *opaque, uint8_t *data) -{ - AVBufferRef *buf = opaque; - av_buffer_unref(&buf); -} - -int av_buffersrc_buffer(AVFilterContext *ctx, AVFilterBufferRef *buf) -{ - 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, 0); - if (!dummy_buf) { - ret = AVERROR(ENOMEM); - goto fail; - } - - 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, 0); \ - 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(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(ctx, frame); - -fail: - av_buffer_unref(&dummy_buf); - av_frame_free(&frame); - - return ret; -} -FF_ENABLE_DEPRECATION_WARNINGS -#endif - static av_cold int init_video(AVFilterContext *ctx) { BufferSourceContext *c = ctx->priv; |