diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-01-23 14:57:32 -0500 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-01-24 14:13:41 -0500 |
commit | 220506d23f39da3e23d3d42fb7061f19cec8052c (patch) | |
tree | 5a1621e906a2c3ce4c4b9a2b9c5e36800c142d9e | |
parent | 4340a6363e9ff75dc4e8ce14dc96671623494ed8 (diff) | |
download | ffmpeg-220506d23f39da3e23d3d42fb7061f19cec8052c.tar.gz |
avcodec: add a new codec_id for CRYO APC IMA ADPCM.
The stereo layout and extradata is significantly different from that in
Westwood IMA ADPCM, so a separate codec_id is warranted.
-rw-r--r-- | libavcodec/Makefile | 1 | ||||
-rw-r--r-- | libavcodec/adpcm.c | 7 | ||||
-rw-r--r-- | libavcodec/allcodecs.c | 1 | ||||
-rw-r--r-- | libavcodec/avcodec.h | 1 | ||||
-rw-r--r-- | libavcodec/utils.c | 1 | ||||
-rw-r--r-- | libavcodec/version.h | 2 | ||||
-rw-r--r-- | libavformat/apc.c | 2 | ||||
-rw-r--r-- | libavformat/yop.c | 2 |
8 files changed, 12 insertions, 5 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3468f66863..620c99e980 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -509,6 +509,7 @@ OBJS-$(CONFIG_ADPCM_G722_ENCODER) += g722.o g722enc.o OBJS-$(CONFIG_ADPCM_G726_DECODER) += g726.o OBJS-$(CONFIG_ADPCM_G726_ENCODER) += g726.o OBJS-$(CONFIG_ADPCM_IMA_AMV_DECODER) += adpcm.o adpcm_data.o +OBJS-$(CONFIG_ADPCM_IMA_APC_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_DK3_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_DK4_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_EA_EACS_DECODER) += adpcm.o adpcm_data.o diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index b319635ed4..64bea6a5da 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -120,8 +120,8 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx) return -1; } break; - case CODEC_ID_ADPCM_IMA_WS: - if (avctx->extradata && avctx->extradata_size == 2 * 4) { + case CODEC_ID_ADPCM_IMA_APC: + if (avctx->extradata && avctx->extradata_size >= 8) { c->status[0].predictor = AV_RL32(avctx->extradata); c->status[1].predictor = AV_RL32(avctx->extradata + 4); } @@ -359,6 +359,7 @@ static int get_nb_samples(AVCodecContext *avctx, const uint8_t *buf, break; /* simple 4-bit adpcm */ case CODEC_ID_ADPCM_CT: + case CODEC_ID_ADPCM_IMA_APC: case CODEC_ID_ADPCM_IMA_EA_SEAD: case CODEC_ID_ADPCM_IMA_WS: case CODEC_ID_ADPCM_YAMAHA: @@ -774,6 +775,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, } break; case CODEC_ID_ADPCM_IMA_WS: + case CODEC_ID_ADPCM_IMA_APC: while (src < buf + buf_size) { uint8_t v = *src++; *samples++ = adpcm_ima_expand_nibble(&c->status[0], v >> 4 , 3); @@ -1220,6 +1222,7 @@ ADPCM_DECODER(CODEC_ID_ADPCM_EA_R2, adpcm_ea_r2, "ADPCM Electronic Arts R2"); ADPCM_DECODER(CODEC_ID_ADPCM_EA_R3, adpcm_ea_r3, "ADPCM Electronic Arts R3"); ADPCM_DECODER(CODEC_ID_ADPCM_EA_XAS, adpcm_ea_xas, "ADPCM Electronic Arts XAS"); ADPCM_DECODER(CODEC_ID_ADPCM_IMA_AMV, adpcm_ima_amv, "ADPCM IMA AMV"); +ADPCM_DECODER(CODEC_ID_ADPCM_IMA_APC, adpcm_ima_apc, "ADPCM IMA CRYO APC"); ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3, "ADPCM IMA Duck DK3"); ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4, "ADPCM IMA Duck DK4"); ADPCM_DECODER(CODEC_ID_ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs, "ADPCM IMA Electronic Arts EACS"); diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d00bd0b79c..fe1ee5c4b0 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -342,6 +342,7 @@ void avcodec_register_all(void) REGISTER_ENCDEC (ADPCM_G722, adpcm_g722); REGISTER_ENCDEC (ADPCM_G726, adpcm_g726); REGISTER_DECODER (ADPCM_IMA_AMV, adpcm_ima_amv); + REGISTER_DECODER (ADPCM_IMA_APC, adpcm_ima_apc); REGISTER_DECODER (ADPCM_IMA_DK3, adpcm_ima_dk3); REGISTER_DECODER (ADPCM_IMA_DK4, adpcm_ima_dk4); REGISTER_DECODER (ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 967a134bdd..1c2766316e 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -317,6 +317,7 @@ enum CodecID { CODEC_ID_ADPCM_EA_MAXIS_XA, CODEC_ID_ADPCM_IMA_ISS, CODEC_ID_ADPCM_G722, + CODEC_ID_ADPCM_IMA_APC, /* AMR */ CODEC_ID_AMR_NB = 0x12000, diff --git a/libavcodec/utils.c b/libavcodec/utils.c index ff3f065064..184f67e566 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1617,6 +1617,7 @@ int av_get_bits_per_sample(enum CodecID codec_id){ return 3; case CODEC_ID_ADPCM_SBPRO_4: case CODEC_ID_ADPCM_CT: + case CODEC_ID_ADPCM_IMA_APC: case CODEC_ID_ADPCM_IMA_WAV: case CODEC_ID_ADPCM_IMA_QT: case CODEC_ID_ADPCM_SWF: diff --git a/libavcodec/version.h b/libavcodec/version.h index 22a2b87798..95d0baa612 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -21,7 +21,7 @@ #define AVCODEC_VERSION_H #define LIBAVCODEC_VERSION_MAJOR 53 -#define LIBAVCODEC_VERSION_MINOR 35 +#define LIBAVCODEC_VERSION_MINOR 36 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ diff --git a/libavformat/apc.c b/libavformat/apc.c index 238395087c..47ab5c821b 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -44,7 +44,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS; + st->codec->codec_id = CODEC_ID_ADPCM_IMA_APC; avio_rl32(pb); /* number of samples */ st->codec->sample_rate = avio_rl32(pb); diff --git a/libavformat/yop.c b/libavformat/yop.c index a317825a7c..e5ace8b805 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -72,7 +72,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) // Audio audio_dec = audio_stream->codec; audio_dec->codec_type = AVMEDIA_TYPE_AUDIO; - audio_dec->codec_id = CODEC_ID_ADPCM_IMA_WS; + audio_dec->codec_id = CODEC_ID_ADPCM_IMA_APC; audio_dec->channels = 1; audio_dec->sample_rate = 22050; |