diff options
Diffstat (limited to 'cmdutils.c')
-rw-r--r-- | cmdutils.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cmdutils.c b/cmdutils.c index fca783ca94..49c6ad574e 100644 --- a/cmdutils.c +++ b/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 */ |