summaryrefslogtreecommitdiff
path: root/libavcodec/libutvideo.cpp
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2011-11-07 12:02:30 -0500
committerMichael Niedermayer <michaelni@gmx.at>2011-11-07 21:51:38 +0100
commit159609512c163c512827a5d41b2553f1dd9f2abc (patch)
tree1f2003a3f0ea987d43daad5fca747a4e980e4b3b /libavcodec/libutvideo.cpp
parent61d303c780d3835ab0f5f96545b5408f03536bd7 (diff)
libutvideodec: Check if the decode initializes correctly
Actually check the return value of DecodeBegin, to make sure that it has encountered no errors. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libutvideo.cpp')
-rw-r--r--libavcodec/libutvideo.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/libutvideo.cpp b/libavcodec/libutvideo.cpp
index 10c47c2861..7e770a7630 100644
--- a/libavcodec/libutvideo.cpp
+++ b/libavcodec/libutvideo.cpp
@@ -51,6 +51,7 @@ static av_cold int utvideo_decode_init(AVCodecContext *avctx)
UtVideoContext *utv = (UtVideoContext *)avctx->priv_data;
UtVideoExtra info;
int format;
+ int begin_ret;
unsigned int buf_size;
if(avctx->extradata_size != 4*4)
@@ -119,9 +120,17 @@ static av_cold int utvideo_decode_init(AVCodecContext *avctx)
utv->codec = CCodec::CreateInstance(UNFCC(avctx->codec_tag), "libavcodec");
/* Initialize Decoding */
- utv->codec->DecodeBegin(format, avctx->width, avctx->height,
+ begin_ret = utv->codec->DecodeBegin(format, avctx->width, avctx->height,
CBGROSSWIDTH_WINDOWS, &info, sizeof(UtVideoExtra));
+ /* Check to see if the decoder initlized properly */
+ if(begin_ret != 0)
+ {
+ av_log(avctx, AV_LOG_ERROR,
+ "Could not initialize decoder: %d\n", begin_ret);
+ return -1;
+ }
+
return 0;
}