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

Tomas Härdin git at videolan.org
Wed Feb 5 17:21:59 EET 2025


ffmpeg | branch: master | Tomas Härdin <git at haerdin.se> | Fri Nov  8 11:26:24 2024 +0100| [9729444c7d55b9c73c830be66650d80109bf0989] | committer: Tomas Härdin

lavf/mxfenc: Return AVERROR(EINVAL) in mxf_write_jpeg2000_subdesc() is pixfmt not set

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9729444c7d55b9c73c830be66650d80109bf0989
---

 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;
 }



More information about the ffmpeg-cvslog mailing list