Skip to content

Commit

Permalink
mp4,mpeg_es: Decode iods box and MP4_IOD_Tag OD
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Aug 30, 2023
1 parent 97a1f82 commit e50028a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions format/mp4/boxes.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,9 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) {
d.FieldU8("version")
d.FieldU24("flags")
d.FieldFormat("descriptor", &vpxCCRGroup, nil)
case "iods":
d.FieldU32("version")
d.FieldFormat("descriptor", &mpegESGroup, nil)
case "esds":
d.FieldU32("version")
_, v := d.FieldFormat("descriptor", &mpegESGroup, nil)
Expand Down
11 changes: 10 additions & 1 deletion format/mp4/testdata/stz2.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@ $ fq -d mp4 'dv' stz2.mp4
| | | [1]{}: box 0x88-0x9c.7 (21)
0x080| 00 00 00 15 | .... | size: 21 0x88-0x8b.7 (4)
0x080| 69 6f 64 73| iods| type: "iods" (Object Descriptor container box) 0x8c-0x8f.7 (4)
0x090|00 00 00 00 10 07 00 4f ff ff fe ff ff |.......O..... | data: raw bits 0x90-0x9c.7 (13)
0x090|00 00 00 00 |.... | version: 0 0x90-0x93.7 (4)
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| descriptor{}: (mpeg_es) 0x94-0x9c.7 (9)
0x090| 10 | . | tag_id: "MP4_IOD_Tag" (16) 0x94-0x94.7 (1)
0x090| 07 | . | length: 7 0x95-0x95.7 (1)
0x090| 00 4f | .O | od_id: 79 0x96-0x97.7 (2)
0x090| ff | . | od_profile_level: 255 0x98-0x98.7 (1)
0x090| ff | . | scene_profile_level: 255 0x99-0x99.7 (1)
0x090| fe | . | audio_profile_level: 254 0x9a-0x9a.7 (1)
0x090| ff | . | video_profile_level: 255 0x9b-0x9b.7 (1)
0x090| ff | . | graphics_profile_level: 255 0x9c-0x9c.7 (1)
| | | [2]{}: box 0x9d-0x27b.7 (479)
0x090| 00 00 01| ...| size: 479 0x9d-0xa0.7 (4)
0x0a0|df |. |
Expand Down
11 changes: 11 additions & 0 deletions format/mpeg/mpeg_es.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,17 @@ func odDecodeTag(d *decode.D, edc *esDecodeContext, _ int, fn func(d *decode.D))
}
}
},
// TODO: where is the spec?
// https://xhelmboyx.tripod.com/formats/mp4-layout.txt
// https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/movenc.c mov_write_iods_tag
MP4_IOD_Tag: func(d *decode.D) {
d.FieldU16("od_id")
d.FieldU8("od_profile_level")
d.FieldU8("scene_profile_level")
d.FieldU8("audio_profile_level")
d.FieldU8("video_profile_level")
d.FieldU8("graphics_profile_level")
},
}

// TODO: expectedTagID
Expand Down

0 comments on commit e50028a

Please sign in to comment.