Skip to content

Commit 9729444

Browse files
committed
lavf/mxfenc: Return AVERROR(EINVAL) in mxf_write_jpeg2000_subdesc() is pixfmt not set
1 parent 0202c7c commit 9729444

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libavformat/mxfenc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ static void mxf_write_avc_subdesc(AVFormatContext *s, AVStream *st)
14831483
mxf_update_klv_size(s->pb, pos);
14841484
}
14851485

1486-
static void mxf_write_jpeg2000_subdesc(AVFormatContext *s, AVStream *st)
1486+
static int mxf_write_jpeg2000_subdesc(AVFormatContext *s, AVStream *st)
14871487
{
14881488
MXFStreamContext *sc = st->priv_data;
14891489
AVIOContext *pb = s->pb;
@@ -1492,7 +1492,7 @@ static void mxf_write_jpeg2000_subdesc(AVFormatContext *s, AVStream *st)
14921492

14931493
if (!pix_desc) {
14941494
av_log(s, AV_LOG_ERROR, "Pixel format not set - not writing JPEG2000SubDescriptor\n");
1495-
return;
1495+
return AVERROR(EINVAL);
14961496
}
14971497

14981498
/* JPEG2000 subdescriptor key */
@@ -1543,6 +1543,7 @@ static void mxf_write_jpeg2000_subdesc(AVFormatContext *s, AVStream *st)
15431543
avio_write(pb, sc->j2k_info.j2k_comp_desc, 3*pix_desc->nb_components);
15441544

15451545
mxf_update_klv_size(pb, pos);
1546+
return 0;
15461547
}
15471548

15481549
static int mxf_write_cdci_desc(AVFormatContext *s, AVStream *st)
@@ -1554,7 +1555,7 @@ static int mxf_write_cdci_desc(AVFormatContext *s, AVStream *st)
15541555
mxf_write_avc_subdesc(s, st);
15551556
}
15561557
if (st->codecpar->codec_id == AV_CODEC_ID_JPEG2000) {
1557-
mxf_write_jpeg2000_subdesc(s, st);
1558+
return mxf_write_jpeg2000_subdesc(s, st);
15581559
}
15591560
return 0;
15601561
}

0 commit comments

Comments
 (0)