Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-10-26 03:33:34 +0400
committerPaul B Mahol <onemda@gmail.com>2012-10-26 07:12:45 +0400
commit7fe6f6e2b10fe278fecea850fda1d8e321330c15 (patch)
tree36d79b3bd83a4eb5d01bbf76f34dca413792876f /libavformat/cafenc.c
parent507f2940ccdcedf2fdc064c5fb6022b60bace8ca (diff)
caf muxer: write metadata
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavformat/cafenc.c')
-rw-r--r--libavformat/cafenc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
index dc222cd50d..cc39a8341c 100644
--- a/libavformat/cafenc.c
+++ b/libavformat/cafenc.c
@@ -25,6 +25,7 @@
#include "isom.h"
#include "avio_internal.h"
#include "libavutil/intfloat.h"
+#include "libavutil/dict.h"
typedef struct {
int64_t data;
@@ -102,7 +103,9 @@ static int caf_write_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[0]->codec;
CAFContext *caf = s->priv_data;
+ AVDictionaryEntry *t = NULL;
unsigned int codec_tag = ff_codec_get_tag(ff_codec_caf_tags, enc->codec_id);
+ int64_t chunk_size = 0;
switch (enc->codec_id) {
case AV_CODEC_ID_AAC:
@@ -180,6 +183,20 @@ static int caf_write_header(AVFormatContext *s)
avio_write(pb, enc->extradata, enc->extradata_size);
}
+ if (av_dict_count(s->metadata)) {
+ ffio_wfourcc(pb, "info"); //< Information chunk
+ while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ chunk_size += strlen(t->key) + strlen(t->value) + 2;
+ }
+ avio_wb64(pb, chunk_size + 4);
+ avio_wb32(pb, av_dict_count(s->metadata));
+ t = NULL;
+ while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ avio_put_str(pb, t->key);
+ avio_put_str(pb, t->value);
+ }
+ }
+
ffio_wfourcc(pb, "data"); //< Audio Data chunk
caf->data = avio_tell(pb);
avio_wb64(pb, -1); //< mChunkSize