X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fmp3enc.c;h=38a2665b22b0d7df01a5720efb9a42c9cf1dfbd8;hb=b10ba1175d3afa28d88cf3b24b69dc4882be16f5;hp=9caa65282b11aa7dd50f2ee73c133fe29077c102;hpb=335bbe424f6d21b5540230db8dadd4f42751d260;p=ffmpeg diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 9caa65282b1..38a2665b22b 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -141,6 +141,7 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 typedef struct MP3Context { const AVClass *class; int id3v2_version; + int write_id3v1; int64_t frames_offset; int32_t frames; int32_t size; @@ -156,7 +157,7 @@ static int mp2_write_trailer(struct AVFormatContext *s) MP3Context *mp3 = s->priv_data; /* write the id3v1 tag */ - if (id3v1_create_tag(s, buf) > 0) { + if (mp3 && mp3->write_id3v1 && id3v1_create_tag(s, buf) > 0) { avio_write(s->pb, buf, ID3v1_TAG_SIZE); } @@ -182,6 +183,7 @@ AVOutputFormat ff_mp2_muxer = { .video_codec = CODEC_ID_NONE, .write_packet = ff_raw_write_packet, .write_trailer = mp2_write_trailer, + .flags = AVFMT_NOTIMESTAMPS, }; #endif @@ -190,6 +192,8 @@ AVOutputFormat ff_mp2_muxer = { static const AVOption options[] = { { "id3v2_version", "Select ID3v2 version to write. Currently 3 and 4 are supported.", offsetof(MP3Context, id3v2_version), FF_OPT_TYPE_INT, {.dbl = 4}, 3, 4, AV_OPT_FLAG_ENCODING_PARAM}, + { "write_id3v1", "Enable ID3v1 writing. ID3v1 tags are written in UTF-8 which may not be supported by most software.", + offsetof(MP3Context, write_id3v1), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, { NULL }, };