diff --git a/libavformat/avi.c b/libavformat/avi.c index a8980eb09cc0a09b653ba8aa3b7b9ac550fba090..705ad03ab01d46b7500ff0b14c0127d583403cc0 100644 --- a/libavformat/avi.c +++ b/libavformat/avi.c @@ -40,6 +40,6 @@ const AVMetadataConv ff_avi_metadata_conv[] = { const char ff_avi_tags[][5] = { "IARL", "IART", "ICMS", "ICMT", "ICOP", "ICRD", "ICRP", "IDIM", "IDPI", "IENG", "IGNR", "IKEY", "ILGT", "ILNG", "IMED", "INAM", "IPLT", "IPRD", - "IPRT", "ISBJ",/*"ISFT"*/"ISHP", "ISRC", "ISRF", "ITCH", + "IPRT", "ISBJ", "ISFT", "ISHP", "ISRC", "ISRF", "ITCH", {0} }; diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 3809b4d64b1dfe31d2f609d59afe7448ba2beabe..50419960a32fe90e7e5be7a0361ef28366ddc5f0 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -376,8 +376,6 @@ static int avi_write_header(AVFormatContext *s) if ((t = av_metadata_get(s->metadata, ff_avi_tags[i], NULL, AV_METADATA_MATCH_CASE))) avi_write_info_tag(s->pb, t->key, t->value); } - if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) - avi_write_info_tag(pb, "ISFT", LIBAVFORMAT_IDENT); ff_end_tag(pb, list2); /* some padding for easier tag editing */ diff --git a/libavformat/metadata.c b/libavformat/metadata.c index 080ebcde886ce4244ea58deed10cb90f889c0f0e..9ff7c48a8a9d9454ec7f47b9e6087d5bf7b867d0 100644 --- a/libavformat/metadata.c +++ b/libavformat/metadata.c @@ -105,7 +105,7 @@ void av_metadata_free(AVMetadata **pm) av_freep(pm); } -static void metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, +void metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, const AVMetadataConv *s_conv) { /* TODO: use binary search to look up the two conversion tables diff --git a/libavformat/metadata.h b/libavformat/metadata.h index 9ec2265a41c42f457890321b707b45a7ca932637..21724e9774e11201f7070eac8527ff4baba4d359 100644 --- a/libavformat/metadata.h +++ b/libavformat/metadata.h @@ -45,4 +45,7 @@ void ff_metadata_demux_compat(AVFormatContext *s); void ff_metadata_mux_compat(AVFormatContext *s); #endif +void metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, + const AVMetadataConv *s_conv); + #endif /* AVFORMAT_METADATA_H */ diff --git a/libavformat/mp3.c b/libavformat/mp3.c index e2f230acad08928a1f4caed84bd93a00745c12fc..45797733699fab41417bd9a2d4c75c075d19b1d1 100644 --- a/libavformat/mp3.c +++ b/libavformat/mp3.c @@ -313,7 +313,7 @@ static int mp3_write_header(struct AVFormatContext *s) while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) { uint32_t tag = 0; - if (t->key[0] == 'T' && strcmp(t->key, "TSSE")) { + if (t->key[0] == 'T' && strlen(t->key) == 4) { int i; for (i = 0; *ff_id3v2_tags[i]; i++) if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) { @@ -338,11 +338,6 @@ static int mp3_write_header(struct AVFormatContext *s) av_free(buf); } } - if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { - totlen += strlen(LIBAVFORMAT_IDENT) + ID3v2_HEADER_SIZE + 2; - id3v2_put_ttag(s, LIBAVFORMAT_IDENT, strlen(LIBAVFORMAT_IDENT) + 1, - MKBETAG('T', 'S', 'S', 'E')); - } cur_pos = url_ftell(s->pb); url_fseek(s->pb, size_pos, SEEK_SET); diff --git a/libavformat/utils.c b/libavformat/utils.c index 48294463124b11dd61f5ca7a7a65067cae168764..e01c26712d7902f13807923c6ad2a9be859a72bf 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2583,6 +2583,20 @@ int av_write_header(AVFormatContext *s) ff_metadata_mux_compat(s); #endif + /* set muxer identification string */ + if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { + AVMetadata *m; + AVMetadataTag *t; + + if (!(m = av_mallocz(sizeof(AVMetadata)))) + return AVERROR(ENOMEM); + av_metadata_set2(&m, "encoder", LIBAVFORMAT_IDENT, 0); + metadata_conv(&m, s->oformat->metadata_conv, NULL); + if ((t = av_metadata_get(m, "", NULL, AV_METADATA_IGNORE_SUFFIX))) + av_metadata_set2(&s->metadata, t->key, t->value, 0); + av_metadata_free(&m); + } + if(s->oformat->write_header){ ret = s->oformat->write_header(s); if (ret < 0)