summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-12-30 17:13:28 +0000
committerPaul B Mahol <onemda@gmail.com>2013-01-03 19:35:02 +0000
commit48340bbb366aeaa6af94a19c6baa211de4c14a47 (patch)
tree16953becbeff60788627cab7246b4b84951593ba /libavformat
parent0c8943939eb0a0b7172c0664bd0b594c069c9bb7 (diff)
aiffenc: metadata support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/aiffenc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index df6c756b7a..525bd49623 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -33,6 +33,22 @@ typedef struct {
int64_t ssnd;
} AIFFOutputContext;
+static void put_meta(AVFormatContext *s, const char *key, uint32_t id)
+{
+ AVDictionaryEntry *tag;
+ AVIOContext *pb = s->pb;
+
+ if (tag = av_dict_get(s->metadata, key, NULL, 0)) {
+ int size = strlen(tag->value);
+
+ avio_wl32(pb, id);
+ avio_wb32(pb, FFALIGN(size, 2));
+ avio_write(pb, tag->value, size);
+ if (size & 1)
+ avio_w8(pb, 0);
+ }
+}
+
static int aiff_write_header(AVFormatContext *s)
{
AIFFOutputContext *aiff = s->priv_data;
@@ -70,6 +86,11 @@ static int aiff_write_header(AVFormatContext *s)
ff_mov_write_chan(pb, enc->channel_layout);
}
+ put_meta(s, "title", MKTAG('N', 'A', 'M', 'E'));
+ put_meta(s, "author", MKTAG('A', 'U', 'T', 'H'));
+ put_meta(s, "copyright", MKTAG('(', 'c', ')', ' '));
+ put_meta(s, "comment", MKTAG('A', 'N', 'N', 'O'));
+
/* Common chunk */
ffio_wfourcc(pb, "COMM");
avio_wb32(pb, aifc ? 24 : 18); /* size */