]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/exr.c
g723.1dec: Make postfilter user switchable
[ffmpeg] / libavcodec / exr.c
index f175706a3d5c0cdda5e007b9e84bd26e0d324ac6..b5c68de8d400fe324ceccb9975d7f7b2bdd13a18 100644 (file)
@@ -403,19 +403,10 @@ static int decode_frame(AVCodecContext *avctx,
             if (!variable_buffer_data_size)
                 return AVERROR_INVALIDDATA;
 
-            s->compr = *buf;
-            switch (s->compr) {
-            case EXR_RAW:
-            case EXR_RLE:
-            case EXR_ZIP1:
-            case EXR_ZIP16:
-                break;
-            case EXR_PIZ:
-            case EXR_B44:
-            default:
-                av_log(avctx, AV_LOG_ERROR, "Compression type %d is not supported\n", s->compr);
-                return AVERROR_PATCHWELCOME;
-            }
+            if (s->compr == -1)
+                s->compr = *buf;
+            else
+                av_log(avctx, AV_LOG_WARNING, "Found more than one compression attribute\n");
 
             buf += variable_buffer_data_size;
             continue;
@@ -446,6 +437,11 @@ static int decode_frame(AVCodecContext *avctx,
         }
     }
 
+    if (s->compr == -1) {
+        av_log(avctx, AV_LOG_ERROR, "Missing compression attribute\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     if (buf >= buf_end) {
         av_log(avctx, AV_LOG_ERROR, "Incomplete frame\n");
         return AVERROR_INVALIDDATA;
@@ -478,6 +474,9 @@ static int decode_frame(AVCodecContext *avctx,
     case EXR_ZIP16:
         scan_lines_per_block = 16;
         break;
+    default:
+        av_log(avctx, AV_LOG_ERROR, "Compression type %d is not supported\n", s->compr);
+        return AVERROR_PATCHWELCOME;
     }
 
     if (s->picture.data[0])
@@ -642,6 +641,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
     avcodec_get_frame_defaults(&s->picture);
     avctx->coded_frame = &s->picture;
 
+    s->compr = -1;
+
     return 0;
 }