lavfi: add avfilter_get_buffer_ref_from_frame.
authorNicolas George <nicolas.george@normalesup.org>
Fri, 20 Jul 2012 22:47:52 +0000 (00:47 +0200)
committerNicolas George <nicolas.george@normalesup.org>
Mon, 23 Jul 2012 15:14:59 +0000 (17:14 +0200)
libavfilter/avcodec.c
libavfilter/avcodec.h

index c50cd18..734357c 100644 (file)
@@ -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;
index 867b014..5f4209a 100644 (file)
@@ -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.