summaryrefslogtreecommitdiff
path: root/libavcodec/pnm.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/pnm.c')
-rw-r--r--libavcodec/pnm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index ba169d1473..4843d14653 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -138,8 +138,11 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s){
avctx->pix_fmt = PIX_FMT_GRAY16BE;
if (s->maxval != 65535)
avctx->pix_fmt = PIX_FMT_GRAY16;
+ } if (avctx->pix_fmt == PIX_FMT_RGB24) {
+ if (s->maxval > 255)
+ avctx->pix_fmt = PIX_FMT_RGB48BE;
} else {
- av_log(avctx, AV_LOG_ERROR, "16-bit components are only supported for grayscale\n");
+ av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format\n");
avctx->pix_fmt = PIX_FMT_NONE;
return -1;
}