summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-11-01 05:05:42 +0100
committersfan5 <sfan5@live.de>2023-11-03 10:05:41 +0100
commit7480efa62c0a2a1779b4fdaa804a6512aa488400 (patch)
tree8bb7958de0f12fecb01be5b34daa398fffca78a6 /video/mp_image.c
parentfe0d2b4ee9c29c07b4ffa14e1564653509f81be2 (diff)
downloadmpv-7480efa62c0a2a1779b4fdaa804a6512aa488400.tar.bz2
mpv-7480efa62c0a2a1779b4fdaa804a6512aa488400.tar.xz
mp_image: pass rotation correctly to/from AVFrame
Fixes rotating image by --video-rotate when filtering. Fixes: #12771
Diffstat (limited to 'video/mp_image.c')
-rw-r--r--video/mp_image.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index d5ce8da14b..36e3ba6c25 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -1044,7 +1044,6 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src)
if (src->opaque_ref) {
struct mp_image_params *p = (void *)src->opaque_ref->data;
- dst->params.rotate = p->rotate;
dst->params.stereo3d = p->stereo3d;
// Might be incorrect if colorspace changes.
dst->params.color.light = p->color.light;
@@ -1197,6 +1196,14 @@ struct AVFrame *mp_image_to_av_frame(struct mp_image *src)
clm->MaxCLL = src->params.color.sig_peak * MP_REF_WHITE;
}
+ {
+ AVFrameSideData *sd = av_frame_new_side_data(dst,
+ AV_FRAME_DATA_DISPLAYMATRIX,
+ sizeof(int32_t) * 9);
+ MP_HANDLE_OOM(sd);
+ av_display_rotation_set((int32_t *)sd->data, src->params.rotate);
+ }
+
// Add back side data, but only for types which are not specially handled
// above. Keep in mind that the types above will be out of sync anyway.
for (int n = 0; n < new_ref->num_ff_side_data; n++) {