diff options
author | Victor Vasiliev <vasilvv@gmail.com> | 2011-11-25 23:29:12 +0400 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-10-16 18:50:36 +0200 |
commit | 71e92414bfd79e56ea6fff174a665ff7b9b86e68 (patch) | |
tree | d2d780db102f7123021c0ce9ef8d13317f479f3d /libavformat/riff.c | |
parent | a119c64e38bd9bfc5c3c94b70b321619c6fabac9 (diff) | |
download | ffmpeg-71e92414bfd79e56ea6fff174a665ff7b9b86e68.tar.gz |
lavf: move RIFF INFO tag writing from avienc to riff
It will be useful in the wav muxer.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat/riff.c')
-rw-r--r-- | libavformat/riff.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/libavformat/riff.c b/libavformat/riff.c index 2539b23134..3d805d8884 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 Libav. @@ -708,3 +708,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); +} |