Commit 9fdf7721 authored by Stefano Sabatini's avatar 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().
parent 6070b7e1
......@@ -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.
......
......@@ -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);
}
......
......@@ -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;
}
......@@ -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 */
......@@ -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, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment