diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-20 18:31:55 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-20 18:41:43 +0200 |
commit | a4c7aeaf82decc6a0d72b8d4447932363daa65a2 (patch) | |
tree | f3f90e97b8caff7f40bf93e408539ba4ded6cce4 /libavcodec/vmnc.c | |
parent | 6d1935d1b91c708619fe0b31eeed9c8d29378a4b (diff) | |
parent | eafbc6716cede6d4a652f8bedf82f2901c68d06d (diff) | |
download | ffmpeg-a4c7aeaf82decc6a0d72b8d4447932363daa65a2.tar.gz |
Merge commit 'eafbc6716cede6d4a652f8bedf82f2901c68d06d'
* commit 'eafbc6716cede6d4a652f8bedf82f2901c68d06d':
vmnc: Delay pixel size check
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vmnc.c')
-rw-r--r-- | libavcodec/vmnc.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c index aef3df37a9..4bdc2ddfa0 100644 --- a/libavcodec/vmnc.c +++ b/libavcodec/vmnc.c @@ -432,10 +432,18 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, c->pic->pict_type = AV_PICTURE_TYPE_I; depth = bytestream2_get_byte(gb); if (depth != c->bpp) { - av_log(avctx, AV_LOG_INFO, - "Depth mismatch. Container %i bpp, " - "Frame data: %i bpp\n", - c->bpp, depth); + av_log(avctx, AV_LOG_WARNING, "Depth mismatch. " + "Container %i bpp / Codec %i bpp\n", c->bpp, depth); + + if (depth != 8 && depth != 16 && depth != 32) { + av_log(avctx, AV_LOG_ERROR, + "Unsupported codec bitdepth %i\n", depth); + return AVERROR_INVALIDDATA; + } + + /* reset values */ + c->bpp = depth; + c->bpp2 = c->bpp / 8; } bytestream2_skip(gb, 1); c->bigendian = bytestream2_get_byte(gb); @@ -537,6 +545,9 @@ static av_cold int decode_init(AVCodecContext *avctx) case 16: avctx->pix_fmt = AV_PIX_FMT_RGB555; break; + case 24: + /* 24 bits is not technically supported, but some clients might + * mistakenly set it -- delay the actual check until decode_frame() */ case 32: avctx->pix_fmt = AV_PIX_FMT_0RGB32; break; |