Skip to content

Commit ca5eb0d

Browse files
committed
Fix Export: audio: crash when provides "Cover art" in Metadata #1834
1 parent a3027f8 commit ca5eb0d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/modules/avformat/consumer_avformat.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ static AVStream *add_attached_pic_stream(mlt_consumer consumer,
16651665
return NULL;
16661666
}
16671667

1668-
// Allocate packet and read image data into it
1668+
// Allocate packet and read image data into it.
16691669
ctx->attached_pic_pkt = av_packet_alloc();
16701670
if (!ctx->attached_pic_pkt) {
16711671
mlt_log_error(MLT_CONSUMER_SERVICE(consumer), "attached_pic: could not allocate packet\n");
@@ -1700,6 +1700,16 @@ static AVStream *add_attached_pic_stream(mlt_consumer consumer,
17001700
return NULL;
17011701
}
17021702

1703+
if (avformat_query_codec(ctx->oc->oformat, pic_codec_id, FF_COMPLIANCE_UNOFFICIAL) != 1) {
1704+
mlt_log_warning(MLT_CONSUMER_SERVICE(consumer),
1705+
"attached_pic: output format '%s' does not support codec '%s'; "
1706+
"ignoring cover art\n",
1707+
ctx->oc->oformat->name,
1708+
avcodec_get_name(pic_codec_id));
1709+
av_packet_free(&ctx->attached_pic_pkt);
1710+
return NULL;
1711+
}
1712+
17031713
int width = 0;
17041714
int height = 0;
17051715
if (attached_pic_get_dimensions(pic_codec_id,

0 commit comments

Comments
 (0)