Showing the changes to libavfilter/buffer.c (1 of 1 file). Show all
Unified · Split
| @@ -39,6 +39,15 @@ void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr) · 38 unmodified lines | |||
| 39 | av_free(ptr); | 39 | av_free(ptr); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | static void copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *src) { | ||
| 43 | *dst = *src; | ||
| 44 | if (src->qp_table) { | ||
| 45 | int qsize = src->qp_table_linesize ? (src->qp_table_linesize * (src->h+15)/16) : (src->w+15)/16; | ||
| 46 | dst->qp_table = av_malloc(qsize); | ||
| 47 | memcpy(dst->qp_table, src->qp_table, qsize); | ||
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 42 | AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) | 51 | AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) |
| 43 | { | 52 | { |
| 44 | AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); | 53 | AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); |
| @@ -51,12 +60,7 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) · 6 unmodified lines | |||
| 51 | av_free(ret); | 60 | av_free(ret); |
| 52 | return NULL; | 61 | return NULL; |
| 53 | } | 62 | } |
| 54 | *ret->video = *ref->video; | 63 | copy_video_props(ret->video, ref->video); |
| 55 | if (ref->video->qp_table) { | ||
| 56 | int qsize = ref->video->qp_table_linesize ? ref->video->qp_table_linesize * ((ref->video->h+15)/16) : (ref->video->w+15)/16; | ||
| 57 | ret->video->qp_table = av_malloc(qsize); | ||
| 58 | memcpy(ret->video->qp_table, ref->video->qp_table, qsize); | ||
| 59 | } | ||
| 60 | ret->extended_data = ret->data; | 64 | ret->extended_data = ret->data; |
| 61 | } else if (ref->type == AVMEDIA_TYPE_AUDIO) { | 65 | } else if (ref->type == AVMEDIA_TYPE_AUDIO) { |
| 62 | ret->audio = av_malloc(sizeof(AVFilterBufferRefAudioProps)); | 66 | ret->audio = av_malloc(sizeof(AVFilterBufferRefAudioProps)); |
| @@ -187,12 +191,7 @@ void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *s · 124 unmodified lines | |||
| 187 | case AVMEDIA_TYPE_VIDEO: { | 191 | case AVMEDIA_TYPE_VIDEO: { |
| 188 | if (dst->video->qp_table) | 192 | if (dst->video->qp_table) |
| 189 | av_freep(&dst->video->qp_table); | 193 | av_freep(&dst->video->qp_table); |
| 190 | *dst->video = *src->video; | 194 | copy_video_props(dst->video, src->video); |
| 191 | if (src->video->qp_table) { | ||
| 192 | int qsize = src->video->qp_table_linesize ? src->video->qp_table_linesize * ((src->video->h+15)/16) : (src->video->w+15)/16; | ||
| 193 | dst->video->qp_table = av_malloc(qsize); | ||
| 194 | memcpy(dst->video->qp_table, src->video->qp_table, qsize); | ||
| 195 | } | ||
| 196 | break; | 195 | break; |
| 197 | } | 196 | } |
| 198 | case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; | 197 | case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; |