static void readInfoHeader(Mp4Reader reader, out DateTime creationTime, out DateTime modificationTime, out TimeSpan duration, out CultureInfo culture, out uint timeScale) { uint ver = reader.readUInt(); switch (ver & 0xFF) { case 0: var v0 = reader.readStructure <MediaInfoV0>(); creationTime = v0.creationTime; modificationTime = v0.modificationTime; duration = v0.duration; culture = v0.culture; timeScale = v0.timeScale; return; case 1: var v1 = reader.readStructure <MediaInfoV1>(); creationTime = v1.creationTime; modificationTime = v1.modificationTime; duration = v1.duration; culture = v1.culture; timeScale = v1.timeScale; return; } throw new ApplicationException("Unsupported format version"); }
internal TrackHeader(Mp4Reader reader, uint timescale) { Debug.Assert(reader.currentBox == eBoxType.tkhd); uint versionAndFlags = reader.readUInt(); flags = (eTrackFlags)BinaryPrimitives.ReverseEndianness(versionAndFlags & 0xFFFFFF00u); switch (versionAndFlags & 0xFF) { case 0: var ver0 = reader.readStructure <TrackHeaderVersion0>(); ver0.parseHeader(timescale, out creationTime, out modificationTime, out id, out duration); ver0.parseCommon(out layer, out alternateGroup, out volume, out size); break; case 1: var ver1 = reader.readStructure <TrackHeaderVersion1>(); ver1.parseHeader(timescale, out creationTime, out modificationTime, out id, out duration); ver1.parseCommon(out layer, out alternateGroup, out volume, out size); break; default: throw new ArgumentException("Unsupported track version"); } }
internal MovieHeader(Mp4Reader reader) { Debug.Assert(reader.currentBox == eBoxType.mvhd); uint versionAndFlags = reader.readUInt(); switch (versionAndFlags & 0xFF) { case 0: var ver0 = reader.readStructure <MovieHeaderVersion0>(); ver0.parseHeader(out creationTime, out modificationTime, out duration, out timescale); ver0.parseCommon(out rate, out volume, out nextTrackId); break; case 1: var ver1 = reader.readStructure <MovieHeaderVersion1>(); ver1.parseHeader(out creationTime, out modificationTime, out duration, out timescale); ver1.parseCommon(out rate, out volume, out nextTrackId); break; default: throw new ArgumentException("Unsupported track version"); } }