]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/tiff.c
Add missing release_buffer on close
[ffmpeg] / libavcodec / tiff.c
index 39a11f7c2c43cc7a7f974cc1e9227a9107dc4443..8818a665307e34b5ccd1528781ce2965a1fd11a3 100644 (file)
@@ -139,6 +139,11 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
             av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");
             return -1;
         }
+        if(s->fax_opts & 2){
+            av_log(s->avctx, AV_LOG_ERROR, "Uncompressed fax mode is not supported (yet)\n");
+            av_free(src2);
+            return -1;
+        }
         if(!s->fill_order){
             memcpy(src2, src, size);
         }else{
@@ -498,8 +503,19 @@ static int decode_frame(AVCodecContext *avctx,
     }
     /* now we have the data and may start decoding */
     if(!p->data[0]){
-        av_log(s->avctx, AV_LOG_ERROR, "Picture initialization missing\n");
-        return -1;
+        s->bpp = 1;
+        avctx->pix_fmt = PIX_FMT_MONOBLACK;
+        if(s->width != s->avctx->width || s->height != s->avctx->height){
+            if(avcodec_check_dimensions(s->avctx, s->width, s->height))
+                return -1;
+            avcodec_set_dimensions(s->avctx, s->width, s->height);
+        }
+        if(s->picture.data[0])
+            s->avctx->release_buffer(s->avctx, &s->picture);
+        if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){
+            av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+            return -1;
+        }
     }
     if(s->strips == 1 && !s->stripsize){
         av_log(avctx, AV_LOG_WARNING, "Image data size missing\n");