[FFmpeg-cvslog] lavfi: add avfilter_fill_frame_from_{audio_, }buffer_ref().

Clément Bœsch git at videolan.org
Mon Mar 26 22:48:10 CEST 2012


ffmpeg | branch: master | Clément Bœsch <clement.boesch at smartjog.com> | Tue Feb 14 17:00:53 2012 +0100| [a67d9cfa58c61c8da7f8fdf4285db6ec208a8766] | committer: Clément Bœsch

lavfi: add avfilter_fill_frame_from_{audio_,}buffer_ref().

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

 doc/APIchanges        |    3 +++
 libavfilter/avcodec.c |   23 +++++++++++++++++++++++
 libavfilter/avcodec.h |   22 ++++++++++++++++++++++
 libavfilter/version.h |    4 ++--
 4 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index ebd9525..9c5a8c9 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:   2011-04-18
 
 API changes, most recent first:
 
+2012-03-26 - xxxxxxx - lavfi 2.66.100
+  Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
+
 2012-03-21 - xxxxxxx - lavu 51.43.100
   Add bprint.h for bprint API.
 
diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
index 2850c4d..455ef92 100644
--- a/libavfilter/avcodec.c
+++ b/libavfilter/avcodec.c
@@ -56,6 +56,20 @@ AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame
     return picref;
 }
 
+int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame,
+                                              const AVFilterBufferRef *samplesref)
+{
+    if (!samplesref || !samplesref->audio || !frame)
+        return AVERROR(EINVAL);
+
+    memcpy(frame->data, samplesref->data, sizeof(frame->data));
+    frame->pkt_pos    = samplesref->pos;
+    frame->format     = samplesref->format;
+    frame->nb_samples = samplesref->audio->nb_samples;
+
+    return 0;
+}
+
 int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
                                               const AVFilterBufferRef *picref)
 {
@@ -73,3 +87,12 @@ int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
 
     return 0;
 }
+
+int avfilter_fill_frame_from_buffer_ref(AVFrame *frame,
+                                        const AVFilterBufferRef *ref)
+{
+    if (!ref)
+        return AVERROR(EINVAL);
+    return ref->video ? avfilter_fill_frame_from_video_buffer_ref(frame, ref)
+                      : avfilter_fill_frame_from_audio_buffer_ref(frame, ref);
+}
diff --git a/libavfilter/avcodec.h b/libavfilter/avcodec.h
index 22dd1a2..64773a6 100644
--- a/libavfilter/avcodec.h
+++ b/libavfilter/avcodec.h
@@ -47,6 +47,17 @@ int 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 samplesref.
+ *
+ * @param frame an already allocated AVFrame
+ * @param samplesref an audio buffer reference
+ * @return 0 in case of success, a negative AVERROR code in case of
+ * failure
+ */
+int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame,
+                                              const AVFilterBufferRef *samplesref);
+
+/**
  * Fill an AVFrame with the information stored in picref.
  *
  * @param frame an already allocated AVFrame
@@ -58,6 +69,17 @@ int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
                                               const AVFilterBufferRef *picref);
 
 /**
+ * Fill an AVFrame with information stored in ref.
+ *
+ * @param frame an already allocated AVFrame
+ * @param ref a video or audio buffer reference
+ * @return 0 in case of success, a negative AVERROR code in case of
+ * failure
+ */
+int avfilter_fill_frame_from_buffer_ref(AVFrame *frame,
+                                        const AVFilterBufferRef *ref);
+
+/**
  * Add frame data to buffer_src.
  *
  * @param buffer_src pointer to a buffer source context
diff --git a/libavfilter/version.h b/libavfilter/version.h
index fa24bbd..9d48fc5 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -29,8 +29,8 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVFILTER_VERSION_MAJOR  2
-#define LIBAVFILTER_VERSION_MINOR 65
-#define LIBAVFILTER_VERSION_MICRO 102
+#define LIBAVFILTER_VERSION_MINOR 66
+#define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
                                                LIBAVFILTER_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list