Implement a common get_filtered_video_frame(), shared between ffplay.c

and ffmpeg.c.

Originally committed as revision 25520 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Stefano Sabatini
2010-10-18 13:57:11 +00:00
parent 16b2691346
commit ff0652e503
4 changed files with 42 additions and 46 deletions

View File

@@ -787,4 +787,26 @@ AVFilter ffsink = {
.outputs = (AVFilterPad[]) {{ .name = NULL }},
};
int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
AVFilterBufferRef **picref_ptr, AVRational *tb)
{
int ret;
AVFilterBufferRef *picref;
if ((ret = avfilter_request_frame(ctx->inputs[0])) < 0)
return ret;
if (!(picref = ctx->inputs[0]->cur_buf))
return AVERROR(ENOENT);
*picref_ptr = picref;
ctx->inputs[0]->cur_buf = NULL;
*tb = ctx->inputs[0]->time_base;
memcpy(frame->data, picref->data, sizeof(frame->data));
memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize));
frame->interlaced_frame = picref->video->interlaced;
frame->top_field_first = picref->video->top_field_first;
return 1;
}
#endif /* CONFIG_AVFILTER */