[FFmpeg-devel] [PATCH 08/15] lavf/id3v2enc: use codec-desc-provided MIME types
rcombs
rcombs at rcombs.me
Wed Sep 9 09:02:10 EEST 2020
---
libavformat/id3v2enc.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/libavformat/id3v2enc.c b/libavformat/id3v2enc.c
index 5d821ea4db..a7f251652f 100644
--- a/libavformat/id3v2enc.c
+++ b/libavformat/id3v2enc.c
@@ -352,23 +352,18 @@ int ff_id3v2_write_apic(AVFormatContext *s, ID3v2EncContext *id3, AVPacket *pkt)
{
AVStream *st = s->streams[pkt->stream_index];
AVDictionaryEntry *e;
+ const AVCodecDescriptor *cdesc = avcodec_descriptor_get(st->codecpar->codec_id);
AVIOContext *dyn_buf;
uint8_t *buf;
- const CodecMime *mime = ff_id3v2_mime_tags;
const char *mimetype = NULL, *desc = "";
int enc = id3->version == 3 ? ID3v2_ENCODING_UTF16BOM :
ID3v2_ENCODING_UTF8;
int i, len, type = 0, ret;
/* get the mimetype*/
- while (mime->id != AV_CODEC_ID_NONE) {
- if (mime->id == st->codecpar->codec_id) {
- mimetype = mime->str;
- break;
- }
- mime++;
- }
+ if (cdesc && cdesc->mime_types)
+ mimetype = cdesc->mime_types[0];
if (!mimetype) {
av_log(s, AV_LOG_ERROR, "No mimetype is known for stream %d, cannot "
"write an attached picture.\n", st->index);
--
2.27.0
More information about the ffmpeg-devel
mailing list