1
1
mirror of https://github.com/wader/fq.git synced 2024-11-27 06:04:47 +03:00

mp4: Use descriptor field for all descriptor boxes

This commit is contained in:
Mattias Wadman 2021-09-17 15:51:37 +02:00
parent 797bd4d652
commit 589207da20
14 changed files with 22 additions and 22 deletions

View File

@ -432,7 +432,7 @@ func init() {
}) })
}, },
"avcC": func(ctx *decodeContext, d *decode.D) { "avcC": func(ctx *decodeContext, d *decode.D) {
_, v := d.FieldFormat("value", mpegAVCDCRFormat, nil) _, v := d.FieldFormat("descriptor", mpegAVCDCRFormat, nil)
avcDcrOut, ok := v.(format.AvcDcrOut) avcDcrOut, ok := v.(format.AvcDcrOut)
if !ok { if !ok {
d.Invalid(fmt.Sprintf("expected AvcDcrOut got %#+v", v)) d.Invalid(fmt.Sprintf("expected AvcDcrOut got %#+v", v))
@ -442,7 +442,7 @@ func init() {
} }
}, },
"hvcC": func(ctx *decodeContext, d *decode.D) { "hvcC": func(ctx *decodeContext, d *decode.D) {
_, v := d.FieldFormat("value", mpegHEVCDCRFrameFormat, nil) _, v := d.FieldFormat("descriptor", mpegHEVCDCRFrameFormat, nil)
hevcDcrOut, ok := v.(format.HevcDcrOut) hevcDcrOut, ok := v.(format.HevcDcrOut)
if !ok { if !ok {
d.Invalid(fmt.Sprintf("expected HevcDcrOut got %#+v", v)) d.Invalid(fmt.Sprintf("expected HevcDcrOut got %#+v", v))
@ -454,7 +454,7 @@ func init() {
"dfLa": func(ctx *decodeContext, d *decode.D) { "dfLa": func(ctx *decodeContext, d *decode.D) {
d.FieldU8("version") d.FieldU8("version")
d.FieldU24("flags") d.FieldU24("flags")
_, v := d.FieldFormat("metadatablocks", flacMetadatablocksFormat, nil) _, v := d.FieldFormat("descriptor", flacMetadatablocksFormat, nil)
flacMetadatablockOut, ok := v.(format.FlacMetadatablocksOut) flacMetadatablockOut, ok := v.(format.FlacMetadatablocksOut)
if !ok { if !ok {
d.Invalid(fmt.Sprintf("expected FlacMetadatablockOut got %#+v", v)) d.Invalid(fmt.Sprintf("expected FlacMetadatablockOut got %#+v", v))
@ -466,20 +466,20 @@ func init() {
} }
}, },
"dOps": func(_ *decodeContext, d *decode.D) { "dOps": func(_ *decodeContext, d *decode.D) {
d.FieldFormat("value", opusPacketFrameFormat, nil) d.FieldFormat("descriptor", opusPacketFrameFormat, nil)
}, },
"av1C": func(_ *decodeContext, d *decode.D) { "av1C": func(_ *decodeContext, d *decode.D) {
d.FieldFormat("value", av1CCRFormat, nil) d.FieldFormat("descriptor", av1CCRFormat, nil)
}, },
"vpcC": func(_ *decodeContext, d *decode.D) { "vpcC": func(_ *decodeContext, d *decode.D) {
d.FieldU8("version") d.FieldU8("version")
d.FieldU24("flags") d.FieldU24("flags")
d.FieldFormat("value", vpxCCRFormat, nil) d.FieldFormat("descriptor", vpxCCRFormat, nil)
}, },
"esds": func(ctx *decodeContext, d *decode.D) { "esds": func(ctx *decodeContext, d *decode.D) {
d.FieldU32("version") d.FieldU32("version")
_, v := d.FieldFormat("es_descriptor", mpegESFormat, nil) _, v := d.FieldFormat("descriptor", mpegESFormat, nil)
mpegEsOut, ok := v.(format.MpegEsOut) mpegEsOut, ok := v.(format.MpegEsOut)
if !ok { if !ok {
d.Invalid(fmt.Sprintf("expected mpegEsOut got %#+v", v)) d.Invalid(fmt.Sprintf("expected mpegEsOut got %#+v", v))

View File

@ -209,7 +209,7 @@ $ fq -d mp4 verbose /aac.mp4
0x450| 65| e| type: "esds" (Elementary stream descriptor) 0x45f-0x462.7 (4) 0x450| 65| e| type: "esds" (Elementary stream descriptor) 0x45f-0x462.7 (4)
0x460|73 64 73 |sds | 0x460|73 64 73 |sds |
0x460| 00 00 00 00 | .... | version: 0 0x463-0x466.7 (4) 0x460| 00 00 00 00 | .... | version: 0 0x463-0x466.7 (4)
| | | es_descriptor: {} (mpeg_es) 0x467-0x490.7 (42) | | | descriptor: {} (mpeg_es) 0x467-0x490.7 (42)
0x460| 03 | . | tag_id: ES_DescrTag (3) 0x467-0x467.7 (1) 0x460| 03 | . | tag_id: ES_DescrTag (3) 0x467-0x467.7 (1)
0x460| 80 80 80 25 | ...% | length: 37 0x468-0x46b.7 (4) 0x460| 80 80 80 25 | ...% | length: 37 0x468-0x46b.7 (4)
0x460| 00 01 | .. | es_id: 1 0x46c-0x46d.7 (2) 0x460| 00 01 | .. | es_id: 1 0x46c-0x46d.7 (2)

View File

@ -206,7 +206,7 @@ $ fq -d mp4 verbose /av1.mp4
0x13b0| 00| .| size: 27 0x13bf-0x13c2.7 (4) 0x13b0| 00| .| size: 27 0x13bf-0x13c2.7 (4)
0x13c0|00 00 1b |... | 0x13c0|00 00 1b |... |
0x13c0| 61 76 31 43 | av1C | type: "av1C" 0x13c3-0x13c6.7 (4) 0x13c0| 61 76 31 43 | av1C | type: "av1C" 0x13c3-0x13c6.7 (4)
| | | value: {} (av1_ccr) 0x13c7-0x13d9.7 (19) | | | descriptor: {} (av1_ccr) 0x13c7-0x13d9.7 (19)
0x13c0| 81 | . | marker: 1 0x13c7-0x13c7 (0.1) 0x13c0| 81 | . | marker: 1 0x13c7-0x13c7 (0.1)
0x13c0| 81 | . | version: 1 0x13c7.1-0x13c7.7 (0.7) 0x13c0| 81 | . | version: 1 0x13c7.1-0x13c7.7 (0.7)
0x13c0| 3f | ? | seq_profile: 1 0x13c8-0x13c8.2 (0.3) 0x13c0| 3f | ? | seq_profile: 1 0x13c8-0x13c8.2 (0.3)

View File

@ -206,7 +206,7 @@ $ fq -d mp4 verbose /avc.mp4
0x0ce0| 00| .| size: 54 0xcef-0xcf2.7 (4) 0x0ce0| 00| .| size: 54 0xcef-0xcf2.7 (4)
0x0cf0|00 00 36 |..6 | 0x0cf0|00 00 36 |..6 |
0x0cf0| 61 76 63 43 | avcC | type: "avcC" 0xcf3-0xcf6.7 (4) 0x0cf0| 61 76 63 43 | avcC | type: "avcC" 0xcf3-0xcf6.7 (4)
| | | value: {} (avc_dcr) 0xcf7-0xd24.7 (46) | | | descriptor: {} (avc_dcr) 0xcf7-0xd24.7 (46)
0x0cf0| 01 | . | configuration_version: 1 0xcf7-0xcf7.7 (1) 0x0cf0| 01 | . | configuration_version: 1 0xcf7-0xcf7.7 (1)
0x0cf0| f4 | . | profile_indication: High 4:4:4 Predictive Profile (244) 0xcf8-0xcf8.7 (1) 0x0cf0| f4 | . | profile_indication: High 4:4:4 Predictive Profile (244) 0xcf8-0xcf8.7 (1)
0x0cf0| 00 | . | profile_compatibility: 0 0xcf9-0xcf9.7 (1) 0x0cf0| 00 | . | profile_compatibility: 0 0xcf9-0xcf9.7 (1)

View File

@ -224,7 +224,7 @@ $ fq -d mp4 verbose /dash_audio_init.mp4
0x230| 00 00 00 2a| ...*| size: 42 0x23c-0x23f.7 (4) 0x230| 00 00 00 2a| ...*| size: 42 0x23c-0x23f.7 (4)
0x240|65 73 64 73 |esds | type: "esds" (Elementary stream descriptor) 0x240-0x243.7 (4) 0x240|65 73 64 73 |esds | type: "esds" (Elementary stream descriptor) 0x240-0x243.7 (4)
0x240| 00 00 00 00 | .... | version: 0 0x244-0x247.7 (4) 0x240| 00 00 00 00 | .... | version: 0 0x244-0x247.7 (4)
| | | es_descriptor: {} (mpeg_es) 0x248-0x265.7 (30) | | | descriptor: {} (mpeg_es) 0x248-0x265.7 (30)
0x240| 03 | . | tag_id: ES_DescrTag (3) 0x248-0x248.7 (1) 0x240| 03 | . | tag_id: ES_DescrTag (3) 0x248-0x248.7 (1)
0x240| 1c | . | length: 28 0x249-0x249.7 (1) 0x240| 1c | . | length: 28 0x249-0x249.7 (1)
0x240| 00 01 | .. | es_id: 1 0x24a-0x24b.7 (2) 0x240| 00 01 | .. | es_id: 1 0x24a-0x24b.7 (2)
@ -699,7 +699,7 @@ $ fq -d mp4 verbose /dash_video_init.mp4
| | | [0]: box {} 0x272-0x2a2.7 (49) | | | [0]: box {} 0x272-0x2a2.7 (49)
0x270| 00 00 00 31 | ...1 | size: 49 0x272-0x275.7 (4) 0x270| 00 00 00 31 | ...1 | size: 49 0x272-0x275.7 (4)
0x270| 61 76 63 43 | avcC | type: "avcC" 0x276-0x279.7 (4) 0x270| 61 76 63 43 | avcC | type: "avcC" 0x276-0x279.7 (4)
| | | value: {} (avc_dcr) 0x27a-0x2a2.7 (41) | | | descriptor: {} (avc_dcr) 0x27a-0x2a2.7 (41)
0x270| 01 | . | configuration_version: 1 0x27a-0x27a.7 (1) 0x270| 01 | . | configuration_version: 1 0x27a-0x27a.7 (1)
0x270| f4 | . | profile_indication: High 4:4:4 Predictive Profile (244) 0x27b-0x27b.7 (1) 0x270| f4 | . | profile_indication: High 4:4:4 Predictive Profile (244) 0x27b-0x27b.7 (1)
0x270| 10 | . | profile_compatibility: 16 0x27c-0x27c.7 (1) 0x270| 10 | . | profile_compatibility: 16 0x27c-0x27c.7 (1)

View File

@ -210,7 +210,7 @@ $ fq -d mp4 verbose /flac.mp4
0x450| 64 66 4c 61 | dfLa | type: "dfLa" 0x457-0x45a.7 (4) 0x450| 64 66 4c 61 | dfLa | type: "dfLa" 0x457-0x45a.7 (4)
0x450| 00 | . | version: 0 0x45b-0x45b.7 (1) 0x450| 00 | . | version: 0 0x45b-0x45b.7 (1)
0x450| 00 00 00 | ... | flags: 0 0x45c-0x45e.7 (3) 0x450| 00 00 00 | ... | flags: 0 0x45c-0x45e.7 (3)
| | | metadatablocks: [1] (flac_metadatablocks) 0x45f-0x484.7 (38) | | | descriptor: [1] (flac_metadatablocks) 0x45f-0x484.7 (38)
| | | [0]: metadatablock {} 0x45f-0x484.7 (38) | | | [0]: metadatablock {} 0x45f-0x484.7 (38)
0x450| 80| .| last_block: true 0x45f-0x45f (0.1) 0x450| 80| .| last_block: true 0x45f-0x45f (0.1)
0x450| 80| .| type: Streaminfo (0) 0x45f.1-0x45f.7 (0.7) 0x450| 80| .| type: Streaminfo (0) 0x45f.1-0x45f.7 (0.7)

View File

@ -182,7 +182,7 @@ $ fq -d mp4 verbose /fragmented.mp4
0x01f0| 00| .| size: 49 0x1ff-0x202.7 (4) 0x01f0| 00| .| size: 49 0x1ff-0x202.7 (4)
0x0200|00 00 31 |..1 | 0x0200|00 00 31 |..1 |
0x0200| 61 76 63 43 | avcC | type: "avcC" 0x203-0x206.7 (4) 0x0200| 61 76 63 43 | avcC | type: "avcC" 0x203-0x206.7 (4)
| | | value: {} (avc_dcr) 0x207-0x22f.7 (41) | | | descriptor: {} (avc_dcr) 0x207-0x22f.7 (41)
0x0200| 01 | . | configuration_version: 1 0x207-0x207.7 (1) 0x0200| 01 | . | configuration_version: 1 0x207-0x207.7 (1)
0x0200| f4 | . | profile_indication: High 4:4:4 Predictive Profile (244) 0x208-0x208.7 (1) 0x0200| f4 | . | profile_indication: High 4:4:4 Predictive Profile (244) 0x208-0x208.7 (1)
0x0200| 10 | . | profile_compatibility: 16 0x209-0x209.7 (1) 0x0200| 10 | . | profile_compatibility: 16 0x209-0x209.7 (1)
@ -428,7 +428,7 @@ $ fq -d mp4 verbose /fragmented.mp4
0x03b0| 65 73 64 73 | esds | type: "esds" (Elementary stream descriptor) 0x3b9-0x3bc.7 (4) 0x03b0| 65 73 64 73 | esds | type: "esds" (Elementary stream descriptor) 0x3b9-0x3bc.7 (4)
0x03b0| 00 00 00| ...| version: 0 0x3bd-0x3c0.7 (4) 0x03b0| 00 00 00| ...| version: 0 0x3bd-0x3c0.7 (4)
0x03c0|00 |. | 0x03c0|00 |. |
| | | es_descriptor: {} (mpeg_es) 0x3c1-0x3ea.7 (42) | | | descriptor: {} (mpeg_es) 0x3c1-0x3ea.7 (42)
0x03c0| 03 | . | tag_id: ES_DescrTag (3) 0x3c1-0x3c1.7 (1) 0x03c0| 03 | . | tag_id: ES_DescrTag (3) 0x3c1-0x3c1.7 (1)
0x03c0| 80 80 80 25 | ...% | length: 37 0x3c2-0x3c5.7 (4) 0x03c0| 80 80 80 25 | ...% | length: 37 0x3c2-0x3c5.7 (4)
0x03c0| 00 02 | .. | es_id: 2 0x3c6-0x3c7.7 (2) 0x03c0| 00 02 | .. | es_id: 2 0x3c6-0x3c7.7 (2)

View File

@ -85,7 +85,7 @@ $ fq -d mp4 verbose /heic.mp4
| | | [2]: box {} 0xd0-0x144.7 (117) | | | [2]: box {} 0xd0-0x144.7 (117)
0x0d0|00 00 00 75 |...u | size: 117 0xd0-0xd3.7 (4) 0x0d0|00 00 00 75 |...u | size: 117 0xd0-0xd3.7 (4)
0x0d0| 68 76 63 43 | hvcC | type: "hvcC" 0xd4-0xd7.7 (4) 0x0d0| 68 76 63 43 | hvcC | type: "hvcC" 0xd4-0xd7.7 (4)
| | | value: {} (hevc_dcr) 0xd8-0x144.7 (109) | | | descriptor: {} (hevc_dcr) 0xd8-0x144.7 (109)
0x0d0| 01 | . | configuration_version: 1 0xd8-0xd8.7 (1) 0x0d0| 01 | . | configuration_version: 1 0xd8-0xd8.7 (1)
0x0d0| 01 | . | general_profile_space: 0 0xd9-0xd9.1 (0.2) 0x0d0| 01 | . | general_profile_space: 0 0xd9-0xd9.1 (0.2)
0x0d0| 01 | . | general_tier_flag: 0 0xd9.2-0xd9.2 (0.1) 0x0d0| 01 | . | general_tier_flag: 0 0xd9.2-0xd9.2 (0.1)

View File

@ -223,7 +223,7 @@ $ fq -d mp4 verbose /hevc.mp4
| | | [0]: box {} 0xa80-0x13c2.7 (2371) | | | [0]: box {} 0xa80-0x13c2.7 (2371)
0x0a80|00 00 09 43 |...C | size: 2371 0xa80-0xa83.7 (4) 0x0a80|00 00 09 43 |...C | size: 2371 0xa80-0xa83.7 (4)
0x0a80| 68 76 63 43 | hvcC | type: "hvcC" 0xa84-0xa87.7 (4) 0x0a80| 68 76 63 43 | hvcC | type: "hvcC" 0xa84-0xa87.7 (4)
| | | value: {} (hevc_dcr) 0xa88-0x13c2.7 (2363) | | | descriptor: {} (hevc_dcr) 0xa88-0x13c2.7 (2363)
0x0a80| 01 | . | configuration_version: 1 0xa88-0xa88.7 (1) 0x0a80| 01 | . | configuration_version: 1 0xa88-0xa88.7 (1)
0x0a80| 04 | . | general_profile_space: 0 0xa89-0xa89.1 (0.2) 0x0a80| 04 | . | general_profile_space: 0 0xa89-0xa89.1 (0.2)
0x0a80| 04 | . | general_tier_flag: 0 0xa89.2-0xa89.2 (0.1) 0x0a80| 04 | . | general_tier_flag: 0 0xa89.2-0xa89.2 (0.1)

View File

@ -210,7 +210,7 @@ $ fq -d mp4 verbose /mp3.mp4
0x460| 65 73 64 73 | esds | type: "esds" (Elementary stream descriptor) 0x46b-0x46e.7 (4) 0x460| 65 73 64 73 | esds | type: "esds" (Elementary stream descriptor) 0x46b-0x46e.7 (4)
0x460| 00| .| version: 0 0x46f-0x472.7 (4) 0x460| 00| .| version: 0 0x46f-0x472.7 (4)
0x470|00 00 00 |... | 0x470|00 00 00 |... |
| | | es_descriptor: {} (mpeg_es) 0x473-0x492.7 (32) | | | descriptor: {} (mpeg_es) 0x473-0x492.7 (32)
0x470| 03 | . | tag_id: ES_DescrTag (3) 0x473-0x473.7 (1) 0x470| 03 | . | tag_id: ES_DescrTag (3) 0x473-0x473.7 (1)
0x470| 80 80 80 1b | .... | length: 27 0x474-0x477.7 (4) 0x470| 80 80 80 1b | .... | length: 27 0x474-0x477.7 (4)
0x470| 00 01 | .. | es_id: 1 0x478-0x479.7 (2) 0x470| 00 01 | .. | es_id: 1 0x478-0x479.7 (2)

View File

@ -224,7 +224,7 @@ $ fq -d mp4 verbose /mpeg2.mp4
0x21a0| 65 73 64 73 | esds | type: "esds" (Elementary stream descriptor) 0x21a9-0x21ac.7 (4) 0x21a0| 65 73 64 73 | esds | type: "esds" (Elementary stream descriptor) 0x21a9-0x21ac.7 (4)
0x21a0| 00 00 00| ...| version: 0 0x21ad-0x21b0.7 (4) 0x21a0| 00 00 00| ...| version: 0 0x21ad-0x21b0.7 (4)
0x21b0|00 |. | 0x21b0|00 |. |
| | | es_descriptor: {} (mpeg_es) 0x21b1-0x21d0.7 (32) | | | descriptor: {} (mpeg_es) 0x21b1-0x21d0.7 (32)
0x21b0| 03 | . | tag_id: ES_DescrTag (3) 0x21b1-0x21b1.7 (1) 0x21b0| 03 | . | tag_id: ES_DescrTag (3) 0x21b1-0x21b1.7 (1)
0x21b0| 80 80 80 1b | .... | length: 27 0x21b2-0x21b5.7 (4) 0x21b0| 80 80 80 1b | .... | length: 27 0x21b2-0x21b5.7 (4)
0x21b0| 00 01 | .. | es_id: 1 0x21b6-0x21b7.7 (2) 0x21b0| 00 01 | .. | es_id: 1 0x21b6-0x21b7.7 (2)

View File

@ -200,7 +200,7 @@ $ fq -d mp4 verbose /opus.mp4
| | | [0]: box {} 0x360-0x372.7 (19) | | | [0]: box {} 0x360-0x372.7 (19)
0x360|00 00 00 13 |.... | size: 19 0x360-0x363.7 (4) 0x360|00 00 00 13 |.... | size: 19 0x360-0x363.7 (4)
0x360| 64 4f 70 73 | dOps | type: "dOps" 0x364-0x367.7 (4) 0x360| 64 4f 70 73 | dOps | type: "dOps" 0x364-0x367.7 (4)
| | | value: {} (opus_packet) 0x368-0x372.7 (11) | | | descriptor: {} (opus_packet) 0x368-0x372.7 (11)
| | | type: "audio" 0x368-NA (0) | | | type: "audio" 0x368-NA (0)
| | | toc: {} 0x368-0x372.7 (11) | | | toc: {} 0x368-0x372.7 (11)
| | | config: {} 0x368-0x368.4 (0.5) | | | config: {} 0x368-0x368.4 (0.5)

View File

@ -209,7 +209,7 @@ $ fq -d mp4 verbose /vorbis.mp4
0x03a0| 65 73 64 73 | esds | type: "esds" (Elementary stream descriptor) 0x3aa-0x3ad.7 (4) 0x03a0| 65 73 64 73 | esds | type: "esds" (Elementary stream descriptor) 0x3aa-0x3ad.7 (4)
0x03a0| 00 00| ..| version: 0 0x3ae-0x3b1.7 (4) 0x03a0| 00 00| ..| version: 0 0x3ae-0x3b1.7 (4)
0x03b0|00 00 |.. | 0x03b0|00 00 |.. |
| | | es_descriptor: {} (mpeg_es) 0x3b2-0x10b6.7 (3333) | | | descriptor: {} (mpeg_es) 0x3b2-0x10b6.7 (3333)
0x03b0| 03 | . | tag_id: ES_DescrTag (3) 0x3b2-0x3b2.7 (1) 0x03b0| 03 | . | tag_id: ES_DescrTag (3) 0x3b2-0x3b2.7 (1)
0x03b0| 80 80 9a 00 | .... | length: 3328 0x3b3-0x3b6.7 (4) 0x03b0| 80 80 9a 00 | .... | length: 3328 0x3b3-0x3b6.7 (4)
0x03b0| 00 01 | .. | es_id: 1 0x3b7-0x3b8.7 (2) 0x03b0| 00 01 | .. | es_id: 1 0x3b7-0x3b8.7 (2)

View File

@ -207,7 +207,7 @@ $ fq -d mp4 verbose /vp9.mp4
0x1760| 76 70 63 43 | vpcC | type: "vpcC" 0x1767-0x176a.7 (4) 0x1760| 76 70 63 43 | vpcC | type: "vpcC" 0x1767-0x176a.7 (4)
0x1760| 01 | . | version: 1 0x176b-0x176b.7 (1) 0x1760| 01 | . | version: 1 0x176b-0x176b.7 (1)
0x1760| 00 00 00 | ... | flags: 0 0x176c-0x176e.7 (3) 0x1760| 00 00 00 | ... | flags: 0 0x176c-0x176e.7 (3)
| | | value: {} (vpx_ccr) 0x176f-0x1776.7 (8) | | | descriptor: {} (vpx_ccr) 0x176f-0x1776.7 (8)
0x1760| 01| .| profile: 1 0x176f-0x176f.7 (1) 0x1760| 01| .| profile: 1 0x176f-0x176f.7 (1)
0x1770|14 |. | level: Level 2 (20) 0x1770-0x1770.7 (1) 0x1770|14 |. | level: Level 2 (20) 0x1770-0x1770.7 (1)
0x1770| 86 | . | bit_depth: 8 0x1771-0x1771.3 (0.4) 0x1770| 86 | . | bit_depth: 8 0x1771-0x1771.3 (0.4)