summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/riff.c20
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);