diff mbox series

[FFmpeg-devel,2/2] lavf/mxfenc: Return AVERROR(EINVAL) in mxf_write_jpeg2000_subdesc() is pixfmt not set

Message ID 32096f5317b1b0bcc270dfca16f23eceaa77494e.camel@haerdin.se
State New
Headers show
Series [FFmpeg-devel,1/2] lavf/mxfenc: Make write_desc return int | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/configure_x86 warning Failed to apply patch

Commit Message

Tomas Härdin Nov. 8, 2024, 10:29 a.m. UTC
Also passes fate-mxf

/Tomas
diff mbox series

Patch

From 164175d6f7e2e1eab767c129d953e6e9ebbfc94d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Fri, 8 Nov 2024 11:26:24 +0100
Subject: [PATCH 2/2] lavf/mxfenc: Return AVERROR(EINVAL) in
 mxf_write_jpeg2000_subdesc() is pixfmt not set

---
 libavformat/mxfenc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index abc870f133..a482a6a352 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1483,7 +1483,7 @@  static void mxf_write_avc_subdesc(AVFormatContext *s, AVStream *st)
     mxf_update_klv_size(s->pb, pos);
 }
 
-static void mxf_write_jpeg2000_subdesc(AVFormatContext *s, AVStream *st)
+static int mxf_write_jpeg2000_subdesc(AVFormatContext *s, AVStream *st)
 {
     MXFStreamContext *sc = st->priv_data;
     AVIOContext *pb = s->pb;
@@ -1492,7 +1492,7 @@  static void mxf_write_jpeg2000_subdesc(AVFormatContext *s, AVStream *st)
 
     if (!pix_desc) {
         av_log(s, AV_LOG_ERROR, "Pixel format not set - not writing JPEG2000SubDescriptor\n");
-        return;
+        return AVERROR(EINVAL);
     }
 
     /* JPEG2000 subdescriptor key */
@@ -1543,6 +1543,7 @@  static void mxf_write_jpeg2000_subdesc(AVFormatContext *s, AVStream *st)
     avio_write(pb, sc->j2k_info.j2k_comp_desc, 3*pix_desc->nb_components);
 
     mxf_update_klv_size(pb, pos);
+    return 0;
 }
 
 static int mxf_write_cdci_desc(AVFormatContext *s, AVStream *st)
@@ -1554,7 +1555,7 @@  static int mxf_write_cdci_desc(AVFormatContext *s, AVStream *st)
         mxf_write_avc_subdesc(s, st);
     }
     if (st->codecpar->codec_id == AV_CODEC_ID_JPEG2000) {
-         mxf_write_jpeg2000_subdesc(s, st);
+         return mxf_write_jpeg2000_subdesc(s, st);
     }
     return 0;
 }
-- 
2.39.2