35 #if FF_API_AVFILTERBUFFER
36 void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr)
38 if (ptr->extended_data != ptr->data)
44 static void copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *
src) {
47 int qsize = src->qp_table_size;
49 memcpy(dst->qp_table, src->qp_table, qsize);
53 AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref,
int pmask)
55 AVFilterBufferRef *
ret =
av_malloc(
sizeof(AVFilterBufferRef));
64 ret->video =
av_malloc(
sizeof(AVFilterBufferRefVideoProps));
69 copy_video_props(ret->video, ref->video);
70 ret->extended_data = ret->data;
72 ret->audio =
av_malloc(
sizeof(AVFilterBufferRefAudioProps));
77 *ret->audio = *ref->audio;
79 if (ref->extended_data && ref->extended_data != ref->data) {
81 if (!(ret->extended_data =
av_malloc(
sizeof(*ret->extended_data) *
87 memcpy(ret->extended_data, ref->extended_data,
88 sizeof(*ret->extended_data) * nb_channels);
90 ret->extended_data = ret->data;
93 ret->buf->refcount ++;
97 void avfilter_unref_buffer(AVFilterBufferRef *ref)
102 if (!(--ref->buf->refcount))
103 ref->buf->free(ref->buf);
104 if (ref->extended_data != ref->data)
114 void avfilter_unref_bufferp(AVFilterBufferRef **ref)
116 avfilter_unref_buffer(*ref);
120 int avfilter_copy_frame_props(AVFilterBufferRef *dst,
const AVFrame *src)
124 dst->format = src->
format;
131 dst->video->w = src->
width;
132 dst->video->h = src->
height;
150 void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src)
158 if (dst->video->qp_table)
160 copy_video_props(dst->video, src->video);