aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/cafenc.c
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 /libavformat/cafenc.c
parentafa218f372ad2616e6609e2c3b41ef458261a431 (diff)
downloadffmpeg-45ecc7a294d56e41dab621512f6f70fc2578340e.tar.gz
Support adpcm_ima_wav and adpcm_ms in caf.
Diffstat (limited to 'libavformat/cafenc.c')
-rw-r--r--libavformat/cafenc.c8
1 files changed, 6 insertions, 2 deletions
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