Commit 8033e49d authored by rbultje's avatar rbultje

Set lavf identification string globally in av_write_header(), rather

than inside the muxers. Remove special handling of "encoder" tags from
AVI and MP3 muxers.

Patch by Anton Khirnov <wyskas gmail com>.



git-svn-id: file:///var/local/repositories/ffmpeg/trunk@21850 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 410c10f9
...@@ -40,6 +40,6 @@ const AVMetadataConv ff_avi_metadata_conv[] = { ...@@ -40,6 +40,6 @@ const AVMetadataConv ff_avi_metadata_conv[] = {
const char ff_avi_tags[][5] = { const char ff_avi_tags[][5] = {
"IARL", "IART", "ICMS", "ICMT", "ICOP", "ICRD", "ICRP", "IDIM", "IDPI", "IARL", "IART", "ICMS", "ICMT", "ICOP", "ICRD", "ICRP", "IDIM", "IDPI",
"IENG", "IGNR", "IKEY", "ILGT", "ILNG", "IMED", "INAM", "IPLT", "IPRD", "IENG", "IGNR", "IKEY", "ILGT", "ILNG", "IMED", "INAM", "IPLT", "IPRD",
"IPRT", "ISBJ",/*"ISFT"*/"ISHP", "ISRC", "ISRF", "ITCH", "IPRT", "ISBJ", "ISFT", "ISHP", "ISRC", "ISRF", "ITCH",
{0} {0}
}; };
...@@ -376,8 +376,6 @@ static int avi_write_header(AVFormatContext *s) ...@@ -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))) 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); 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); ff_end_tag(pb, list2);
/* some padding for easier tag editing */ /* some padding for easier tag editing */
......
...@@ -105,7 +105,7 @@ void av_metadata_free(AVMetadata **pm) ...@@ -105,7 +105,7 @@ void av_metadata_free(AVMetadata **pm)
av_freep(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) const AVMetadataConv *s_conv)
{ {
/* TODO: use binary search to look up the two conversion tables /* TODO: use binary search to look up the two conversion tables
......
...@@ -45,4 +45,7 @@ void ff_metadata_demux_compat(AVFormatContext *s); ...@@ -45,4 +45,7 @@ void ff_metadata_demux_compat(AVFormatContext *s);
void ff_metadata_mux_compat(AVFormatContext *s); void ff_metadata_mux_compat(AVFormatContext *s);
#endif #endif
void metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv,
const AVMetadataConv *s_conv);
#endif /* AVFORMAT_METADATA_H */ #endif /* AVFORMAT_METADATA_H */
...@@ -313,7 +313,7 @@ static int mp3_write_header(struct AVFormatContext *s) ...@@ -313,7 +313,7 @@ static int mp3_write_header(struct AVFormatContext *s)
while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) { while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) {
uint32_t tag = 0; uint32_t tag = 0;
if (t->key[0] == 'T' && strcmp(t->key, "TSSE")) { if (t->key[0] == 'T' && strlen(t->key) == 4) {
int i; int i;
for (i = 0; *ff_id3v2_tags[i]; i++) for (i = 0; *ff_id3v2_tags[i]; i++)
if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) { if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) {
...@@ -338,11 +338,6 @@ static int mp3_write_header(struct AVFormatContext *s) ...@@ -338,11 +338,6 @@ static int mp3_write_header(struct AVFormatContext *s)
av_free(buf); 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); cur_pos = url_ftell(s->pb);
url_fseek(s->pb, size_pos, SEEK_SET); url_fseek(s->pb, size_pos, SEEK_SET);
......
...@@ -2583,6 +2583,20 @@ int av_write_header(AVFormatContext *s) ...@@ -2583,6 +2583,20 @@ int av_write_header(AVFormatContext *s)
ff_metadata_mux_compat(s); ff_metadata_mux_compat(s);
#endif #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){ if(s->oformat->write_header){
ret = s->oformat->write_header(s); ret = s->oformat->write_header(s);
if (ret < 0) if (ret < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment