|
|
|
@@ -424,7 +424,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, |
|
|
|
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) |
|
|
|
return ret; |
|
|
|
|
|
|
|
if (buf_size % (G729_8K_BLOCK_SIZE * avctx->channels) == 0) { |
|
|
|
if (buf_size % ((G729_8K_BLOCK_SIZE + (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN)) * avctx->channels) == 0) { |
|
|
|
packet_type = FORMAT_G729_8K; |
|
|
|
format = &format_g729_8k; |
|
|
|
//Reset voice decision |
|
|
|
@@ -445,6 +445,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, |
|
|
|
int bad_pitch = 0; ///< parity check failed |
|
|
|
int is_periodic = 0; ///< whether one of the subframes is declared as periodic or not |
|
|
|
out_frame = (int16_t*)frame->data[c]; |
|
|
|
if (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN) { |
|
|
|
if (*buf != ((avctx->channels - 1 - c) * 0x80 | 2)) |
|
|
|
avpriv_request_sample(avctx, "First byte value %x for channel %d", *buf, c); |
|
|
|
buf++; |
|
|
|
} |
|
|
|
|
|
|
|
for (i = 0; i < buf_size; i++) |
|
|
|
frame_erasure |= buf[i]; |
|
|
|
@@ -727,7 +732,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, |
|
|
|
} |
|
|
|
|
|
|
|
*got_frame_ptr = 1; |
|
|
|
return packet_type == FORMAT_G729_8K ? G729_8K_BLOCK_SIZE * avctx->channels : G729D_6K4_BLOCK_SIZE * avctx->channels; |
|
|
|
return packet_type == FORMAT_G729_8K ? (G729_8K_BLOCK_SIZE + (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN)) * avctx->channels : G729D_6K4_BLOCK_SIZE * avctx->channels; |
|
|
|
} |
|
|
|
|
|
|
|
static av_cold int decode_close(AVCodecContext *avctx) |
|
|
|
@@ -749,3 +754,15 @@ AVCodec ff_g729_decoder = { |
|
|
|
.close = decode_close, |
|
|
|
.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1, |
|
|
|
}; |
|
|
|
|
|
|
|
AVCodec ff_acelp_kelvin_decoder = { |
|
|
|
.name = "acelp.kelvin", |
|
|
|
.long_name = NULL_IF_CONFIG_SMALL("Sipro ACELP.KELVIN"), |
|
|
|
.type = AVMEDIA_TYPE_AUDIO, |
|
|
|
.id = AV_CODEC_ID_ACELP_KELVIN, |
|
|
|
.priv_data_size = sizeof(G729Context), |
|
|
|
.init = decoder_init, |
|
|
|
.decode = decode_frame, |
|
|
|
.close = decode_close, |
|
|
|
.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1, |
|
|
|
}; |