diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-05-19 03:17:16 +0400 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-05-20 01:15:34 +0400 |
commit | c000a9f78390b71812c7ee5187bbccc3c2d79b1e (patch) | |
tree | 101bafe8874835096c6dd536ec38a968a9174013 /libavfilter/vsrc_buffer.c | |
parent | d3fddb8454cab525cbcb6cc9c3d0ca29b6c78cdd (diff) |
vsrc_buffer: add av_vsrc_buffer_add_frame()
The new function is a wrapper around
av_vsrc_buffer_add_video_buffer_ref(), and allows to simplify the act
of pushing AVFrame data to the source buffer.
Diffstat (limited to 'libavfilter/vsrc_buffer.c')
-rw-r--r-- | libavfilter/vsrc_buffer.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c index 9815f945da..6a2fcbf36e 100644 --- a/libavfilter/vsrc_buffer.c +++ b/libavfilter/vsrc_buffer.c @@ -106,6 +106,23 @@ int av_vsrc_buffer_add_video_buffer_ref(AVFilterContext *buffer_filter, AVFilter return 0; } +#if CONFIG_AVCODEC +#include "avcodec.h" + +int av_vsrc_buffer_add_frame(AVFilterContext *buffer_src, const AVFrame *frame) +{ + AVFilterBufferRef *picref = + avfilter_get_video_buffer_ref_from_frame(frame, AV_PERM_WRITE); + if (!picref) + return AVERROR(ENOMEM); + av_vsrc_buffer_add_video_buffer_ref(buffer_src, picref); + picref->buf->data[0] = NULL; + avfilter_unref_buffer(picref); + + return 0; +} +#endif + static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) { BufferSourceContext *c = ctx->priv; |