Browse code

libavfilter: implement avfilter_fill_frame_from_video_buffer_ref()

Stefano Sabatini authored on 2011/06/12 01:21:53
Showing 4 changed files
... ...
@@ -13,6 +13,10 @@ libavutil:   2011-04-18
13 13
 
14 14
 API changes, most recent first:
15 15
 
16
+2011-06-12 - xxxxxxx - lavfi 2.18.0 - avcodec.h
17
+  Add avfilter_get_video_buffer_ref_from_frame() function in
18
+  libavfilter/avcodec.h.
19
+
16 20
 2011-06-12 - xxxxxxx - lavfi 2.17.0 - avfiltergraph.h
17 21
   Add avfilter_inout_alloc() and avfilter_inout_free() functions.
18 22
 
... ...
@@ -53,3 +53,21 @@ AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame
53 53
     avfilter_copy_frame_props(picref, frame);
54 54
     return picref;
55 55
 }
56
+
57
+int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
58
+                                              const AVFilterBufferRef *picref)
59
+{
60
+    if (!picref || !picref->video || !frame)
61
+        return AVERROR(EINVAL);
62
+
63
+    memcpy(frame->data,     picref->data,     sizeof(frame->data));
64
+    memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize));
65
+    frame->pkt_pos          = picref->pos;
66
+    frame->interlaced_frame = picref->video->interlaced;
67
+    frame->top_field_first  = picref->video->top_field_first;
68
+    frame->key_frame        = picref->video->key_frame;
69
+    frame->pict_type        = picref->video->pict_type;
70
+    frame->sample_aspect_ratio = picref->video->sample_aspect_ratio;
71
+
72
+    return 0;
73
+}
... ...
@@ -47,6 +47,17 @@ void avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src);
47 47
 AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, int perms);
48 48
 
49 49
 /**
50
+ * Fill an AVFrame with the information stored in picref.
51
+ *
52
+ * @param frame an already allocated AVFrame
53
+ * @param picref a video buffer reference
54
+ * @return 0 in case of success, a negative AVERROR code in case of
55
+ * failure
56
+ */
57
+int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
58
+                                              const AVFilterBufferRef *picref);
59
+
60
+/**
50 61
  * Add frame data to buffer_src.
51 62
  *
52 63
  * @param buffer_src pointer to a buffer source context
... ...
@@ -26,7 +26,7 @@
26 26
 #include "libavutil/samplefmt.h"
27 27
 
28 28
 #define LIBAVFILTER_VERSION_MAJOR  2
29
-#define LIBAVFILTER_VERSION_MINOR 17
29
+#define LIBAVFILTER_VERSION_MINOR 18
30 30
 #define LIBAVFILTER_VERSION_MICRO  0
31 31
 
32 32
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \