aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2012-02-13 21:14:19 +0100
committerReinhard Tartler <siretart@tauware.de>2013-01-04 07:43:21 +0100
commit99008ba3667a28af5efe0934aa20aa37df8dbd86 (patch)
tree75ff0941d9eb51877eb12152b4552e3e53a41681
parenta81c1ea2eb6621995bdab5e7b7ebdab020fbff5a (diff)
downloadffmpeg-99008ba3667a28af5efe0934aa20aa37df8dbd86.tar.gz
rv34: use AVERROR return values in ff_rv34_decode_frame()
Also adds an error message. (cherry picked from commit 29330721b0e8514f9f8b4d54be75a662a2b79e44) Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavcodec/rv34.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index cc1cae2616..a20a9892b8 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1444,15 +1444,20 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
if(get_slice_offset(avctx, slices_hdr, 0) < 0 ||
get_slice_offset(avctx, slices_hdr, 0) > buf_size){
av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), (buf_size-get_slice_offset(avctx, slices_hdr, 0))*8);
if(r->parse_slice_header(r, &r->s.gb, &si) < 0 || si.start){
av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
- if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == AV_PICTURE_TYPE_B)
- return -1;
+ if ((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) &&
+ si.type == AV_PICTURE_TYPE_B) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid decoder state: B-frame without "
+ "reference data.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==AV_PICTURE_TYPE_B)
|| (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=AV_PICTURE_TYPE_I)
|| avctx->skip_frame >= AVDISCARD_ALL)