mirror of
https://github.com/wader/fq.git
synced 2024-10-27 04:09:37 +03:00
commit
c23e241a75
@ -1367,27 +1367,48 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) {
|
||||
case "sgpd":
|
||||
version := d.FieldU8("version")
|
||||
d.FieldU24("flags")
|
||||
d.FieldUTF8("grouping_type", 4)
|
||||
var groupingType = d.FieldUTF8("grouping_type", 4)
|
||||
var defaultLength uint64
|
||||
if version == 1 {
|
||||
defaultLength = d.FieldU32("default_length")
|
||||
}
|
||||
if version >= 2 {
|
||||
} else if version >= 2 {
|
||||
d.FieldU32("default_sample_description_index")
|
||||
}
|
||||
entryCount := d.FieldU32("entry_count")
|
||||
d.FieldArray("entries", func(d *decode.D) {
|
||||
for i := uint64(0); i < entryCount; i++ {
|
||||
entryLen := defaultLength
|
||||
if version == 1 {
|
||||
if defaultLength == 0 {
|
||||
entryLen = d.FieldU32("description_length")
|
||||
} else if entryLen == 0 {
|
||||
d.Fatalf("sgpd groups entry len <= 0 version 1")
|
||||
}
|
||||
|
||||
d.FieldStructNArray("entries", "entry", int64(entryCount), func(d *decode.D) {
|
||||
entryLen := defaultLength
|
||||
if version == 1 {
|
||||
if defaultLength == 0 {
|
||||
entryLen = d.FieldU32("description_length")
|
||||
} else if entryLen == 0 {
|
||||
d.Fatalf("sgpd groups entry len <= 0")
|
||||
d.Fatalf("sgpd groups entry len == 0")
|
||||
}
|
||||
} else if entryLen == 0 {
|
||||
// TODO: this is likely a mistake: here version is != 1, so defaultLength is default (i.e. 0),
|
||||
// TODO: so entryLen is also 0. So for version != 1 this fatal should always throw
|
||||
d.Fatalf("sgpd groups entry len == 0")
|
||||
}
|
||||
// CENC Sample Encryption Info Entries
|
||||
switch groupingType {
|
||||
case "seig":
|
||||
d.FieldU8("reserved")
|
||||
d.FieldU4("crypto_bytes")
|
||||
d.FieldU4("skip_bytes")
|
||||
isEncrypted := d.FieldU8("is_encrypted")
|
||||
perSampleIVSize := d.FieldU8("per_sample_iv_size")
|
||||
d.FieldRawLen("kid", 8*16)
|
||||
if isEncrypted != 0 {
|
||||
// If perSampleIVSize > 0 then
|
||||
if perSampleIVSize == 0 {
|
||||
// This means whole fragment is encrypted with a constant IV
|
||||
iVSize := d.FieldU8("constant_iv_size")
|
||||
d.FieldRawLen("constant_iv", 8*int64(iVSize))
|
||||
}
|
||||
}
|
||||
case "roll":
|
||||
d.FieldU16("roll_distance")
|
||||
default:
|
||||
d.FieldRawLen("data", int64(entryLen)*8)
|
||||
}
|
||||
})
|
||||
|
3
format/mp4/testdata/aac.fqtest
vendored
3
format/mp4/testdata/aac.fqtest
vendored
@ -308,7 +308,8 @@ $ fq -d mp4 dv aac.mp4
|
||||
0x510| 00 00 00 02 | .... | default_length: 2 0x515-0x518.7 (4)
|
||||
0x510| 00 00 00 01 | .... | entry_count: 1 0x519-0x51c.7 (4)
|
||||
| | | entries[0:1]: 0x51d-0x51e.7 (2)
|
||||
0x510| ff ff | .. | [0]: raw bits data 0x51d-0x51e.7 (2)
|
||||
| | | [0]{}: entry 0x51d-0x51e.7 (2)
|
||||
0x510| ff ff | .. | roll_distance: 65535 0x51d-0x51e.7 (2)
|
||||
| | | [6]{}: box 0x51f-0x53a.7 (28)
|
||||
0x510| 00| .| size: 28 0x51f-0x522.7 (4)
|
||||
0x520|00 00 1c |... |
|
||||
|
1633
format/mp4/testdata/dash.fqtest
vendored
1633
format/mp4/testdata/dash.fqtest
vendored
File diff suppressed because it is too large
Load Diff
BIN
format/mp4/testdata/dash_audio_1.m4s
vendored
BIN
format/mp4/testdata/dash_audio_1.m4s
vendored
Binary file not shown.
BIN
format/mp4/testdata/dash_audio_init.mp4
vendored
BIN
format/mp4/testdata/dash_audio_init.mp4
vendored
Binary file not shown.
BIN
format/mp4/testdata/dash_in.mp4
vendored
Normal file
BIN
format/mp4/testdata/dash_in.mp4
vendored
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user