aboutsummaryrefslogtreecommitdiffstats
path: root/cmdutils.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-10-18 13:57:11 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-10-18 13:57:11 +0000
commitff0652e5036fd30cf518891d2158acbafea191fc (patch)
tree24a25a1e2590b68d096ebb2312aa1d8291be87e8 /cmdutils.c
parent16b2691346fa9c3d85af3162deef3db50b1eecc5 (diff)
downloadffmpeg-ff0652e5036fd30cf518891d2158acbafea191fc.tar.gz
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
Diffstat (limited to 'cmdutils.c')
-rw-r--r--cmdutils.c22
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 */