summaryrefslogtreecommitdiffstats
path: root/libavcodec/alsdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/alsdec.c')
-rw-r--r--libavcodec/alsdec.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 1c3f0cb..46dd0b4 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -2,20 +2,20 @@
* MPEG-4 ALS decoder
* Copyright (c) 2009 Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -394,7 +394,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
if (get_bits_left(&gb) < 32)
return -1;
- if (avctx->err_recognition & AV_EF_CRCCHECK) {
+ if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) {
ctx->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE);
ctx->crc = 0xFFFFFFFF;
ctx->crc_org = ~get_bits_long(&gb, 32);
@@ -1025,8 +1025,8 @@ static void zero_remaining(unsigned int b, unsigned int b_max,
{
unsigned int count = 0;
- for (; b < b_max; b++)
- count += div_blocks[b];
+ while (b < b_max)
+ count += div_blocks[b++];
if (count)
memset(buf, 0, sizeof(*buf) * count);
@@ -1132,7 +1132,7 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
// reconstruct joint-stereo blocks
if (bd[0].js_blocks) {
if (bd[1].js_blocks)
- av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel pair!\n");
+ av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel pair.\n");
for (s = 0; s < div_blocks[b]; s++)
bd[0].raw_samples[s] = bd[1].raw_samples[s] - bd[0].raw_samples[s];
@@ -1226,7 +1226,7 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
}
if (dep == channels) {
- av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel correlation!\n");
+ av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel correlation.\n");
return -1;
}
@@ -1403,6 +1403,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
bd.lpc_cof = ctx->lpc_cof[c];
bd.quant_cof = ctx->quant_cof[c];
bd.raw_samples = ctx->raw_samples[c] + offset;
+
if ((ret = decode_block(ctx, &bd)) < 0)
return ret;
}
@@ -1483,7 +1484,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
}
// update CRC
- if (sconf->crc_enabled && (avctx->err_recognition & AV_EF_CRCCHECK)) {
+ if (sconf->crc_enabled && (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL))) {
int swap = HAVE_BIGENDIAN != sconf->msb_first;
if (ctx->avctx->bits_per_raw_sample == 24) {
@@ -1533,7 +1534,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
// check CRC sums if this is the last frame
if (ctx->cur_frame_length != sconf->frame_length &&
ctx->crc_org != ctx->crc) {
- av_log(avctx, AV_LOG_ERROR, "CRC error.\n");
+ av_log(avctx, AV_LOG_ERROR, "CRC error!\n");
}
}
@@ -1595,12 +1596,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
ctx->avctx = avctx;
if (!avctx->extradata) {
- av_log(avctx, AV_LOG_ERROR, "Missing required ALS extradata.\n");
+ av_log(avctx, AV_LOG_ERROR, "Missing required ALS extradata!\n");
return -1;
}
if (read_specific_config(ctx)) {
- av_log(avctx, AV_LOG_ERROR, "Reading ALSSpecificConfig failed.\n");
+ av_log(avctx, AV_LOG_ERROR, "Reading ALSSpecificConfig failed!\n");
decode_end(avctx);
return -1;
}
@@ -1646,7 +1647,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (!ctx->quant_cof || !ctx->lpc_cof ||
!ctx->quant_cof_buffer || !ctx->lpc_cof_buffer ||
!ctx->lpc_cof_reversed_buffer) {
- av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
+ av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed!\n");
return AVERROR(ENOMEM);
}
@@ -1671,7 +1672,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
!ctx->opt_order || !ctx->store_prev_samples ||
!ctx->use_ltp || !ctx->ltp_lag ||
!ctx->ltp_gain || !ctx->ltp_gain_buffer) {
- av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
+ av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed!\n");
decode_end(avctx);
return AVERROR(ENOMEM);
}
@@ -1689,7 +1690,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
num_buffers);
if (!ctx->chan_data_buffer || !ctx->chan_data || !ctx->reverted_channels) {
- av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
+ av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed!\n");
decode_end(avctx);
return AVERROR(ENOMEM);
}
@@ -1710,7 +1711,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
// allocate previous raw sample buffer
if (!ctx->prev_raw_samples || !ctx->raw_buffer|| !ctx->raw_samples) {
- av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
+ av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed!\n");
decode_end(avctx);
return AVERROR(ENOMEM);
}
@@ -1722,13 +1723,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
// allocate crc buffer
if (HAVE_BIGENDIAN != sconf->msb_first && sconf->crc_enabled &&
- (avctx->err_recognition & AV_EF_CRCCHECK)) {
+ (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL))) {
ctx->crc_buffer = av_malloc(sizeof(*ctx->crc_buffer) *
ctx->cur_frame_length *
avctx->channels *
av_get_bytes_per_sample(avctx->sample_fmt));
if (!ctx->crc_buffer) {
- av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
+ av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed!\n");
decode_end(avctx);
return AVERROR(ENOMEM);
}
OpenPOWER on IntegriCloud