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:
22
cmdutils.c
22
cmdutils.c
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user