diff --git a/src/muxer/hls/mp4/atoms.rs b/src/muxer/hls/mp4/atoms.rs index 89f3837..c62f1a1 100644 --- a/src/muxer/hls/mp4/atoms.rs +++ b/src/muxer/hls/mp4/atoms.rs @@ -10,6 +10,12 @@ struct WindowMatrix { w: u32, } +struct Edits { + duration: u64, + start: u64, + play_rate: u32, +} + struct MOOV { mvhd: MVHD, traks: [TRAK; 2], @@ -19,10 +25,10 @@ struct MOOV { struct MVHD { version: u8, flags: u32, - create_time: u32, - modify_time: u32, + create_time: u64, + modify_time: u64, time_scale: u32, - duration: u32, + duration: u64, playrate: u32, volume: u16, matrix: WindowMatrix, @@ -36,13 +42,13 @@ struct TRAK { } struct TKHD { - version: u32, + version: u8, flags: u32, - create_time: u32, - modify_time: u32, + create_time: u64, + modify_time: u64, track_id: u32, time_scale: u32, - duration: u32, + duration: u64, layer: u16, alt_group: u16, volume: u16, @@ -51,8 +57,157 @@ struct TKHD { height: u32, } -struct EDTS; +struct EDTS { + elst: ELST, +} -struct MDIA; +struct ELST { + version: u8, + flags: u32, + num_edits: u32, + edits: Vec, +} -struct MVEX; +struct MDIA { + mdhd: MDHD, + hdlr: HDLR, + minf: MINF, +} + +struct MDHD { + version: u8, + flags: u32, + create_time: u64, + modify_time: u64, + time_scale: u32, + duration: u64, + language: u32, +} + +struct HDLR { + version: u8, + flags: u32, + handler: u32, + name: String, +} + +enum MINF { + Video(MINF_V), + Audio(MINF_A), +} + +struct MINF_V { + vmhd: VMHD, + dinf: DINF, + stbl: STBL, +} + +struct VMHD { + version: u8, + flags: u32, + mode: u16, + opcolor: [u16; 3], +} + +struct MINF_A { + smhd: SMHD, + dinf: DINF, + stbl: STBL, +} + +struct SMHD { + version: u8, + flags: u32, + balance: u16, +} + +struct DINF { + dref: DREF, +} + +struct DREF { + version: u8, + flags: u32, + num_refs: u32, + refs: Vec +} + +enum Refs { + RefURL(URL), + RefURN(URN), +} + +struct URL { + version: u8, + flags: u32, + url: String, +} + +struct URN { + version: u8, + flags: u32, + urn: String, +} + +struct STBL { + stsd: Vec, + stts: STTS, + stsc: STSC, + stsz: STSZ, + stco: STCO, + opts: Vec>, +} + +struct STTS { + version: u8, + flags: u32, + num_entires: u32, + entires: Vec, +} + +struct STTSEntry { + count_consec: u32, + duration: u32, +} + +struct STSC { + version: u8, + flags: u32, + num_entries: u32, + entries: Vec, +} + +struct STSCEntry { + chunk_idx: u32, + samples_per: u32, + data_ref_idx: u32, +} + +struct STSZ { + version: u8, + flags: u32, + common_size: u32, + num_entries: u32, + entries: Vec, +} + +struct STCO { + version: u8, + flags: u32, + num_entries: u32, + entries: Vec, +} + +struct MVEX { + trexs: [TREX; 2], +} + +struct TREX { + version: u8, + flags: u32, + track_id: u32, + default_desc_idx: u32, + default_duration: u32, + default_size: u32, + default_flags: u32, +}