31 #if FF_API_AVFILTERBUFFER
32 AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(
const AVFrame *
frame,
35 AVFilterBufferRef *picref =
41 if (avfilter_copy_frame_props(picref, frame) < 0) {
42 picref->buf->data[0] = NULL;
43 avfilter_unref_bufferp(&picref);
48 AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(
const AVFrame *frame,
51 AVFilterBufferRef *samplesref;
56 av_log(0,
AV_LOG_ERROR,
"Layout indicates a different number of channels than actually present\n");
60 samplesref = avfilter_get_audio_buffer_ref_from_arrays_channels(
65 if (avfilter_copy_frame_props(samplesref, frame) < 0) {
66 samplesref->buf->data[0] = NULL;
67 avfilter_unref_bufferp(&samplesref);
72 AVFilterBufferRef *avfilter_get_buffer_ref_from_frame(
enum AVMediaType type,
78 return avfilter_get_video_buffer_ref_from_frame(frame, perms);
80 return avfilter_get_audio_buffer_ref_from_frame(frame, perms);
86 int avfilter_copy_buf_props(
AVFrame *dst,
const AVFilterBufferRef *
src)
95 memcpy(dst->
data, src->data,
sizeof(dst->
data));
105 dst->
width = src->video->w;
106 dst->
height = src->video->h;
139 #if FF_API_FILL_FRAME
140 int avfilter_fill_frame_from_audio_buffer_ref(
AVFrame *frame,
141 const AVFilterBufferRef *samplesref)
143 return avfilter_copy_buf_props(frame, samplesref);
146 int avfilter_fill_frame_from_video_buffer_ref(
AVFrame *frame,
147 const AVFilterBufferRef *picref)
149 return avfilter_copy_buf_props(frame, picref);
152 int avfilter_fill_frame_from_buffer_ref(
AVFrame *frame,
153 const AVFilterBufferRef *ref)
155 return avfilter_copy_buf_props(frame, ref);