mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
Support adpcm_ima_wav and adpcm_ms in caf.
This commit is contained in:
parent
afa218f372
commit
45ecc7a294
@ -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') },
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user