public Mp4StsdBox(Mp4SampleTable sampleTable) : base(12, Mp4BoxType.STSD) { this.Entries = new List <Mp4Box>(); this.Size += 4; int sampleDescriptionCount = sampleTable.SampleDescriptionCount; for (int i = 0; i < sampleDescriptionCount; i++) { Mp4SampleEntry sampleDescription = sampleTable.GetSampleDescription(i); this.Entries.Add(sampleDescription); this.Size += sampleDescription.Size; } }
public Mp4Track(Mp4TrackType type, Mp4SampleTable sampleTable, uint trackId, DateTime creationTime, DateTime modificationTime, ulong trackDuration, uint mediaTimeScale, ulong mediaDuration, string language, uint width, uint height) { uint sOUN; string str; this.Type = type; this.SampleTable = sampleTable; uint num = 0; if (type == Mp4TrackType.AUDIO) { num = 0x100; } switch (type) { case Mp4TrackType.AUDIO: sOUN = Mp4HandlerType.SOUN; str = "CM Stream MP4 Sound Handler"; break; case Mp4TrackType.VIDEO: sOUN = Mp4HandlerType.VIDE; str = "CM Stream MP4 Video Handler"; break; case Mp4TrackType.HINT: sOUN = Mp4HandlerType.HINT; str = "CM Stream MP4 Hint Handler"; break; case Mp4TrackType.TEXT: sOUN = Mp4HandlerType.TEXT; str = "CM Stream MP4 Text Handler"; break; default: sOUN = 0; str = null; break; } this.TrakBox = new Mp4TrakBox(sampleTable, sOUN, str, trackId, creationTime, modificationTime, trackDuration, mediaTimeScale, mediaDuration, (ushort)num, language, width, height); }
public Mp4TrakBox(Mp4SampleTable sampleTable, uint hdlrType, string hdlrName, uint trackId, DateTime creationTime, DateTime modificationTime, ulong trackDuration, uint mediaTimeScale, ulong mediaDuration, ushort volume, string language, uint width, uint height) : base(8, Mp4BoxType.TRAK) { Mp4Box box4; this.TkhdBox = new Mp4TkhdBox(creationTime, modificationTime, trackId, trackDuration, volume, width, height); Mp4MdiaBox child = new Mp4MdiaBox(); Mp4HdlrBox box2 = new Mp4HdlrBox(hdlrType, hdlrName); Mp4ContainerBox box3 = new Mp4ContainerBox(8, Mp4BoxType.MINF); if (hdlrType == Mp4HandlerType.VIDE) { box4 = new Mp4VmhdBox(0, 0, 0, 0); } else if (hdlrType == Mp4HandlerType.SOUN) { box4 = new Mp4SmhdBox(0); } else { box4 = new Mp4NmhdBox(); } Mp4ContainerBox box5 = new Mp4ContainerBox(8, Mp4BoxType.DINF); Mp4Box box6 = new Mp4UrlBox(); Mp4DrefBox box7 = new Mp4DrefBox(new Mp4Box[] { box6 }); Mp4ContainerBox box8 = sampleTable?.GenerateStblAtom(); box5.AddChild(box7); box3.AddChild(box4); box3.AddChild(box5); if (box8 != null) { box3.AddChild(box8); } this.MdhdBox = new Mp4MdhdBox(creationTime, modificationTime, mediaTimeScale, mediaDuration, language); child.AddChild(this.MdhdBox); child.AddChild(box2); child.AddChild(box3); base.AddChild(this.TkhdBox); base.AddChild(child); }