aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-06-11 18:21:53 +0200
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-06-12 22:46:02 +0200
commit3fe6bbd5dcdf603a8dac78b48adf6f0b6604143c (patch)
treee587b065f89d83202500860aad88c564f26db4b0
parentc535494268069282cc1147c4d61d4a88ce39e078 (diff)
downloadffmpeg-3fe6bbd5dcdf603a8dac78b48adf6f0b6604143c.tar.gz
libavfilter: implement avfilter_fill_frame_from_video_buffer_ref()
-rw-r--r--doc/APIchanges4
-rw-r--r--libavfilter/avcodec.c18
-rw-r--r--libavfilter/avcodec.h11
-rw-r--r--libavfilter/avfilter.h2
4 files changed, 34 insertions, 1 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index d94c553af9..e8dc0642fa 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,10 @@ libavutil: 2011-04-18
API changes, most recent first:
+2011-06-12 - xxxxxxx - lavfi 2.18.0 - avcodec.h
+ Add avfilter_get_video_buffer_ref_from_frame() function in
+ libavfilter/avcodec.h.
+
2011-06-12 - xxxxxxx - lavfi 2.17.0 - avfiltergraph.h
Add avfilter_inout_alloc() and avfilter_inout_free() functions.
diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
index 50670bc55e..2010040d14 100644
--- a/libavfilter/avcodec.c
+++ b/libavfilter/avcodec.c
@@ -53,3 +53,21 @@ AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame
avfilter_copy_frame_props(picref, frame);
return picref;
}
+
+int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
+ const AVFilterBufferRef *picref)
+{
+ if (!picref || !picref->video || !frame)
+ return AVERROR(EINVAL);
+
+ memcpy(frame->data, picref->data, sizeof(frame->data));
+ memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize));
+ frame->pkt_pos = picref->pos;
+ frame->interlaced_frame = picref->video->interlaced;
+ frame->top_field_first = picref->video->top_field_first;
+ frame->key_frame = picref->video->key_frame;
+ frame->pict_type = picref->video->pict_type;
+ frame->sample_aspect_ratio = picref->video->sample_aspect_ratio;
+
+ return 0;
+}
diff --git a/libavfilter/avcodec.h b/libavfilter/avcodec.h
index 4eed6b2d2c..dec5ae4a7c 100644
--- a/libavfilter/avcodec.h
+++ b/libavfilter/avcodec.h
@@ -47,6 +47,17 @@ void avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src);
AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, int perms);
/**
+ * Fill an AVFrame with the information stored in picref.
+ *
+ * @param frame an already allocated AVFrame
+ * @param picref a video buffer reference
+ * @return 0 in case of success, a negative AVERROR code in case of
+ * failure
+ */
+int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
+ const AVFilterBufferRef *picref);
+
+/**
* Add frame data to buffer_src.
*
* @param buffer_src pointer to a buffer source context
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 84fa32e64e..7628cd51ec 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -26,7 +26,7 @@
#include "libavutil/samplefmt.h"
#define LIBAVFILTER_VERSION_MAJOR 2
-#define LIBAVFILTER_VERSION_MINOR 17
+#define LIBAVFILTER_VERSION_MINOR 18
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \