[FFmpeg-cvslog] Support more codecs when muxing caf.

Carl Eugen Hoyos git at videolan.org
Mon Aug 22 09:37:34 CEST 2011


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Mon Aug 22 09:35:58 2011 +0200| [05a267305dd6c12ee1a9614b2aae539c3eab255e] | committer: Carl Eugen Hoyos

Support more codecs when muxing caf.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=05a267305dd6c12ee1a9614b2aae539c3eab255e
---

 libavformat/cafenc.c |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
index 80263e4..0dd4b34 100644
--- a/libavformat/cafenc.c
+++ b/libavformat/cafenc.c
@@ -107,9 +107,6 @@ static int caf_write_header(AVFormatContext *s)
     switch (enc->codec_id) {
     case CODEC_ID_AAC:
     case CODEC_ID_AC3:
-    case CODEC_ID_ALAC:
-    case CODEC_ID_AMR_NB:
-    case CODEC_ID_QDM2:
         av_log(s, AV_LOG_ERROR, "muxing codec currently unsupported\n");
         return AVERROR_PATCHWELCOME;
     }
@@ -161,6 +158,28 @@ static int caf_write_header(AVFormatContext *s)
         ff_mov_write_chan(pb, enc->channel_layout);
     }
 
+    if (enc->codec_id == CODEC_ID_ALAC) {
+        ffio_wfourcc(pb, "kuki");
+        avio_wb64(pb, 12 + enc->extradata_size);
+        avio_write(pb, "\0\0\0\14frmaalac", 12);
+        avio_write(pb, enc->extradata, enc->extradata_size);
+    } else if (enc->codec_id == CODEC_ID_AMR_NB) {
+        ffio_wfourcc(pb, "kuki");
+        avio_wb64(pb, 29);
+        avio_write(pb, "\0\0\0\14frmasamr", 12);
+        avio_wb32(pb, 0x11); /* size */
+        avio_write(pb, "samrFFMP", 8);
+        avio_w8(pb, 0); /* decoder version */
+
+        avio_wb16(pb, 0x81FF); /* Mode set (all modes for AMR_NB) */
+        avio_w8(pb, 0x00); /* Mode change period (no restriction) */
+        avio_w8(pb, 0x01); /* Frames per sample */
+    } else if (enc->codec_id == CODEC_ID_QDM2) {
+        ffio_wfourcc(pb, "kuki");
+        avio_wb64(pb, enc->extradata_size);
+        avio_write(pb, enc->extradata, enc->extradata_size);
+    }
+
     ffio_wfourcc(pb, "data"); //< Audio Data chunk
     caf->data = avio_tell(pb);
     avio_wb64(pb, -1);        //< mChunkSize



More information about the ffmpeg-cvslog mailing list