Originally committed as revision 26091 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -570,17 +570,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 570 | 570 |
url_fskip(pb, size); |
| 571 | 571 |
break; |
| 572 | 572 |
} |
| 573 |
- get_le32(pb); /* size */ |
|
| 574 |
- st->codec->width = get_le32(pb); |
|
| 575 |
- st->codec->height = (int32_t)get_le32(pb); |
|
| 576 |
- get_le16(pb); /* panes */ |
|
| 577 |
- st->codec->bits_per_coded_sample= get_le16(pb); /* depth */ |
|
| 578 |
- tag1 = get_le32(pb); |
|
| 579 |
- get_le32(pb); /* ImageSize */ |
|
| 580 |
- get_le32(pb); /* XPelsPerMeter */ |
|
| 581 |
- get_le32(pb); /* YPelsPerMeter */ |
|
| 582 |
- get_le32(pb); /* ClrUsed */ |
|
| 583 |
- get_le32(pb); /* ClrImportant */ |
|
| 573 |
+ tag1 = ff_get_bmp_header(pb, st); |
|
| 584 | 574 |
|
| 585 | 575 |
if (tag1 == MKTAG('D', 'X', 'S', 'B') || tag1 == MKTAG('D','X','S','A')) {
|
| 586 | 576 |
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; |
| ... | ... |
@@ -440,6 +440,23 @@ int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc) |
| 440 | 440 |
return hdrsize; |
| 441 | 441 |
} |
| 442 | 442 |
|
| 443 |
+int ff_get_bmp_header(ByteIOContext *pb, AVStream *st) |
|
| 444 |
+{
|
|
| 445 |
+ int tag1; |
|
| 446 |
+ get_le32(pb); /* size */ |
|
| 447 |
+ st->codec->width = get_le32(pb); |
|
| 448 |
+ st->codec->height = (int32_t)get_le32(pb); |
|
| 449 |
+ get_le16(pb); /* planes */ |
|
| 450 |
+ st->codec->bits_per_coded_sample= get_le16(pb); /* depth */ |
|
| 451 |
+ tag1 = get_le32(pb); |
|
| 452 |
+ get_le32(pb); /* ImageSize */ |
|
| 453 |
+ get_le32(pb); /* XPelsPerMeter */ |
|
| 454 |
+ get_le32(pb); /* YPelsPerMeter */ |
|
| 455 |
+ get_le32(pb); /* ClrUsed */ |
|
| 456 |
+ get_le32(pb); /* ClrImportant */ |
|
| 457 |
+ return tag1; |
|
| 458 |
+} |
|
| 459 |
+ |
|
| 443 | 460 |
/* BITMAPINFOHEADER header */ |
| 444 | 461 |
void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf) |
| 445 | 462 |
{
|
| ... | ... |
@@ -35,6 +35,13 @@ |
| 35 | 35 |
int64_t ff_start_tag(ByteIOContext *pb, const char *tag); |
| 36 | 36 |
void ff_end_tag(ByteIOContext *pb, int64_t start); |
| 37 | 37 |
|
| 38 |
+/** |
|
| 39 |
+ * Read BITMAPINFOHEADER structure and set AVStream codec width, height and |
|
| 40 |
+ * bits_per_encoded_sample fields. Does not read extradata. |
|
| 41 |
+ * @return codec tag |
|
| 42 |
+ */ |
|
| 43 |
+int ff_get_bmp_header(ByteIOContext *pb, AVStream *st); |
|
| 44 |
+ |
|
| 38 | 45 |
void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf); |
| 39 | 46 |
int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc); |
| 40 | 47 |
enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps); |