Skip to content

Commit

Permalink
Merge pull request #826 from wader/mpeg_es_ios_descriptors
Browse files Browse the repository at this point in the history
mpeg_es: Support ES_ID_Inc and decode descriptors for IOD tags
  • Loading branch information
wader authored Dec 6, 2023
2 parents d284808 + fca55b2 commit 86e6d58
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
Binary file added format/mp4/testdata/iods_box_es_iod_decrs
Binary file not shown.
23 changes: 23 additions & 0 deletions format/mp4/testdata/iods_box_es_iod_decrs.fqtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$ fq -d mp4 -o force=true d iods_box_es_iod_decrs
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: iods_box_es_iod_decrs (mp4)
| | | boxes[0:1]:
| | | [0]{}: box
0x00|00 00 00 21 |...! | size: 33
0x00| 69 6f 64 73 | iods | type: "iods" (Object Descriptor container box)
0x00| 00 00 00 00 | .... | version: 0
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| descriptor{}: (mpeg_es)
0x00| 10 | . | tag_id: "MP4_IOD_Tag" (16)
0x00| 80 80 80| ...| length: 16
0x10|10 |. |
0x10| 00 4f | .O | od_id: 79
0x10| ff | . | od_profile_level: 255
0x10| ff | . | scene_profile_level: 255
0x10| 31 | 1 | audio_profile_level: 49
0x10| ff | . | video_profile_level: 255
0x10| ff | . | graphics_profile_level: 255
| | | descriptors[0:1]:
| | | [0]{}: desc
0x10| 0e | . | tag_id: "ES_ID_IncTag" (14)
0x10| 80 80 80 04 | .... | length: 4
0x10| 00 00 00| ...| track_id: 1
0x20|01| |.| |
1 change: 1 addition & 0 deletions format/mp4/testdata/stz2.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ $ fq -d mp4 'dv' stz2.mp4
0x090| fe | . | audio_profile_level: 254 0x9a-0x9b (1)
0x090| ff | . | video_profile_level: 255 0x9b-0x9c (1)
0x090| ff | . | graphics_profile_level: 255 0x9c-0x9d (1)
| | | descriptors[0:0]: 0x9d-0x9d (0)
| | | [2]{}: box 0x9d-0x27c (479)
0x090| 00 00 01| ...| size: 479 0x9d-0xa1 (4)
0x0a0|df |. |
Expand Down
9 changes: 9 additions & 0 deletions format/mpeg/mpeg_es.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,22 @@ 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
// TODO: IOD = initial object descriptor?
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")
d.FieldArray("descriptors", func(d *decode.D) {
for !d.End() {
fieldODDecodeTag(d, edc, "desc", -1, nil)
}
})
},
ES_ID_IncTag: func(d *decode.D) {
d.FieldU32("track_id")
},
}

Expand Down

0 comments on commit 86e6d58

Please sign in to comment.