36 #if FF_API_AVFILTERBUFFER
37 void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr)
39 if (ptr->extended_data != ptr->data)
45 static int copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *
src) {
48 int qsize = src->qp_table_size;
52 dst->qp_table_size = 0;
55 memcpy(dst->qp_table, src->qp_table, qsize);
60 AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref,
int pmask)
62 AVFilterBufferRef *
ret =
av_malloc(
sizeof(AVFilterBufferRef));
71 ret->video =
av_malloc(
sizeof(AVFilterBufferRefVideoProps));
76 copy_video_props(ret->video, ref->video);
77 ret->extended_data = ret->data;
79 ret->audio =
av_malloc(
sizeof(AVFilterBufferRefAudioProps));
84 *ret->audio = *ref->audio;
86 if (ref->extended_data && ref->extended_data != ref->data) {
94 memcpy(ret->extended_data, ref->extended_data,
95 sizeof(*ret->extended_data) * nb_channels);
97 ret->extended_data = ret->data;
100 ret->buf->refcount ++;
104 void avfilter_unref_buffer(AVFilterBufferRef *ref)
109 if (!(--ref->buf->refcount))
110 ref->buf->free(ref->buf);
111 if (ref->extended_data != ref->data)
121 void avfilter_unref_bufferp(AVFilterBufferRef **ref)
124 avfilter_unref_buffer(*ref);
129 int avfilter_copy_frame_props(AVFilterBufferRef *dst,
const AVFrame *src)
133 dst->format = src->
format;
140 dst->video->w = src->
width;
141 dst->video->h = src->
height;
159 void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst,
const AVFilterBufferRef *src)
167 if (dst->video->qp_table)
169 copy_video_props(dst->video, src->video);