[FFmpeg-cvslog] apedec: return meaningful error codes from ape_decode_init()

Justin Ruggles git at videolan.org
Sat Oct 29 02:31:36 CEST 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Tue Oct 11 11:48:39 2011 -0400| [f64e0a2f379c1297dc9b1744999e29ab84646261] | committer: Justin Ruggles

apedec: return meaningful error codes from ape_decode_init()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f64e0a2f379c1297dc9b1744999e29ab84646261
---

 libavcodec/apedec.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 031dee4..847b4ad 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -182,15 +182,15 @@ static av_cold int ape_decode_init(AVCodecContext * avctx)
 
     if (avctx->extradata_size != 6) {
         av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n");
-        return -1;
+        return AVERROR(EINVAL);
     }
     if (avctx->bits_per_coded_sample != 16) {
         av_log(avctx, AV_LOG_ERROR, "Only 16-bit samples are supported\n");
-        return -1;
+        return AVERROR(EINVAL);
     }
     if (avctx->channels > 2) {
         av_log(avctx, AV_LOG_ERROR, "Only mono and stereo is supported\n");
-        return -1;
+        return AVERROR(EINVAL);
     }
     s->avctx             = avctx;
     s->channels          = avctx->channels;
@@ -201,7 +201,7 @@ static av_cold int ape_decode_init(AVCodecContext * avctx)
     av_log(avctx, AV_LOG_DEBUG, "Compression Level: %d - Flags: %d\n", s->compression_level, s->flags);
     if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE) {
         av_log(avctx, AV_LOG_ERROR, "Incorrect compression level %d\n", s->compression_level);
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
     s->fset = s->compression_level / 1000 - 1;
     for (i = 0; i < APE_FILTER_LEVELS; i++) {



More information about the ffmpeg-cvslog mailing list