diff options
author | Victor Vasiliev <vasilvv@gmail.com> | 2012-10-16 10:31:22 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-10-16 18:51:16 +0200 |
commit | 0bca0283ccded5e32da143a462168ad1988a58fd (patch) | |
tree | 1a0c7d0d3192d1ccb198a73c4383ed6fb81b76db /libavformat/riff.c | |
parent | 71e92414bfd79e56ea6fff174a665ff7b9b86e68 (diff) | |
download | ffmpeg-0bca0283ccded5e32da143a462168ad1988a58fd.tar.gz |
riff: do not write empty INFO tags
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat/riff.c')
-rw-r--r-- | libavformat/riff.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libavformat/riff.c b/libavformat/riff.c index 3d805d8884..d591aa81e0 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -709,6 +709,19 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size) return 0; } +static int riff_has_valid_tags(AVFormatContext *s) +{ + int i; + AVDictionaryEntry *t = NULL; + + for (i = 0; *ff_riff_tags[i]; i++) { + if ((t = av_dict_get(s->metadata, ff_riff_tags[i], NULL, AV_DICT_MATCH_CASE))) + return 1; + } + + return 0; +} + void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str) { int len = strlen(str); @@ -729,9 +742,14 @@ void ff_riff_write_info(AVFormatContext *s) int64_t list_pos; AVDictionaryEntry *t = NULL; + ff_metadata_conv(&s->metadata, ff_riff_info_conv, NULL); + + /* writing empty LIST is not nice and may cause problems */ + if (!riff_has_valid_tags(s)) + return; + list_pos = ff_start_tag(pb, "LIST"); ffio_wfourcc(pb, "INFO"); - ff_metadata_conv(&s->metadata, ff_riff_info_conv, NULL); for (i = 0; *ff_riff_tags[i]; i++) { if ((t = av_dict_get(s->metadata, ff_riff_tags[i], NULL, AV_DICT_MATCH_CASE))) ff_riff_write_info_tag(s->pb, t->key, t->value); |