[FFmpeg-cvslog] lavfi: add avfilter_get_buffer_ref_from_frame.

Nicolas George git at videolan.org
Mon Jul 23 17:31:22 CEST 2012


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Sat Jul 21 00:47:52 2012 +0200| [5c5f75b92bed707738a2ea6efa0d3b5c003616b6] | committer: Nicolas George

lavfi: add avfilter_get_buffer_ref_from_frame.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c5f75b92bed707738a2ea6efa0d3b5c003616b6
---

 libavfilter/avcodec.c |   14 ++++++++++++++
 libavfilter/avcodec.h |   10 ++++++++++
 2 files changed, 24 insertions(+)

diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
index c50cd18..734357c 100644
--- a/libavfilter/avcodec.c
+++ b/libavfilter/avcodec.c
@@ -80,6 +80,20 @@ AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame
     return picref;
 }
 
+AVFilterBufferRef *avfilter_get_buffer_ref_from_frame(enum AVMediaType type,
+                                                      const AVFrame *frame,
+                                                      int perms)
+{
+    switch (type) {
+    case AVMEDIA_TYPE_VIDEO:
+        return avfilter_get_video_buffer_ref_from_frame(frame, perms);
+    case AVMEDIA_TYPE_AUDIO:
+        return avfilter_get_audio_buffer_ref_from_frame(frame, perms);
+    default:
+        return NULL;
+    }
+}
+
 int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src)
 {
     int planes, nb_channels;
diff --git a/libavfilter/avcodec.h b/libavfilter/avcodec.h
index 867b014..5f4209a 100644
--- a/libavfilter/avcodec.h
+++ b/libavfilter/avcodec.h
@@ -65,6 +65,16 @@ AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame
 AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame,
                                                             int perms);
 
+/**
+ * Create and return a buffer reference from the data and properties
+ * contained in frame.
+ *
+ * @param perms permissions to assign to the new buffer reference
+ */
+AVFilterBufferRef *avfilter_get_buffer_ref_from_frame(enum AVMediaType type,
+                                                      const AVFrame *frame,
+                                                      int perms);
+
 #ifdef FF_API_FILL_FRAME
 /**
  * Fill an AVFrame with the information stored in samplesref.



More information about the ffmpeg-cvslog mailing list