aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-02-15 17:37:25 +0100
committerPaul B Mahol <onemda@gmail.com>2021-02-15 17:39:35 +0100
commit5f0e3b549a26d7dae66dcaf278dd4abf0ba69b07 (patch)
tree2d7bb20919729b2f06a9ca42b3501377dde1e68d
parent98191135e03afe1de566c9d6a0eb3e3f9010cade (diff)
downloadffmpeg-5f0e3b549a26d7dae66dcaf278dd4abf0ba69b07.tar.gz
avcodec/exr: unbreak parsing sample aspect ratio
-rw-r--r--libavcodec/exr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index ef14bfd69a..d94291ce73 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -134,6 +134,7 @@ typedef struct EXRContext {
const AVPixFmtDescriptor *desc;
int w, h;
+ uint32_t sar;
int32_t xmax, xmin;
int32_t ymax, ymin;
uint32_t xdelta, ydelta;
@@ -1309,7 +1310,7 @@ static int check_header_variable(EXRContext *s,
static int decode_header(EXRContext *s, AVFrame *frame)
{
AVDictionary *metadata = NULL;
- int magic_number, version, i, flags, sar = 0;
+ int magic_number, version, i, flags;
int layer_match = 0;
int ret;
int dup_channels = 0;
@@ -1580,7 +1581,7 @@ static int decode_header(EXRContext *s, AVFrame *frame)
goto fail;
}
- sar = bytestream2_get_le32(&s->gb);
+ s->sar = bytestream2_get_le32(&s->gb);
continue;
} else if ((var_size = check_header_variable(s, "compression",
@@ -1663,8 +1664,6 @@ static int decode_header(EXRContext *s, AVFrame *frame)
bytestream2_skip(&s->gb, bytestream2_get_le32(&s->gb));
}
- ff_set_sar(s->avctx, av_d2q(av_int2float(sar), 255));
-
if (s->compression == EXR_UNKN) {
av_log(s->avctx, AV_LOG_ERROR, "Missing compression attribute.\n");
ret = AVERROR_INVALIDDATA;
@@ -1788,6 +1787,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
if ((ret = ff_set_dimensions(avctx, s->w, s->h)) < 0)
return ret;
+ ff_set_sar(s->avctx, av_d2q(av_int2float(s->sar), 255));
+
s->desc = av_pix_fmt_desc_get(avctx->pix_fmt);
if (!s->desc)
return AVERROR_INVALIDDATA;