36 #if FF_API_AVFILTERBUFFER
37 void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr)
39 if (ptr->extended_data != ptr->data)
45 static void copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *
src) {
48 int qsize = src->qp_table_size;
50 memcpy(dst->qp_table, src->qp_table, qsize);
54 AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref,
int pmask)
56 AVFilterBufferRef *
ret =
av_malloc(
sizeof(AVFilterBufferRef));
65 ret->video =
av_malloc(
sizeof(AVFilterBufferRefVideoProps));
70 copy_video_props(ret->video, ref->video);
71 ret->extended_data = ret->data;
73 ret->audio =
av_malloc(
sizeof(AVFilterBufferRefAudioProps));
78 *ret->audio = *ref->audio;
80 if (ref->extended_data && ref->extended_data != ref->data) {
88 memcpy(ret->extended_data, ref->extended_data,
89 sizeof(*ret->extended_data) * nb_channels);
91 ret->extended_data = ret->data;
94 ret->buf->refcount ++;
98 void avfilter_unref_buffer(AVFilterBufferRef *ref)
103 if (!(--ref->buf->refcount))
104 ref->buf->free(ref->buf);
105 if (ref->extended_data != ref->data)
115 void avfilter_unref_bufferp(AVFilterBufferRef **ref)
118 avfilter_unref_buffer(*ref);
123 int avfilter_copy_frame_props(AVFilterBufferRef *dst,
const AVFrame *src)
127 dst->format = src->
format;
134 dst->video->w = src->
width;
135 dst->video->h = src->
height;
153 void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst,
const AVFilterBufferRef *src)
161 if (dst->video->qp_table)
163 copy_video_props(dst->video, src->video);