[FFmpeg-cvslog] lavfi: add avfilter_get_video_buffer_ref_from_frame to avcodec.h
Stefano Sabatini
git at videolan.org
Thu May 19 23:33:08 CEST 2011
ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Sat May 14 11:46:14 2011 +0200| [9fdf77217b39646afdb8907b977e3d7a59f1cb9e] | committer: Stefano Sabatini
lavfi: add avfilter_get_video_buffer_ref_from_frame to avcodec.h
Simplify passing AVFrame data to av_vsrc_buffer_add_video_buffer_ref().
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9fdf77217b39646afdb8907b977e3d7a59f1cb9e
---
doc/APIchanges | 3 +++
ffmpeg.c | 8 +++-----
libavfilter/avcodec.c | 13 +++++++++++++
libavfilter/avcodec.h | 8 ++++++++
libavfilter/avfilter.h | 2 +-
5 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index d9e7d32..cd1f888 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2011-04-18
API changes, most recent first:
+2011-05-XX - XXXXXX - lavfi 2.6.0 - avcodec.h
+ Add avfilter_get_video_buffer_ref_from_frame() to libavfilter/avcodec.h.
+
2011-05-18 - 64150ff - lavc 53.4.0 - AVCodecContext.request_sample_fmt
Add request_sample_fmt field to AVCodecContext.
diff --git a/ffmpeg.c b/ffmpeg.c
index 340a947..d4c7705 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1650,11 +1650,9 @@ static int output_packet(AVInputStream *ist, int ist_index,
picture.sample_aspect_ratio = ist->st->sample_aspect_ratio;
picture.pts = ist->pts;
- picref = avfilter_get_video_buffer_ref_from_arrays(
- picture.data, picture.linesize, AV_PERM_WRITE,
- picture.width, picture.height, picture.format);
- avfilter_copy_frame_props(picref, &picture);
- av_vsrc_buffer_add_video_buffer_ref2(ost->input_video_filter, picref, ""); //TODO user setable params
+ picref =
+ avfilter_get_video_buffer_ref_from_frame(&picture, AV_PERM_WRITE);
+ av_vsrc_buffer_add_video_buffer_ref(ost->input_video_filter, picref, ""); //TODO user setable params
picref->buf->data[0] = NULL;
avfilter_unref_buffer(picref);
}
diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
index c2f8651..50670bc 100644
--- a/libavfilter/avcodec.c
+++ b/libavfilter/avcodec.c
@@ -40,3 +40,16 @@ void avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
dst->video->pict_type = src->pict_type;
}
}
+
+AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame,
+ int perms)
+{
+ AVFilterBufferRef *picref =
+ avfilter_get_video_buffer_ref_from_arrays(frame->data, frame->linesize, perms,
+ frame->width, frame->height,
+ frame->format);
+ if (!picref)
+ return NULL;
+ avfilter_copy_frame_props(picref, frame);
+ return picref;
+}
diff --git a/libavfilter/avcodec.h b/libavfilter/avcodec.h
index f438860..e6ae907 100644
--- a/libavfilter/avcodec.h
+++ b/libavfilter/avcodec.h
@@ -37,4 +37,12 @@
*/
void avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src);
+/**
+ * Create and return a picref reference from the data and properties
+ * contained in frame.
+ *
+ * @param perms permissions to assign to the new buffer reference
+ */
+AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, int perms);
+
#endif /* AVFILTER_AVCODEC_H */
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 03a1e49..171c9e4 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 5
+#define LIBAVFILTER_VERSION_MINOR 6
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
More information about the ffmpeg-cvslog
mailing list