diff options
Diffstat (limited to 'video/mp_image.c')
-rw-r--r-- | video/mp_image.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index d4de39fe58..765289f8ff 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -200,6 +200,7 @@ static void mp_image_destructor(void *ptr) for (int p = 0; p < MP_MAX_PLANES; p++) av_buffer_unref(&mpi->bufs[p]); av_buffer_unref(&mpi->hwctx); + av_buffer_unref(&mpi->icc_profile); } int mp_chroma_div_up(int size, int shift) @@ -316,6 +317,12 @@ struct mp_image *mp_image_new_ref(struct mp_image *img) fail = true; } + if (new->icc_profile) { + new->icc_profile = av_buffer_ref(new->icc_profile); + if (!new->icc_profile) + fail = true; + } + if (!fail) return new; @@ -525,6 +532,13 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src) memcpy(dst->planes[1], src->planes[1], MP_PALETTE_SIZE); } } + av_buffer_unref(&dst->icc_profile); + dst->icc_profile = src->icc_profile; + if (dst->icc_profile) { + dst->icc_profile = av_buffer_ref(dst->icc_profile); + if (!dst->icc_profile) + abort(); + } } // Crop the given image to (x0, y0)-(x1, y1) (bottom/right border exclusive) |