summaryrefslogtreecommitdiff
path: root/libavformat/riff.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-17 14:30:25 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-17 14:30:25 +0200
commitfadfbb354b30f018338c66712bfe5a6b58970b9a (patch)
tree1dc56195c0aba61f396cb679788ced1a3229fb6f /libavformat/riff.c
parentd6e87190fd0725f3517493f67dca6f8f264bb370 (diff)
parent71e92414bfd79e56ea6fff174a665ff7b9b86e68 (diff)
Merge commit '71e92414bfd79e56ea6fff174a665ff7b9b86e68'
* commit '71e92414bfd79e56ea6fff174a665ff7b9b86e68': lavf: move RIFF INFO tag writing from avienc to riff avconv: fix disabling auto mappings with -map_metadata Conflicts: ffmpeg_opt.c libavformat/riff.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/riff.c')
-rw-r--r--libavformat/riff.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 01ca985c6d..3923275698 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -1,5 +1,5 @@
/*
- * RIFF codec tags
+ * RIFF common functions and data
* Copyright (c) 2000 Fabrice Bellard
*
* This file is part of FFmpeg.
@@ -798,3 +798,33 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
return 0;
}
+
+void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
+{
+ int len = strlen(str);
+ if (len > 0) {
+ len++;
+ ffio_wfourcc(pb, tag);
+ avio_wl32(pb, len);
+ avio_put_str(pb, str);
+ if (len & 1)
+ avio_w8(pb, 0);
+ }
+}
+
+void ff_riff_write_info(AVFormatContext *s)
+{
+ AVIOContext *pb = s->pb;
+ int i;
+ int64_t list_pos;
+ AVDictionaryEntry *t = NULL;
+
+ 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);
+ }
+ ff_end_tag(pb, list_pos);
+}