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.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user