[FFmpeg-devel] [PATCH 7/8] libutvideodec: Check if the decode initializes correctly
Derek Buitenhuis
derek.buitenhuis at gmail.com
Mon Nov 7 18:20:28 CET 2011
Actually check the return value of DecodeBegin, to make
sure that it has encountered no errors.
Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
---
libavcodec/libutvideo.cpp | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/libavcodec/libutvideo.cpp b/libavcodec/libutvideo.cpp
index 2aab763..4887c9c 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 != sizeof(UtVideoExtra))
@@ -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;
}
--
1.7.7.1
More information about the ffmpeg-devel
mailing list