summaryrefslogtreecommitdiff
path: root/libavcodec/wavpack.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-19 10:22:05 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-19 10:22:05 +0200
commit2ad415cfa42069cad92803f2bc047b4311aa3c70 (patch)
tree7c5664036d165ff9ae8654dff909edc4be20201a /libavcodec/wavpack.c
parent02788d2ac5dfffd0ce862adea953e73466ee7018 (diff)
parent8c34558131d846d2b10389564caadaa206372fd4 (diff)
Merge commit '8c34558131d846d2b10389564caadaa206372fd4'
* commit '8c34558131d846d2b10389564caadaa206372fd4': wavpack: return meaningful errors Conflicts: libavcodec/wavpack.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/wavpack.c')
-rw-r--r--libavcodec/wavpack.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 7c72dd56b3..c618537309 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -783,14 +783,14 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
if (block_no >= wc->fdec_num && wv_alloc_frame_context(wc) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error creating frame decode context\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
s = wc->fdec[block_no];
if (!s) {
av_log(avctx, AV_LOG_ERROR, "Context for block %d is not present\n",
block_no);
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (wc->ch_offset >= avctx->channels) {
@@ -1055,7 +1055,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
if (size <= 1) {
av_log(avctx, AV_LOG_ERROR,
"Insufficient channel information\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
chan = *buf++;
switch (size - 2) {
@@ -1086,7 +1086,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
"Block reports total %d channels, "
"decoder believes it's %d channels\n",
chan, avctx->channels);
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (!avctx->channel_layout)
avctx->channel_layout = chmask;
@@ -1101,31 +1101,31 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
if (!got_terms) {
av_log(avctx, AV_LOG_ERROR, "No block with decorrelation terms\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (!got_weights) {
av_log(avctx, AV_LOG_ERROR, "No block with decorrelation weights\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (!got_samples) {
av_log(avctx, AV_LOG_ERROR, "No block with decorrelation samples\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (!got_entropy) {
av_log(avctx, AV_LOG_ERROR, "No block with entropy info\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (s->hybrid && !got_hybrid) {
av_log(avctx, AV_LOG_ERROR, "Hybrid config not found\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (!got_bs) {
av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (!got_float && avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
av_log(avctx, AV_LOG_ERROR, "Float information not found\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (s->got_extra_bits && avctx->sample_fmt != AV_SAMPLE_FMT_FLT) {
const int size = get_bits_left(&s->gb_extra_bits);
@@ -1145,7 +1145,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_FLT);
if (samplecount < 0)
- return -1;
+ return samplecount;
samplecount >>= 1;
} else {
@@ -1159,7 +1159,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_FLT);
if (samplecount < 0)
- return -1;
+ return samplecount;
if (s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S16) {
int16_t *dst = (int16_t *)samples + 1;
@@ -1235,7 +1235,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
if (s->samples <= 0 || s->samples > WV_MAX_SAMPLES) {
av_log(avctx, AV_LOG_ERROR, "Invalid number of samples: %d\n",
s->samples);
- return AVERROR(EINVAL);
+ return AVERROR_INVALIDDATA;
}
if (frame_flags & 0x80) {
@@ -1278,7 +1278,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
frame->data[0], got_frame_ptr,
buf, frame_size)) < 0) {
wavpack_decode_flush(avctx);
- return AVERROR_INVALIDDATA;
+ return samplecount;
}
s->block++;
buf += frame_size;