Signed-off-by: Paul B Mahol <onemda@gmail.com>
Paul B Mahol authored on 2012/10/26 08:33:34... | ... |
@@ -25,6 +25,7 @@ |
25 | 25 |
#include "isom.h" |
26 | 26 |
#include "avio_internal.h" |
27 | 27 |
#include "libavutil/intfloat.h" |
28 |
+#include "libavutil/dict.h" |
|
28 | 29 |
|
29 | 30 |
typedef struct { |
30 | 31 |
int64_t data; |
... | ... |
@@ -102,7 +103,9 @@ static int caf_write_header(AVFormatContext *s) |
102 | 102 |
AVIOContext *pb = s->pb; |
103 | 103 |
AVCodecContext *enc = s->streams[0]->codec; |
104 | 104 |
CAFContext *caf = s->priv_data; |
105 |
+ AVDictionaryEntry *t = NULL; |
|
105 | 106 |
unsigned int codec_tag = ff_codec_get_tag(ff_codec_caf_tags, enc->codec_id); |
107 |
+ int64_t chunk_size = 0; |
|
106 | 108 |
|
107 | 109 |
switch (enc->codec_id) { |
108 | 110 |
case AV_CODEC_ID_AAC: |
... | ... |
@@ -180,6 +183,20 @@ static int caf_write_header(AVFormatContext *s) |
180 | 180 |
avio_write(pb, enc->extradata, enc->extradata_size); |
181 | 181 |
} |
182 | 182 |
|
183 |
+ if (av_dict_count(s->metadata)) { |
|
184 |
+ ffio_wfourcc(pb, "info"); //< Information chunk |
|
185 |
+ while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) { |
|
186 |
+ chunk_size += strlen(t->key) + strlen(t->value) + 2; |
|
187 |
+ } |
|
188 |
+ avio_wb64(pb, chunk_size + 4); |
|
189 |
+ avio_wb32(pb, av_dict_count(s->metadata)); |
|
190 |
+ t = NULL; |
|
191 |
+ while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) { |
|
192 |
+ avio_put_str(pb, t->key); |
|
193 |
+ avio_put_str(pb, t->value); |
|
194 |
+ } |
|
195 |
+ } |
|
196 |
+ |
|
183 | 197 |
ffio_wfourcc(pb, "data"); //< Audio Data chunk |
184 | 198 |
caf->data = avio_tell(pb); |
185 | 199 |
avio_wb64(pb, -1); //< mChunkSize |
... | ... |
@@ -30,7 +30,7 @@ |
30 | 30 |
#include "libavutil/avutil.h" |
31 | 31 |
|
32 | 32 |
#define LIBAVFORMAT_VERSION_MAJOR 54 |
33 |
-#define LIBAVFORMAT_VERSION_MINOR 34 |
|
33 |
+#define LIBAVFORMAT_VERSION_MINOR 35 |
|
34 | 34 |
#define LIBAVFORMAT_VERSION_MICRO 100 |
35 | 35 |
|
36 | 36 |
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |