mirror of
https://github.com/wader/fq.git
synced 2024-09-11 20:07:11 +03:00
avi: More correct strf chunk extra data
This commit is contained in:
parent
3988399e7c
commit
a745b12da2
@ -356,8 +356,8 @@ func aviDecode(d *decode.D) any {
|
||||
switch typ {
|
||||
case "vids":
|
||||
// BITMAPINFOHEADER
|
||||
size := d.BitsLeft()
|
||||
biSize := d.FieldU32("bi_size")
|
||||
d.BitsLeft()
|
||||
d.FieldU32("bi_size")
|
||||
d.FieldU32("width")
|
||||
d.FieldU32("height")
|
||||
d.FieldU16("planes")
|
||||
@ -368,9 +368,8 @@ func aviDecode(d *decode.D) any {
|
||||
d.FieldU32("y_pels_per_meter")
|
||||
d.FieldU32("clr_used")
|
||||
d.FieldU32("clr_important")
|
||||
extraSize := size - int64(biSize)*8 - 2*32
|
||||
if extraSize > 0 {
|
||||
d.FieldRawLen("extra", extraSize)
|
||||
if d.BitsLeft() > 0 {
|
||||
d.FieldRawLen("extra", d.BitsLeft())
|
||||
}
|
||||
|
||||
// TODO: if dvsd handler and extraSize >= 32 then DVINFO?
|
||||
@ -409,10 +408,7 @@ func aviDecode(d *decode.D) any {
|
||||
// TODO: seems to be optional
|
||||
if d.BitsLeft() >= 16 {
|
||||
cbSize := d.FieldU16("cb_size")
|
||||
// TODO: correct? seems to be what is seen in the wild
|
||||
if cbSize > 18 {
|
||||
d.FieldRawLen("extra", int64(cbSize-18)*8)
|
||||
}
|
||||
d.FieldRawLen("extra", int64(cbSize)*8)
|
||||
}
|
||||
|
||||
switch formatTag {
|
||||
|
9
format/riff/testdata/flac.avi.fqtest
vendored
9
format/riff/testdata/flac.avi.fqtest
vendored
@ -67,7 +67,7 @@ $ fq dv flac.avi
|
||||
0x0090| 00 00| ..| top: 0 0x9e-0x9f.7 (2)
|
||||
0x00a0|00 00 |.. | right: 0 0xa0-0xa1.7 (2)
|
||||
0x00a0| 00 00 | .. | bottom: 0 0xa2-0xa3.7 (2)
|
||||
| | | [1]{}: chunk 0xa4-0xcd.7 (42)
|
||||
| | | [1]{}: chunk 0xa4-0xdf.7 (60)
|
||||
0x00a0| 73 74 72 66 | strf | id: "strf" (Stream format) 0xa4-0xa7.7 (4)
|
||||
0x00a0| 34 00 00 00 | 4... | size: 52 0xa8-0xab.7 (4)
|
||||
0x00a0| ac f1 | .. | format_tag: "flac" (61868) 0xac-0xad.7 (2)
|
||||
@ -77,8 +77,9 @@ $ fq dv flac.avi
|
||||
0x00b0| 02 00 | .. | block_align: 2 0xb8-0xb9.7 (2)
|
||||
0x00b0| 10 00 | .. | bits_per_sample: 16 0xba-0xbb.7 (2)
|
||||
0x00b0| 22 00 | ". | cb_size: 34 0xbc-0xbd.7 (2)
|
||||
0x00b0| 12 00| ..| extra: raw bits 0xbe-0xcd.7 (16)
|
||||
0x00c0|12 00 00 00 00 00 24 15 0a c4 40 f0 00 00 |......$...@... |
|
||||
0x00b0| 12 00| ..| extra: raw bits 0xbe-0xdf.7 (34)
|
||||
0x00c0|12 00 00 00 00 00 24 15 0a c4 40 f0 00 00 00 00|......$...@.....|
|
||||
0x00d0|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
||||
| | | [2]{}: chunk 0xe0-0x10ff.7 (4128)
|
||||
0x00e0|4a 55 4e 4b |JUNK | id: "JUNK" (Alignment) 0xe0-0xe3.7 (4)
|
||||
0x00e0| 18 10 00 00 | .... | size: 4120 0xe4-0xe7.7 (4)
|
||||
@ -204,8 +205,6 @@ $ fq dv flac.avi
|
||||
0x18c0| 00 00 00 | ... | unused2: raw bits 0x18c1-0x18c3.7 (3)
|
||||
0x18c0| 66 02 00 00 | f... | offset: 614 0x18c4-0x18c7.7 (4)
|
||||
0x18c0| 00 00 00 00| | ....| | length: 0 0x18c8-0x18cb.7 (4)
|
||||
0x00c0| 00 00| ..| gap0: raw bits 0xce-0xdf.7 (18)
|
||||
0x00d0|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
||||
| | | streams[0:1]: 0x1642-0x18a3.7 (610)
|
||||
| | | [0]{}: stream 0x1642-0x18a3.7 (610)
|
||||
| | | samples[0:2]: 0x1642-0x18a3.7 (610)
|
||||
|
6
format/riff/testdata/mp3.avi.fqtest
vendored
6
format/riff/testdata/mp3.avi.fqtest
vendored
@ -67,7 +67,7 @@ $ fq dv mp3.avi
|
||||
0x0090| 00 00| ..| top: 0 0x9e-0x9f.7 (2)
|
||||
0x00a0|00 00 |.. | right: 0 0xa0-0xa1.7 (2)
|
||||
0x00a0| 00 00 | .. | bottom: 0 0xa2-0xa3.7 (2)
|
||||
| | | [1]{}: chunk 0xa4-0xbd.7 (26)
|
||||
| | | [1]{}: chunk 0xa4-0xc9.7 (38)
|
||||
0x00a0| 73 74 72 66 | strf | id: "strf" (Stream format) 0xa4-0xa7.7 (4)
|
||||
0x00a0| 1e 00 00 00 | .... | size: 30 0xa8-0xab.7 (4)
|
||||
0x00a0| 55 00 | U. | format_tag: "mp3" (85) 0xac-0xad.7 (2)
|
||||
@ -77,6 +77,8 @@ $ fq dv mp3.avi
|
||||
0x00b0| 80 04 | .. | block_align: 1152 0xb8-0xb9.7 (2)
|
||||
0x00b0| 00 00 | .. | bits_per_sample: 0 0xba-0xbb.7 (2)
|
||||
0x00b0| 0c 00 | .. | cb_size: 12 0xbc-0xbd.7 (2)
|
||||
0x00b0| 01 00| ..| extra: raw bits 0xbe-0xc9.7 (12)
|
||||
0x00c0|02 00 00 00 80 04 01 00 71 05 |........q. |
|
||||
| | | [2]{}: chunk 0xca-0x10e9.7 (4128)
|
||||
0x00c0| 4a 55 4e 4b | JUNK | id: "JUNK" (Alignment) 0xca-0xcd.7 (4)
|
||||
0x00c0| 18 10| ..| size: 4120 0xce-0xd1.7 (4)
|
||||
@ -349,8 +351,6 @@ $ fq dv mp3.avi
|
||||
0x18d0| 00 00 00| ...| unused2: raw bits 0x18dd-0x18df.7 (3)
|
||||
0x18e0|b6 01 00 00 |.... | offset: 438 0x18e0-0x18e3.7 (4)
|
||||
0x18e0| d1 00 00 00| | ....| | length: 209 0x18e4-0x18e7.7 (4)
|
||||
0x00b0| 01 00| ..| gap0: raw bits 0xbe-0xc9.7 (12)
|
||||
0x00c0|02 00 00 00 80 04 01 00 71 05 |........q. |
|
||||
| | | streams[0:1]: 0x162c-0x18ae.7 (643)
|
||||
| | | [0]{}: stream 0x162c-0x18ae.7 (643)
|
||||
| | | samples[0:3]: 0x162c-0x18ae.7 (643)
|
||||
|
Loading…
Reference in New Issue
Block a user