summaryrefslogtreecommitdiff
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2009-09-30 05:49:18 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2009-09-30 05:49:18 +0000
commit53f9f9c91b1aecd5c5ce375bcc07806c33ff74d5 (patch)
tree297dc884a7befccef903127ad6a10d96077caadb /libavcodec/tiff.c
parent2ed4439658971fd238c02102bd24906aad4caf6b (diff)
When BitsPerSample tag is not present in TIFF, that means file is
monochrome, so initialize picture before decoding. This fixes decoding monochrome files produced by lavc TIFF encoder. Originally committed as revision 20091 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 39a11f7c2c..27dd464f43 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -498,8 +498,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");