Skip to content

Commit e50028a

Browse files
committed
mp4,mpeg_es: Decode iods box and MP4_IOD_Tag OD
1 parent 97a1f82 commit e50028a

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

format/mp4/boxes.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,9 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) {
730730
d.FieldU8("version")
731731
d.FieldU24("flags")
732732
d.FieldFormat("descriptor", &vpxCCRGroup, nil)
733+
case "iods":
734+
d.FieldU32("version")
735+
d.FieldFormat("descriptor", &mpegESGroup, nil)
733736
case "esds":
734737
d.FieldU32("version")
735738
_, v := d.FieldFormat("descriptor", &mpegESGroup, nil)

format/mp4/testdata/stz2.fqtest

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,16 @@ $ fq -d mp4 'dv' stz2.mp4
4646
| | | [1]{}: box 0x88-0x9c.7 (21)
4747
0x080| 00 00 00 15 | .... | size: 21 0x88-0x8b.7 (4)
4848
0x080| 69 6f 64 73| iods| type: "iods" (Object Descriptor container box) 0x8c-0x8f.7 (4)
49-
0x090|00 00 00 00 10 07 00 4f ff ff fe ff ff |.......O..... | data: raw bits 0x90-0x9c.7 (13)
49+
0x090|00 00 00 00 |.... | version: 0 0x90-0x93.7 (4)
50+
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| descriptor{}: (mpeg_es) 0x94-0x9c.7 (9)
51+
0x090| 10 | . | tag_id: "MP4_IOD_Tag" (16) 0x94-0x94.7 (1)
52+
0x090| 07 | . | length: 7 0x95-0x95.7 (1)
53+
0x090| 00 4f | .O | od_id: 79 0x96-0x97.7 (2)
54+
0x090| ff | . | od_profile_level: 255 0x98-0x98.7 (1)
55+
0x090| ff | . | scene_profile_level: 255 0x99-0x99.7 (1)
56+
0x090| fe | . | audio_profile_level: 254 0x9a-0x9a.7 (1)
57+
0x090| ff | . | video_profile_level: 255 0x9b-0x9b.7 (1)
58+
0x090| ff | . | graphics_profile_level: 255 0x9c-0x9c.7 (1)
5059
| | | [2]{}: box 0x9d-0x27b.7 (479)
5160
0x090| 00 00 01| ...| size: 479 0x9d-0xa0.7 (4)
5261
0x0a0|df |. |

format/mpeg/mpeg_es.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,17 @@ func odDecodeTag(d *decode.D, edc *esDecodeContext, _ int, fn func(d *decode.D))
261261
}
262262
}
263263
},
264+
// TODO: where is the spec?
265+
// https://xhelmboyx.tripod.com/formats/mp4-layout.txt
266+
// https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/movenc.c mov_write_iods_tag
267+
MP4_IOD_Tag: func(d *decode.D) {
268+
d.FieldU16("od_id")
269+
d.FieldU8("od_profile_level")
270+
d.FieldU8("scene_profile_level")
271+
d.FieldU8("audio_profile_level")
272+
d.FieldU8("video_profile_level")
273+
d.FieldU8("graphics_profile_level")
274+
},
264275
}
265276

266277
// TODO: expectedTagID

0 commit comments

Comments
 (0)