aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2011-07-12 17:35:20 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2011-07-12 17:35:20 +0200
commit45ecc7a294d56e41dab621512f6f70fc2578340e (patch)
treebdf82590f52e60b6f3199d8735910b98aaa691b0
parentafa218f372ad2616e6609e2c3b41ef458261a431 (diff)
downloadffmpeg-45ecc7a294d56e41dab621512f6f70fc2578340e.tar.gz
Support adpcm_ima_wav and adpcm_ms in caf.
-rw-r--r--libavformat/caf.c2
-rw-r--r--libavformat/cafenc.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/libavformat/caf.c b/libavformat/caf.c
index 1f3057dd63..faed166dfe 100644
--- a/libavformat/caf.c
+++ b/libavformat/caf.c
@@ -39,6 +39,8 @@ const AVCodecTag ff_codec_caf_tags[] = {
/*{ CODEC_ID_DVAUDIO, MKBETAG('v','d','v','a') },*/
/*{ CODEC_ID_DVAUDIO, MKBETAG('d','v','c','a') },*/
{ CODEC_ID_ADPCM_IMA_QT, MKBETAG('i','m','a','4') },
+ { CODEC_ID_ADPCM_IMA_WAV, MKBETAG('m','s', 0, 17 ) },
+ { CODEC_ID_ADPCM_MS, MKBETAG('m','s', 0, 2 ) },
{ CODEC_ID_AMR_NB, MKBETAG('s','a','m','r') },
{ CODEC_ID_GSM, MKBETAG('a','g','s','m') },
{ CODEC_ID_GSM_MS, MKBETAG('m','s', 0, '1') },
diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
index 7cb4777bc6..43f56624a7 100644
--- a/libavformat/cafenc.c
+++ b/libavformat/cafenc.c
@@ -47,7 +47,7 @@ static uint32_t codec_flags(enum CodecID codec_id) {
}
}
-static uint32_t samples_per_packet(enum CodecID codec_id) {
+static uint32_t samples_per_packet(enum CodecID codec_id, int channels) {
switch (codec_id) {
case CODEC_ID_PCM_S8:
case CODEC_ID_PCM_S16LE:
@@ -84,6 +84,10 @@ static uint32_t samples_per_packet(enum CodecID codec_id) {
case CODEC_ID_ALAC:
case CODEC_ID_QDM2:
return 4096;
+ case CODEC_ID_ADPCM_IMA_WAV:
+ return (1024 - 4 * channels) * 8 / (4 * channels) + 1;
+ case CODEC_ID_ADPCM_MS:
+ return (1024 - 7 * channels) * 2 / channels + 2;
default:
return 0;
}
@@ -133,7 +137,7 @@ static int caf_write_header(AVFormatContext *s)
avio_wb32(pb, codec_tag); //< mFormatID
avio_wb32(pb, codec_flags(enc->codec_id)); //< mFormatFlags
avio_wb32(pb, enc->block_align); //< mBytesPerPacket
- avio_wb32(pb, samples_per_packet(enc->codec_id)); //< mFramesPerPacket
+ avio_wb32(pb, samples_per_packet(enc->codec_id, enc->channels)); //< mFramesPerPacket
avio_wb32(pb, enc->channels); //< mChannelsPerFrame
avio_wb32(pb, enc->bits_per_coded_sample); //< mBitsPerChannel