Commit 2dd7b461 authored by Martin Vignali's avatar Martin Vignali Committed by Paul B Mahol

avcodec/exr: fix channel detection

parent 7e1e25c2
...@@ -1382,15 +1382,17 @@ static int decode_header(EXRContext *s) ...@@ -1382,15 +1382,17 @@ static int decode_header(EXRContext *s)
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
} }
if (channel_index >= 0) { if (s->channel_offsets[channel_index] == -1){/* channel have not been previously assign */
if (s->pixel_type != EXR_UNKNOWN && if (channel_index >= 0) {
s->pixel_type != current_pixel_type) { if (s->pixel_type != EXR_UNKNOWN &&
av_log(s->avctx, AV_LOG_ERROR, s->pixel_type != current_pixel_type) {
"RGB channels not of the same depth.\n"); av_log(s->avctx, AV_LOG_ERROR,
return AVERROR_INVALIDDATA; "RGB channels not of the same depth.\n");
return AVERROR_INVALIDDATA;
}
s->pixel_type = current_pixel_type;
s->channel_offsets[channel_index] = s->current_channel_offset;
} }
s->pixel_type = current_pixel_type;
s->channel_offsets[channel_index] = s->current_channel_offset;
} }
s->channels = av_realloc(s->channels, s->channels = av_realloc(s->channels,
......
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