Browse code

apedec: return meaningful error codes from ape_decode_init()

Justin Ruggles authored on 2011/10/12 00:48:39
Showing 1 changed files
... ...
@@ -182,15 +182,15 @@ static av_cold int ape_decode_init(AVCodecContext * avctx)
182 182
 
183 183
     if (avctx->extradata_size != 6) {
184 184
         av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n");
185
-        return -1;
185
+        return AVERROR(EINVAL);
186 186
     }
187 187
     if (avctx->bits_per_coded_sample != 16) {
188 188
         av_log(avctx, AV_LOG_ERROR, "Only 16-bit samples are supported\n");
189
-        return -1;
189
+        return AVERROR(EINVAL);
190 190
     }
191 191
     if (avctx->channels > 2) {
192 192
         av_log(avctx, AV_LOG_ERROR, "Only mono and stereo is supported\n");
193
-        return -1;
193
+        return AVERROR(EINVAL);
194 194
     }
195 195
     s->avctx             = avctx;
196 196
     s->channels          = avctx->channels;
... ...
@@ -201,7 +201,7 @@ static av_cold int ape_decode_init(AVCodecContext * avctx)
201 201
     av_log(avctx, AV_LOG_DEBUG, "Compression Level: %d - Flags: %d\n", s->compression_level, s->flags);
202 202
     if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE) {
203 203
         av_log(avctx, AV_LOG_ERROR, "Incorrect compression level %d\n", s->compression_level);
204
-        return -1;
204
+        return AVERROR_INVALIDDATA;
205 205
     }
206 206
     s->fset = s->compression_level / 1000 - 1;
207 207
     for (i = 0; i < APE_FILTER_LEVELS; i++) {