Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-28 13:08:24 +0400
committerMichael Niedermayer <michaelni@gmx.at>2013-05-28 13:08:24 +0400
commit8d4e934df94e7324d56a13abca22c3cc21f2ac7d (patch)
treef5ba66b53aa36eb90e2450647f9b63d7e2cc9ba0 /libavcodec/wavpack.c
parent107e9e44329aeec082740a50f7a0e906d9544292 (diff)
parent0f3a0b24dd6f595feaa4526e52ffa7d05c3d7840 (diff)
Merge commit '0f3a0b24dd6f595feaa4526e52ffa7d05c3d7840'
* commit '0f3a0b24dd6f595feaa4526e52ffa7d05c3d7840': wavpack: add an error message to a failure. wavpack: return 0 instead of samples count from decoding functions Conflicts: libavcodec/wavpack.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/wavpack.c')
-rw-r--r--libavcodec/wavpack.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index a6ce0f42a3..2f20f8270e 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -638,7 +638,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
wv_check_crc(s, crc, crc_extra_bits))
return AVERROR_INVALIDDATA;
- return count * 2;
+ return 0;
}
static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb,
@@ -699,7 +699,7 @@ static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb,
wv_check_crc(s, crc, crc_extra_bits))
return AVERROR_INVALIDDATA;
- return count;
+ return 0;
}
static av_cold int wv_alloc_frame_context(WavpackContext *c)
@@ -765,7 +765,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
WavpackFrameContext *s;
GetByteContext gb;
void *samples_l, *samples_r;
- int samplecount;
+ int ret;
int got_terms = 0, got_weights = 0, got_samples = 0,
got_entropy = 0, got_bs = 0, got_float = 0, got_hybrid = 0;
int i, j, id, size, ssize, weights, t;
@@ -799,7 +799,8 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
if (!wc->mkv_mode) {
s->samples = bytestream2_get_le32(&gb);
if (s->samples != wc->samples) {
- av_log(avctx, AV_LOG_ERROR, "mismatching sample count in block");
+ av_log(avctx, AV_LOG_ERROR, "Mismatching number of samples in "
+ "a sequence: %d and %d\n", wc->samples, s->samples);
return AVERROR_INVALIDDATA;
}
@@ -1136,13 +1137,13 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
}
if (s->stereo_in) {
- samplecount = wv_unpack_stereo(s, &s->gb, samples_l, samples_r, avctx->sample_fmt);
- if (samplecount < 0)
- return samplecount;
+ ret = wv_unpack_stereo(s, &s->gb, samples_l, samples_r, avctx->sample_fmt);
+ if (ret < 0)
+ return ret;
} else {
- samplecount = wv_unpack_mono(s, &s->gb, samples_l, avctx->sample_fmt);
- if (samplecount < 0)
- return samplecount;
+ ret = wv_unpack_mono(s, &s->gb, samples_l, avctx->sample_fmt);
+ if (ret < 0)
+ return ret;
if (s->stereo)
memcpy(samples_r, samples_l, bpp * s->samples);
@@ -1150,7 +1151,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
*got_frame_ptr = 1;
- return samplecount * bpp;
+ return 0;
}
static void wavpack_decode_flush(AVCodecContext *avctx)
@@ -1170,7 +1171,6 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
int buf_size = avpkt->size;
AVFrame *frame = data;
int frame_size, ret, frame_flags;
- int samplecount = 0;
if (avpkt->size < 12 + s->multichannel * 4)
return AVERROR_INVALIDDATA;
@@ -1234,11 +1234,11 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
wavpack_decode_flush(avctx);
return AVERROR_INVALIDDATA;
}
- if ((samplecount = wavpack_decode_block(avctx, s->block,
- frame->extended_data, got_frame_ptr,
- buf, frame_size)) < 0) {
+ if ((ret = wavpack_decode_block(avctx, s->block,
+ frame->extended_data, got_frame_ptr,
+ buf, frame_size)) < 0) {
wavpack_decode_flush(avctx);
- return samplecount;
+ return ret;
}
s->block++;
buf += frame_size;