[FFmpeg-cvslog] avcodec/exr: fix channel detection

Martin Vignali git at videolan.org
Sun Apr 10 19:25:37 CEST 2016


ffmpeg | branch: master | Martin Vignali <martin.vignali at gmail.com> | Thu Apr  7 11:17:18 2016 +0200| [2dd7b46132e2801ef34fe1b5c27e0113cdcfa2f9] | committer: Paul B Mahol

avcodec/exr: fix channel detection

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2dd7b46132e2801ef34fe1b5c27e0113cdcfa2f9
---

 libavcodec/exr.c |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 2763126..9dd2ee9 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1382,15 +1382,17 @@ static int decode_header(EXRContext *s)
                     return AVERROR_PATCHWELCOME;
                 }
 
-                if (channel_index >= 0) {
-                    if (s->pixel_type != EXR_UNKNOWN &&
-                        s->pixel_type != current_pixel_type) {
-                        av_log(s->avctx, AV_LOG_ERROR,
-                               "RGB channels not of the same depth.\n");
-                        return AVERROR_INVALIDDATA;
+                if (s->channel_offsets[channel_index] == -1){/* channel have not been previously assign */
+                    if (channel_index >= 0) {
+                        if (s->pixel_type != EXR_UNKNOWN &&
+                            s->pixel_type != current_pixel_type) {
+                            av_log(s->avctx, AV_LOG_ERROR,
+                                   "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,



More information about the ffmpeg-cvslog mailing list