History

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.

Stefano Sabatini committed 15 years ago

Commit c000a9f1 parent d3fddb85 files · +31 −7Browse files

Showing the changes to libavfilter/vsrc_buffer.c (1 of 5 files). Show all

Unified · Split

libavfilter/vsrc_buffer.c+17−0
@@ -106,6 +106,23 @@ int av_vsrc_buffer_add_video_buffer_ref(AVFilterContext *buffer_filter, AVFilter · 105 unmodified lines
106106 return 0;
107107 }
108108
109+#if CONFIG_AVCODEC
110+#include "avcodec.h"
111+
112+int av_vsrc_buffer_add_frame(AVFilterContext *buffer_src, const AVFrame *frame)
113+{
114+ AVFilterBufferRef *picref =
115+ avfilter_get_video_buffer_ref_from_frame(frame, AV_PERM_WRITE);
116+ if (!picref)
117+ return AVERROR(ENOMEM);
118+ av_vsrc_buffer_add_video_buffer_ref(buffer_src, picref);
119+ picref->buf->data[0] = NULL;
120+ avfilter_unref_buffer(picref);
121+
122+ return 0;
123+}
124+#endif
125+
109126 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
110127 {
111128 BufferSourceContext *c = ctx->priv;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t