From 6d58358a3a3274e84a4e34a348165fbb3f484587 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 30 May 2012 10:31:48 +0200 Subject: [PATCH] lavfi: make avfilter_get_video_buffer() private on next bump. They are only useful inside filters and we don't allow user filters for now. --- libavfilter/avfilter.h | 14 +++----------- libavfilter/buffersrc.c | 4 ++-- libavfilter/vf_delogo.c | 4 ++-- libavfilter/vf_fieldorder.c | 2 +- libavfilter/vf_frei0r.c | 2 +- libavfilter/vf_gradfun.c | 2 +- libavfilter/vf_overlay.c | 2 +- libavfilter/vf_pad.c | 12 ++++++------ libavfilter/vf_pixdesctest.c | 4 ++-- libavfilter/vf_scale.c | 2 +- libavfilter/vf_transpose.c | 4 ++-- libavfilter/vf_vflip.c | 2 +- libavfilter/vf_yadif.c | 8 ++++---- libavfilter/video.c | 12 ++++++++---- libavfilter/video.h | 14 ++++++++++++++ libavfilter/vsrc_color.c | 2 +- libavfilter/vsrc_movie.c | 4 ++-- libavfilter/vsrc_testsrc.c | 3 +-- 18 files changed, 53 insertions(+), 44 deletions(-) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index c592372..7fbc160 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -573,19 +573,11 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, */ int avfilter_config_links(AVFilterContext *filter); -/** - * 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. - */ +#if FF_API_FILTERS_PUBLIC +attribute_deprecated AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h); +#endif /** * Create a buffer reference wrapped around an already allocated image diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 7af9f6c..3ffab60 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -109,8 +109,8 @@ int av_buffersrc_write_frame(AVFilterContext *buffer_filter, AVFrame *frame) case AVMEDIA_TYPE_VIDEO: CHECK_VIDEO_PARAM_CHANGE(buffer_filter, c, frame->width, frame->height, frame->format); - buf = avfilter_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE, - c->w, c->h); + buf = ff_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE, + c->w, c->h); av_image_copy(buf->data, buf->linesize, frame->data, frame->linesize, c->pix_fmt, c->w, c->h); break; diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c index 6fe4730..70aa12a 100644 --- a/libavfilter/vf_delogo.c +++ b/libavfilter/vf_delogo.c @@ -219,8 +219,8 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) AVFilterBufferRef *outpicref; if (inpicref->perms & AV_PERM_PRESERVE) { - outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, - outlink->w, outlink->h); + outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE, + outlink->w, outlink->h); avfilter_copy_buffer_ref_props(outpicref, inpicref); outpicref->video->w = outlink->w; outpicref->video->h = outlink->h; diff --git a/libavfilter/vf_fieldorder.c b/libavfilter/vf_fieldorder.c index ff1e332..67a6958 100644 --- a/libavfilter/vf_fieldorder.c +++ b/libavfilter/vf_fieldorder.c @@ -112,7 +112,7 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, int AVFilterContext *ctx = inlink->dst; AVFilterLink *outlink = ctx->outputs[0]; - return avfilter_get_video_buffer(outlink, perms, w, h); + return ff_get_video_buffer(outlink, perms, w, h); } static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c index 85b4205..2a72fcc 100644 --- a/libavfilter/vf_frei0r.c +++ b/libavfilter/vf_frei0r.c @@ -432,7 +432,7 @@ static int source_config_props(AVFilterLink *outlink) static int source_request_frame(AVFilterLink *outlink) { Frei0rContext *frei0r = outlink->src->priv; - AVFilterBufferRef *picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); + AVFilterBufferRef *picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); picref->video->pixel_aspect = (AVRational) {1, 1}; picref->pts = frei0r->pts++; picref->pos = -1; diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c index 7fde16d..88872b3 100644 --- a/libavfilter/vf_gradfun.c +++ b/libavfilter/vf_gradfun.c @@ -190,7 +190,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) AVFilterBufferRef *outpicref; if (inpicref->perms & AV_PERM_PRESERVE) { - outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); + outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); avfilter_copy_buffer_ref_props(outpicref, inpicref); outpicref->video->w = outlink->w; outpicref->video->h = outlink->h; diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index 55f1cc3..ff7c348 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -205,7 +205,7 @@ static int config_output(AVFilterLink *outlink) static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, int w, int h) { - return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h); + return ff_get_video_buffer(link->dst->outputs[0], perms, w, h); } static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index 2e98aea..11c59b9 100644 --- a/libavfilter/vf_pad.c +++ b/libavfilter/vf_pad.c @@ -256,9 +256,9 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, int { PadContext *pad = inlink->dst->priv; - AVFilterBufferRef *picref = avfilter_get_video_buffer(inlink->dst->outputs[0], perms, - w + (pad->w - pad->in_w), - h + (pad->h - pad->in_h)); + AVFilterBufferRef *picref = ff_get_video_buffer(inlink->dst->outputs[0], perms, + w + (pad->w - pad->in_w), + h + (pad->h - pad->in_h)); int plane; picref->video->w = w; @@ -327,9 +327,9 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) if(pad->needs_copy){ av_log(inlink->dst, AV_LOG_DEBUG, "Direct padding impossible allocating new frame\n"); avfilter_unref_buffer(outpicref); - outpicref = avfilter_get_video_buffer(inlink->dst->outputs[0], AV_PERM_WRITE | AV_PERM_NEG_LINESIZES, - FFMAX(inlink->w, pad->w), - FFMAX(inlink->h, pad->h)); + outpicref = ff_get_video_buffer(inlink->dst->outputs[0], AV_PERM_WRITE | AV_PERM_NEG_LINESIZES, + FFMAX(inlink->w, pad->w), + FFMAX(inlink->h, pad->h)); avfilter_copy_buffer_ref_props(outpicref, inpicref); } diff --git a/libavfilter/vf_pixdesctest.c b/libavfilter/vf_pixdesctest.c index 7eecdc0..353c57b 100644 --- a/libavfilter/vf_pixdesctest.c +++ b/libavfilter/vf_pixdesctest.c @@ -57,8 +57,8 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) AVFilterBufferRef *outpicref; int i; - outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, - outlink->w, outlink->h); + outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, + outlink->w, outlink->h); outpicref = outlink->out_buf; avfilter_copy_buffer_ref_props(outpicref, picref); diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 6f33848..68ff845 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -265,7 +265,7 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) scale->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w; scale->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; - outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); + outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); avfilter_copy_buffer_ref_props(outpicref, picref); outpicref->video->w = outlink->w; outpicref->video->h = outlink->h; diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c index 5e5feda..aa5c015 100644 --- a/libavfilter/vf_transpose.c +++ b/libavfilter/vf_transpose.c @@ -120,8 +120,8 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) { AVFilterLink *outlink = inlink->dst->outputs[0]; - outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, - outlink->w, outlink->h); + outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, + outlink->w, outlink->h); outlink->out_buf->pts = picref->pts; if (picref->video->pixel_aspect.num == 0) { diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c index 6d2f42e..bece2b2 100644 --- a/libavfilter/vf_vflip.c +++ b/libavfilter/vf_vflip.c @@ -50,7 +50,7 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, if (!(perms & AV_PERM_NEG_LINESIZES)) return ff_default_get_video_buffer(link, perms, w, h); - picref = avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h); + picref = ff_get_video_buffer(link->dst->outputs[0], perms, w, h); for (i = 0; i < 4; i ++) { int vsub = i == 1 || i == 2 ? flip->vsub : 0; diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index b498ab9..baf8b7a 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -208,8 +208,8 @@ static void return_frame(AVFilterContext *ctx, int is_second) } if (is_second) { - yadif->out = avfilter_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE | - AV_PERM_REUSE, link->w, link->h); + yadif->out = ff_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE | + AV_PERM_REUSE, link->w, link->h); avfilter_copy_buffer_ref_props(yadif->out, yadif->cur); yadif->out->video->interlaced = 0; } @@ -268,8 +268,8 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) if (!yadif->prev) yadif->prev = avfilter_ref_buffer(yadif->cur, AV_PERM_READ); - yadif->out = avfilter_get_video_buffer(ctx->outputs[0], AV_PERM_WRITE | AV_PERM_PRESERVE | - AV_PERM_REUSE, link->w, link->h); + yadif->out = ff_get_video_buffer(ctx->outputs[0], AV_PERM_WRITE | AV_PERM_PRESERVE | + AV_PERM_REUSE, link->w, link->h); avfilter_copy_buffer_ref_props(yadif->out, yadif->cur); yadif->out->video->interlaced = 0; diff --git a/libavfilter/video.c b/libavfilter/video.c index 33082a1..0e10bb7 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -67,7 +67,7 @@ static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) AVFilterBufferRef *ff_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { - return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h); + return ff_get_video_buffer(link->dst->outputs[0], perms, w, h); } /* TODO: set the buffer's priv member to a context structure for the whole @@ -138,7 +138,7 @@ fail: return NULL; } -AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) +AVFilterBufferRef *ff_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { AVFilterBufferRef *ret = NULL; @@ -173,7 +173,7 @@ static void default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) outlink = inlink->dst->outputs[0]; if (outlink) { - outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); + outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); avfilter_copy_buffer_ref_props(outlink->out_buf, picref); ff_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0)); } @@ -201,7 +201,7 @@ void ff_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) picref->perms, link->dstpad->min_perms, link->dstpad->rej_perms); - link->cur_buf = avfilter_get_video_buffer(link, dst->min_perms, link->w, link->h); + link->cur_buf = ff_get_video_buffer(link, dst->min_perms, link->w, link->h); link->src_buf = picref; avfilter_copy_buffer_ref_props(link->cur_buf, link->src_buf); } @@ -354,4 +354,8 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { ff_draw_slice(link, y, h, slice_dir); } +AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) +{ + return ff_get_video_buffer(link, perms, w, h); +} #endif diff --git a/libavfilter/video.h b/libavfilter/video.h index 7c9f9a0..ce4e9c2 100644 --- a/libavfilter/video.h +++ b/libavfilter/video.h @@ -25,6 +25,20 @@ 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); +/** + * 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); + void ff_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref); void ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir); void ff_null_end_frame(AVFilterLink *link); diff --git a/libavfilter/vsrc_color.c b/libavfilter/vsrc_color.c index 99ea0ad..bfd8493 100644 --- a/libavfilter/vsrc_color.c +++ b/libavfilter/vsrc_color.c @@ -140,7 +140,7 @@ static int color_config_props(AVFilterLink *inlink) static int color_request_frame(AVFilterLink *link) { ColorContext *color = link->src->priv; - AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); + AVFilterBufferRef *picref = ff_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); picref->video->pixel_aspect = (AVRational) {1, 1}; picref->pts = color->pts++; picref->pos = -1; diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c index ff3022c..f887e95 100644 --- a/libavfilter/vsrc_movie.c +++ b/libavfilter/vsrc_movie.c @@ -237,8 +237,8 @@ static int movie_get_frame(AVFilterLink *outlink) if (frame_decoded) { /* FIXME: avoid the memcpy */ - movie->picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE | AV_PERM_PRESERVE | - AV_PERM_REUSE2, outlink->w, outlink->h); + movie->picref = ff_get_video_buffer(outlink, AV_PERM_WRITE | AV_PERM_PRESERVE | + AV_PERM_REUSE2, 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 7187241..a6159ef 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -132,8 +132,7 @@ static int request_frame(AVFilterLink *outlink) if (test->max_pts >= 0 && test->pts > test->max_pts) return AVERROR_EOF; - picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, - test->w, test->h); + picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, test->w, test->h); picref->pts = test->pts++; picref->pos = -1; picref->video->key_frame = 1; -- 2.7.4