Commit 6d58358a authored by Anton Khirnov's avatar Anton Khirnov

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.
parent 8772997d
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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)
......
......@@ -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;
......
......@@ -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;
......
......@@ -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)
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment