Subject: [PATCH] Set aspect ratio for jpeg2000 images and remove an unused variable.
From: Cedric Le Barz <[email-masked]>
To: [email-masked]
Date: Fri, 26 Jan 2024 14:29:38 +0100

Signed-off-by: Cedric Le Barz <[email-masked]>
---
 ffmpeg/libavformat/mxfenc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ffmpeg/libavformat/mxfenc.c b/ffmpeg/libavformat/mxfenc.c
index 0f13068..7ea19ca 100644
--- a/ffmpeg/libavformat/mxfenc.c
+++ b/ffmpeg/libavformat/mxfenc.c
@@ -2639,7 +2639,6 @@ static int mxf_parse_jpeg2000_frame(AVFormatContext *s, AVStream *st, AVPacket *
 {
     MXFContext *mxf = s->priv_data;
     MXFStreamContext *sc = st->priv_data;
-    AVIOContext *pb = s->pb;
     int component_count = av_pix_fmt_count_planes(st->codecpar->format);
     GetByteContext g;
     uint32_t j2k_ncomponents;
@@ -2679,6 +2678,10 @@ static int mxf_parse_jpeg2000_frame(AVFormatContext *s, AVStream *st, AVPacket *
     }
     bytestream2_get_bufferu(&g, sc->j2k_info.j2k_comp_desc, 3 * j2k_ncomponents);
 
+    /* Set aspect ratio */
+    av_reduce(&sc->aspect_ratio.num, &sc->aspect_ratio.den,
+              sc->j2k_info.j2k_xsiz, sc->j2k_info.j2k_ysiz, INT32_MAX);
+
     sc->frame_size = pkt->size;
 
     return 1;
-- 
2.34.1