Mercurial > libavcodec.hg
comparison qpeg.c @ 9918:de14016e0b2d libavcodec
Check that palctrl is available on init instead of crashing when trying to use
it on decode.
Fixes mpeg2/smclockmpeg2.avi.2.1 from issue 1240.
author | reimar |
---|---|
date | Sun, 05 Jul 2009 12:14:05 +0000 |
parents | 4cab394c16ea |
children | 8a4984c5cacc |
comparison
equal
deleted
inserted
replaced
9917:2e8083f6524e | 9918:de14016e0b2d |
---|---|
287 } | 287 } |
288 | 288 |
289 static av_cold int decode_init(AVCodecContext *avctx){ | 289 static av_cold int decode_init(AVCodecContext *avctx){ |
290 QpegContext * const a = avctx->priv_data; | 290 QpegContext * const a = avctx->priv_data; |
291 | 291 |
292 if (!avctx->palctrl) { | |
293 av_log(avctx, AV_LOG_FATAL, "Missing required palette via palctrl\n"); | |
294 return -1; | |
295 } | |
292 a->avctx = avctx; | 296 a->avctx = avctx; |
293 avctx->pix_fmt= PIX_FMT_PAL8; | 297 avctx->pix_fmt= PIX_FMT_PAL8; |
294 a->refdata = av_malloc(avctx->width * avctx->height); | 298 a->refdata = av_malloc(avctx->width * avctx->height); |
295 | 299 |
296 return 0; | 300 return 0; |