Mercurial > libavcodec.hg
annotate bmp.c @ 8203:3b90f93d97a6 libavcodec
Give more meaningful message on BMP header parsing error
| author | kostya |
|---|---|
| date | Mon, 24 Nov 2008 10:58:32 +0000 |
| parents | 5af44bd71254 |
| children | 507854688c43 |
| rev | line source |
|---|---|
| 2949 | 1 /* |
|
4415
f792b146869b
Segregate code common to BMP decoder and future encoder
diego
parents:
4394
diff
changeset
|
2 * BMP image format decoder |
| 2949 | 3 * Copyright (c) 2005 Mans Rullgard |
| 4 * | |
|
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
5 * This file is part of FFmpeg. |
|
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
6 * |
|
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
| 2949 | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | |
|
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
| 2949 | 11 * |
|
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
| 2949 | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 15 * Lesser General Public License for more details. | |
| 16 * | |
| 17 * You should have received a copy of the GNU Lesser General Public | |
|
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
|
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2967
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 2949 | 20 */ |
| 21 | |
| 22 #include "avcodec.h" | |
|
4439
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
23 #include "bytestream.h" |
|
4415
f792b146869b
Segregate code common to BMP decoder and future encoder
diego
parents:
4394
diff
changeset
|
24 #include "bmp.h" |
| 7910 | 25 #include "msrledec.h" |
| 2949 | 26 |
|
6517
48759bfbd073
Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents:
6265
diff
changeset
|
27 static av_cold int bmp_decode_init(AVCodecContext *avctx){ |
| 2949 | 28 BMPContext *s = avctx->priv_data; |
| 29 | |
| 30 avcodec_get_frame_defaults((AVFrame*)&s->picture); | |
| 31 avctx->coded_frame = (AVFrame*)&s->picture; | |
| 32 | |
| 33 return 0; | |
| 34 } | |
| 35 | |
| 2967 | 36 static int bmp_decode_frame(AVCodecContext *avctx, |
| 2949 | 37 void *data, int *data_size, |
| 6265 | 38 const uint8_t *buf, int buf_size) |
| 2949 | 39 { |
| 40 BMPContext *s = avctx->priv_data; | |
| 41 AVFrame *picture = data; | |
| 42 AVFrame *p = &s->picture; | |
| 43 unsigned int fsize, hsize; | |
| 44 int width, height; | |
| 45 unsigned int depth; | |
| 4393 | 46 BiCompression comp; |
| 2949 | 47 unsigned int ihsize; |
| 48 int i, j, n, linesize; | |
| 49 uint32_t rgb[3]; | |
| 50 uint8_t *ptr; | |
| 51 int dsize; | |
| 6265 | 52 const uint8_t *buf0 = buf; |
| 2949 | 53 |
| 54 if(buf_size < 14){ | |
| 55 av_log(avctx, AV_LOG_ERROR, "buf size too small (%d)\n", buf_size); | |
| 56 return -1; | |
| 57 } | |
| 58 | |
|
4439
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
59 if(bytestream_get_byte(&buf) != 'B' || |
|
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
60 bytestream_get_byte(&buf) != 'M') { |
| 2949 | 61 av_log(avctx, AV_LOG_ERROR, "bad magic number\n"); |
| 62 return -1; | |
| 63 } | |
| 64 | |
|
4439
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
65 fsize = bytestream_get_le32(&buf); |
| 2949 | 66 if(buf_size < fsize){ |
| 67 av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n", | |
| 68 buf_size, fsize); | |
| 69 return -1; | |
| 70 } | |
| 71 | |
|
4439
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
72 buf += 2; /* reserved1 */ |
|
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
73 buf += 2; /* reserved2 */ |
| 2949 | 74 |
|
4439
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
75 hsize = bytestream_get_le32(&buf); /* header size */ |
| 2949 | 76 if(fsize <= hsize){ |
|
8203
3b90f93d97a6
Give more meaningful message on BMP header parsing error
kostya
parents:
8202
diff
changeset
|
77 av_log(avctx, AV_LOG_ERROR, "declared file size is less than header size (%d < %d)\n", |
| 2949 | 78 fsize, hsize); |
| 79 return -1; | |
| 80 } | |
| 81 | |
|
4439
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
82 ihsize = bytestream_get_le32(&buf); /* more header size */ |
| 2949 | 83 if(ihsize + 14 > hsize){ |
| 84 av_log(avctx, AV_LOG_ERROR, "invalid header size %d\n", hsize); | |
| 85 return -1; | |
| 86 } | |
| 87 | |
| 8202 | 88 switch(ihsize){ |
| 89 case 40: // windib v3 | |
| 90 case 64: // OS/2 v2 | |
| 91 case 108: // windib v4 | |
| 92 case 124: // windib v5 | |
| 6595 | 93 width = bytestream_get_le32(&buf); |
| 94 height = bytestream_get_le32(&buf); | |
| 8202 | 95 break; |
| 96 case 12: // OS/2 v1 | |
| 6594 | 97 width = bytestream_get_le16(&buf); |
| 98 height = bytestream_get_le16(&buf); | |
| 8202 | 99 break; |
| 100 default: | |
| 7887 | 101 av_log(avctx, AV_LOG_ERROR, "unsupported BMP file, patch welcome\n"); |
| 6594 | 102 return -1; |
| 103 } | |
| 2949 | 104 |
|
4439
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
105 if(bytestream_get_le16(&buf) != 1){ /* planes */ |
| 2949 | 106 av_log(avctx, AV_LOG_ERROR, "invalid BMP header\n"); |
| 107 return -1; | |
| 108 } | |
| 109 | |
|
4439
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
110 depth = bytestream_get_le16(&buf); |
| 2949 | 111 |
| 6594 | 112 if(ihsize == 40) |
|
4439
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
113 comp = bytestream_get_le32(&buf); |
| 2949 | 114 else |
| 115 comp = BMP_RGB; | |
| 116 | |
| 7910 | 117 if(comp != BMP_RGB && comp != BMP_BITFIELDS && comp != BMP_RLE4 && comp != BMP_RLE8){ |
| 2949 | 118 av_log(avctx, AV_LOG_ERROR, "BMP coding %d not supported\n", comp); |
| 119 return -1; | |
| 120 } | |
| 121 | |
| 122 if(comp == BMP_BITFIELDS){ | |
|
4439
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
123 buf += 20; |
|
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
124 rgb[0] = bytestream_get_le32(&buf); |
|
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
125 rgb[1] = bytestream_get_le32(&buf); |
|
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
126 rgb[2] = bytestream_get_le32(&buf); |
| 2949 | 127 } |
| 128 | |
| 129 avctx->width = width; | |
| 130 avctx->height = height > 0? height: -height; | |
| 131 | |
| 132 avctx->pix_fmt = PIX_FMT_NONE; | |
| 133 | |
| 134 switch(depth){ | |
| 135 case 32: | |
| 136 if(comp == BMP_BITFIELDS){ | |
| 137 rgb[0] = (rgb[0] >> 15) & 3; | |
| 138 rgb[1] = (rgb[1] >> 15) & 3; | |
| 139 rgb[2] = (rgb[2] >> 15) & 3; | |
| 140 | |
| 141 if(rgb[0] + rgb[1] + rgb[2] != 3 || | |
| 142 rgb[0] == rgb[1] || rgb[0] == rgb[2] || rgb[1] == rgb[2]){ | |
| 143 break; | |
| 144 } | |
| 145 } else { | |
| 146 rgb[0] = 2; | |
| 147 rgb[1] = 1; | |
| 148 rgb[2] = 0; | |
| 149 } | |
| 150 | |
| 151 avctx->pix_fmt = PIX_FMT_BGR24; | |
| 152 break; | |
| 153 case 24: | |
| 154 avctx->pix_fmt = PIX_FMT_BGR24; | |
| 155 break; | |
| 156 case 16: | |
| 157 if(comp == BMP_RGB) | |
| 158 avctx->pix_fmt = PIX_FMT_RGB555; | |
|
7909
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
159 if(comp == BMP_BITFIELDS) |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
160 avctx->pix_fmt = rgb[1] == 0x07E0 ? PIX_FMT_RGB565 : PIX_FMT_RGB555; |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
161 break; |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
162 case 8: |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
163 if(hsize - ihsize - 14 > 0) |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
164 avctx->pix_fmt = PIX_FMT_PAL8; |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
165 else |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
166 avctx->pix_fmt = PIX_FMT_GRAY8; |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
167 break; |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
168 case 4: |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
169 if(hsize - ihsize - 14 > 0){ |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
170 avctx->pix_fmt = PIX_FMT_PAL8; |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
171 }else{ |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
172 av_log(avctx, AV_LOG_ERROR, "Unknown palette for 16-colour BMP\n"); |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
173 return -1; |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
174 } |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
175 break; |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
176 case 1: |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
177 avctx->pix_fmt = PIX_FMT_MONOBLACK; |
| 2949 | 178 break; |
| 179 default: | |
| 180 av_log(avctx, AV_LOG_ERROR, "depth %d not supported\n", depth); | |
| 181 return -1; | |
| 182 } | |
| 183 | |
| 184 if(avctx->pix_fmt == PIX_FMT_NONE){ | |
| 185 av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n"); | |
| 186 return -1; | |
| 187 } | |
| 188 | |
|
4432
a848b652f0ac
Fix segfault in bmp decoder. Patch by Michel Bardiaux mbardiaux mediaxim dot be.
takis
parents:
4415
diff
changeset
|
189 if(p->data[0]) |
|
a848b652f0ac
Fix segfault in bmp decoder. Patch by Michel Bardiaux mbardiaux mediaxim dot be.
takis
parents:
4415
diff
changeset
|
190 avctx->release_buffer(avctx, p); |
|
a848b652f0ac
Fix segfault in bmp decoder. Patch by Michel Bardiaux mbardiaux mediaxim dot be.
takis
parents:
4415
diff
changeset
|
191 |
| 2949 | 192 p->reference = 0; |
| 193 if(avctx->get_buffer(avctx, p) < 0){ | |
| 194 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); | |
| 195 return -1; | |
| 196 } | |
| 197 p->pict_type = FF_I_TYPE; | |
| 198 p->key_frame = 1; | |
| 199 | |
|
4439
3af19e140d67
Make BMP decoder use bytestream. Patch by Michel Bardiaux
takis
parents:
4432
diff
changeset
|
200 buf = buf0 + hsize; |
| 2949 | 201 dsize = buf_size - hsize; |
| 202 | |
| 4109 | 203 /* Line size in file multiple of 4 */ |
| 7908 | 204 n = ((avctx->width * depth) / 8 + 3) & ~3; |
| 2949 | 205 |
| 7910 | 206 if(n * avctx->height > dsize && comp != BMP_RLE4 && comp != BMP_RLE8){ |
| 2949 | 207 av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n", |
| 208 dsize, n * avctx->height); | |
| 209 return -1; | |
| 210 } | |
| 211 | |
| 7910 | 212 // RLE may skip decoding some picture areas, so blank picture before decoding |
| 213 if(comp == BMP_RLE4 || comp == BMP_RLE8) | |
| 214 memset(p->data[0], 0, avctx->height * p->linesize[0]); | |
| 215 | |
|
7909
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
216 if(depth == 4 || depth == 8) |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
217 memset(p->data[1], 0, 1024); |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
218 |
| 2949 | 219 if(height > 0){ |
| 220 ptr = p->data[0] + (avctx->height - 1) * p->linesize[0]; | |
| 221 linesize = -p->linesize[0]; | |
| 222 } else { | |
| 223 ptr = p->data[0]; | |
| 224 linesize = p->linesize[0]; | |
| 225 } | |
| 226 | |
|
7909
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
227 if(avctx->pix_fmt == PIX_FMT_PAL8){ |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
228 buf = buf0 + 14 + ihsize; //palette location |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
229 if((hsize-ihsize-14)>>depth < 4){ // OS/2 bitmap, 3 bytes per palette entry |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
230 for(i = 0; i < (1 << depth); i++) |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
231 ((uint32_t*)p->data[1])[i] = bytestream_get_le24(&buf); |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
232 }else{ |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
233 for(i = 0; i < (1 << depth); i++) |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
234 ((uint32_t*)p->data[1])[i] = bytestream_get_le32(&buf); |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
235 } |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
236 buf = buf0 + hsize; |
|
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
237 } |
| 7910 | 238 if(comp == BMP_RLE4 || comp == BMP_RLE8){ |
| 239 ff_msrle_decode(avctx, p, depth, buf, dsize); | |
| 240 }else{ | |
| 7911 | 241 switch(depth){ |
| 242 case 1: | |
| 243 for(i = 0; i < avctx->height; i++){ | |
| 244 memcpy(ptr, buf, n); | |
| 245 buf += n; | |
| 246 ptr += linesize; | |
| 247 } | |
| 248 break; | |
| 249 case 4: | |
| 250 for(i = 0; i < avctx->height; i++){ | |
| 251 int j; | |
| 252 for(j = 0; j < n; j++){ | |
| 253 ptr[j*2+0] = (buf[j] >> 4) & 0xF; | |
| 254 ptr[j*2+1] = buf[j] & 0xF; | |
| 255 } | |
| 256 buf += n; | |
| 257 ptr += linesize; | |
| 258 } | |
| 259 break; | |
| 260 case 8: | |
| 261 for(i = 0; i < avctx->height; i++){ | |
| 262 memcpy(ptr, buf, avctx->width); | |
| 263 buf += n; | |
| 264 ptr += linesize; | |
| 265 } | |
| 266 break; | |
| 267 case 24: | |
| 268 for(i = 0; i < avctx->height; i++){ | |
| 269 memcpy(ptr, buf, avctx->width*(depth>>3)); | |
| 270 buf += n; | |
| 271 ptr += linesize; | |
|
7909
9fd3f57e4c16
Add support for 1-bit, 4-bit, 8-bit and some 16-bit raw BMP
kostya
parents:
7908
diff
changeset
|
272 } |
| 7911 | 273 break; |
| 274 case 16: | |
| 275 for(i = 0; i < avctx->height; i++){ | |
| 276 const uint16_t *src = (const uint16_t *) buf; | |
| 277 uint16_t *dst = (uint16_t *) ptr; | |
| 278 | |
| 279 for(j = 0; j < avctx->width; j++) | |
| 280 *dst++ = le2me_16(*src++); | |
| 281 | |
| 282 buf += n; | |
| 283 ptr += linesize; | |
| 284 } | |
| 285 break; | |
| 286 case 32: | |
| 287 for(i = 0; i < avctx->height; i++){ | |
| 288 const uint8_t *src = buf; | |
| 289 uint8_t *dst = ptr; | |
| 290 | |
| 291 for(j = 0; j < avctx->width; j++){ | |
| 292 dst[0] = src[rgb[2]]; | |
| 293 dst[1] = src[rgb[1]]; | |
| 294 dst[2] = src[rgb[0]]; | |
| 295 dst += 3; | |
| 296 src += 4; | |
| 297 } | |
| 298 | |
| 299 buf += n; | |
| 300 ptr += linesize; | |
| 301 } | |
| 302 break; | |
| 303 default: | |
| 304 av_log(avctx, AV_LOG_ERROR, "BMP decoder is broken\n"); | |
| 305 return -1; | |
| 2949 | 306 } |
| 7910 | 307 } |
| 2949 | 308 |
| 309 *picture = s->picture; | |
| 310 *data_size = sizeof(AVPicture); | |
| 311 | |
| 312 return buf_size; | |
| 313 } | |
| 314 | |
|
6517
48759bfbd073
Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents:
6265
diff
changeset
|
315 static av_cold int bmp_decode_end(AVCodecContext *avctx) |
|
4455
8ecfb7ecbb53
Add decode_end method to bmp decoder. Patch by Michel Bardiaux,
takis
parents:
4445
diff
changeset
|
316 { |
|
8ecfb7ecbb53
Add decode_end method to bmp decoder. Patch by Michel Bardiaux,
takis
parents:
4445
diff
changeset
|
317 BMPContext* c = avctx->priv_data; |
|
8ecfb7ecbb53
Add decode_end method to bmp decoder. Patch by Michel Bardiaux,
takis
parents:
4445
diff
changeset
|
318 |
|
8ecfb7ecbb53
Add decode_end method to bmp decoder. Patch by Michel Bardiaux,
takis
parents:
4445
diff
changeset
|
319 if (c->picture.data[0]) |
|
8ecfb7ecbb53
Add decode_end method to bmp decoder. Patch by Michel Bardiaux,
takis
parents:
4445
diff
changeset
|
320 avctx->release_buffer(avctx, &c->picture); |
|
8ecfb7ecbb53
Add decode_end method to bmp decoder. Patch by Michel Bardiaux,
takis
parents:
4445
diff
changeset
|
321 |
|
8ecfb7ecbb53
Add decode_end method to bmp decoder. Patch by Michel Bardiaux,
takis
parents:
4445
diff
changeset
|
322 return 0; |
|
8ecfb7ecbb53
Add decode_end method to bmp decoder. Patch by Michel Bardiaux,
takis
parents:
4445
diff
changeset
|
323 } |
|
8ecfb7ecbb53
Add decode_end method to bmp decoder. Patch by Michel Bardiaux,
takis
parents:
4445
diff
changeset
|
324 |
| 2949 | 325 AVCodec bmp_decoder = { |
| 326 "bmp", | |
| 327 CODEC_TYPE_VIDEO, | |
| 328 CODEC_ID_BMP, | |
| 329 sizeof(BMPContext), | |
| 330 bmp_decode_init, | |
| 331 NULL, | |
|
4455
8ecfb7ecbb53
Add decode_end method to bmp decoder. Patch by Michel Bardiaux,
takis
parents:
4445
diff
changeset
|
332 bmp_decode_end, |
| 6722 | 333 bmp_decode_frame, |
|
7040
e943e1409077
Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents:
6722
diff
changeset
|
334 .long_name = NULL_IF_CONFIG_SMALL("BMP image"), |
| 2949 | 335 }; |
