avcodec/assenc: Return more specific error codes for ass_encode_frame()
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 31 Dec 2018 17:34:14 +0000 (18:34 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 1 Jan 2019 20:11:47 +0000 (21:11 +0100)
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/assenc.c

index dc4f0ff..e54c1d8 100644 (file)
@@ -57,7 +57,7 @@ static int ass_encode_frame(AVCodecContext *avctx,
 
         if (sub->rects[i]->type != SUBTITLE_ASS) {
             av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n");
-            return -1;
+            return AVERROR(EINVAL);
         }
 
 #if FF_API_ASS_TIMING
@@ -93,7 +93,7 @@ static int ass_encode_frame(AVCodecContext *avctx,
 
         if (len > bufsize-total_len-1) {
             av_log(avctx, AV_LOG_ERROR, "Buffer too small for ASS event.\n");
-            return -1;
+            return AVERROR(EINVAL);
         }
 
         total_len += len;