summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2021-10-02 13:19:10 -0400
committersfan5 <sfan5@live.de>2021-12-15 16:39:45 +0100
commit3ec2012cec2deeeb9af34d249cfb337e549df9b1 (patch)
treebfa15215239997d2ef2d96b8da02509c212c00f1 /video/mp_image.c
parentf9fd50c6546f2fa510251267d6423d3f342ca115 (diff)
downloadmpv-3ec2012cec2deeeb9af34d249cfb337e549df9b1.tar.bz2
mpv-3ec2012cec2deeeb9af34d249cfb337e549df9b1.tar.xz
mp_image, f_decoder_wrapper: implement AV_FRAME_DATA_DISPLAYMATRIX
fixes #9249 (JPEG orientation support) with ffmpeg commit [0]. [0] https://github.com/FFmpeg/FFmpeg/commit/e93c9986027d17917c3b4f533b28ee4a2ce7cd4c
Diffstat (limited to 'video/mp_image.c')
-rw-r--r--video/mp_image.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index 484108c315..91755c3273 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -21,6 +21,7 @@
#include <libavutil/mem.h>
#include <libavutil/common.h>
+#include <libavutil/display.h>
#include <libavutil/bswap.h>
#include <libavutil/hwcontext.h>
#include <libavutil/intreadwrite.h>
@@ -973,6 +974,13 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src)
dst->params.alpha = p->alpha;
}
+ sd = av_frame_get_side_data(src, AV_FRAME_DATA_DISPLAYMATRIX);
+ if (sd) {
+ double r = av_display_rotation_get((int32_t *)(sd->data));
+ if (!isnan(r))
+ dst->params.rotate = (((int)(-r) % 360) + 360) % 360;
+ }
+
sd = av_frame_get_side_data(src, AV_FRAME_DATA_ICC_PROFILE);
if (sd)
dst->icc_profile = sd->buf;