summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-09-27 11:49:50 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-10-27 22:06:32 -0400
commitdac15a03afca88dc5abe65cbe4782d32d1b74184 (patch)
tree5b7d943749e2597a28b7163d1f43888d943ee3f2 /libavcodec/mpegaudiodec.c
parent4be1e1dfa7233380171da98586c42505a26655d1 (diff)
mpegaudiodec: return AVERROR return codes instead of -1
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index 004048ce93..a731a292b4 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1486,7 +1486,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
g->big_values = get_bits(&s->gb, 9);
if(g->big_values > 288){
av_log(s->avctx, AV_LOG_ERROR, "big_values too big\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
g->global_gain = get_bits(&s->gb, 8);
@@ -1504,7 +1504,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
g->block_type = get_bits(&s->gb, 2);
if (g->block_type == 0){
av_log(s->avctx, AV_LOG_ERROR, "invalid block type\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
g->switch_point = get_bits1(&s->gb);
for(i=0;i<2;i++)
@@ -1782,18 +1782,18 @@ static int decode_frame(AVCodecContext * avctx,
OUT_INT *out_samples = data;
if(buf_size < HEADER_SIZE)
- return -1;
+ return AVERROR_INVALIDDATA;
header = AV_RB32(buf);
if(ff_mpa_check_header(header) < 0){
av_log(avctx, AV_LOG_ERROR, "Header missing\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (avpriv_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) {
/* free format: prepare to compute frame size */
s->frame_size = -1;
- return -1;
+ return AVERROR_INVALIDDATA;
}
/* update codec info */
avctx->channels = s->nb_channels;
@@ -1803,12 +1803,12 @@ static int decode_frame(AVCodecContext * avctx,
avctx->sub_id = s->layer;
if(*data_size < 1152*avctx->channels*sizeof(OUT_INT))
- return -1;
+ return AVERROR(EINVAL);
*data_size = 0;
if(s->frame_size<=0 || s->frame_size > buf_size){
av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}else if(s->frame_size < buf_size){
av_log(avctx, AV_LOG_ERROR, "incorrect frame size\n");
buf_size= s->frame_size;
@@ -1954,13 +1954,13 @@ static int decode_init_mp3on4(AVCodecContext * avctx)
if ((avctx->extradata_size < 2) || (avctx->extradata == NULL)) {
av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
avpriv_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size);
if (!cfg.chan_config || cfg.chan_config > 7) {
av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
s->frames = mp3Frames[cfg.chan_config];
s->coff = chan_offset[cfg.chan_config];
@@ -2050,7 +2050,7 @@ static int decode_frame_mp3on4(AVCodecContext * avctx,
*data_size = 0;
// Discard too short frames
if (buf_size < HEADER_SIZE)
- return -1;
+ return AVERROR_INVALIDDATA;
// If only one decoder interleave is not needed
outptr = s->frames == 1 ? out_samples : s->decoded_buf;