mp_image: add support for AVAlphaMode

This commit is contained in:
Kacper Michajłow committed 2025-10-04 03:26:57 +02:00
1 parent e821a360df
commit 17a3ac4cf2
1 file changed
+8
+8
View File
@@ -1102,9 +1102,17 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src)
dst->params.stereo3d = p->stereo3d;
// Might be incorrect if colorspace changes.
dst->params.light = p->light;
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(60, 11, 100) || PL_API_VER < 356
dst->params.repr.alpha = p->repr.alpha;
#endif
}
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(60, 11, 100) && PL_API_VER >= 356
// mp_image_setfmt sets to PL_ALPHA_INDEPENDENT, if format has alpha.
if (dst->params.repr.alpha == PL_ALPHA_INDEPENDENT)
dst->params.repr.alpha = pl_alpha_from_av(src->alpha_mode);
#endif
sd = av_frame_get_side_data(src, AV_FRAME_DATA_DISPLAYMATRIX);
if (sd) {
int32_t *matrix = (int32_t *) sd->data;