Commit 8288c2b6 authored by Paul B Mahol's avatar Paul B Mahol

pngdec: read sample aspect ratio

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 2a56e65c
...@@ -467,6 +467,18 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -467,6 +467,18 @@ static int decode_frame(AVCodecContext *avctx,
s->width, s->height, s->bit_depth, s->color_type, s->width, s->height, s->bit_depth, s->color_type,
s->compression_type, s->filter_type, s->interlace_type); s->compression_type, s->filter_type, s->interlace_type);
break; break;
case MKTAG('p', 'H', 'Y', 's'):
if (s->state & PNG_IDAT) {
av_log(avctx, AV_LOG_ERROR, "pHYs after IDAT\n");
goto fail;
}
avctx->sample_aspect_ratio.num = bytestream2_get_be32(&s->gb);
avctx->sample_aspect_ratio.den = bytestream2_get_be32(&s->gb);
if (avctx->sample_aspect_ratio.num < 0 || avctx->sample_aspect_ratio.den < 0)
avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
bytestream2_skip(&s->gb, 1); /* unit specifier */
bytestream2_skip(&s->gb, 4); /* crc */
break;
case MKTAG('I', 'D', 'A', 'T'): case MKTAG('I', 'D', 'A', 'T'):
if (!(s->state & PNG_IHDR)) { if (!(s->state & PNG_IHDR)) {
av_log(avctx, AV_LOG_ERROR, "IDAT without IHDR\n"); av_log(avctx, AV_LOG_ERROR, "IDAT without IHDR\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment