public MediaBox(IsochronousTrackInfo trackInfo) : this() { ulong scaledDuration = (ulong)TimeArithmetic.ConvertToTimeScale(trackInfo.TimeScale, trackInfo.DurationIn100NanoSecs); MediaHeaderBox = new MediaHeaderBox(this, scaledDuration, trackInfo.TimeScale); this.Size += MediaHeaderBox.Size; Codec codec = null; if (trackInfo.GetType() == typeof(RawAudioTrackInfo)) { RawAudioTrackInfo audioInfo = (RawAudioTrackInfo)trackInfo; codec = new Codec(CodecTypes.Audio); codec.PrivateCodecData = audioInfo.CodecPrivateData; } else if (trackInfo.GetType() == typeof(RawVideoTrackInfo)) { RawVideoTrackInfo videoInfo = (RawVideoTrackInfo)trackInfo; codec = new Codec(CodecTypes.Video); codec.PrivateCodecData = videoInfo.CodecPrivateData; } HandlerReferenceBox = new HandlerReferenceBox(this, codec); this.Size += HandlerReferenceBox.Size; MediaInformationBox = new MediaInformationBox(this, trackInfo); // MediaInformationBox.Size is indeterminate at this time; it is determined only during SampleTableBox.FinalizeBox }
public MediaInformationBox(MediaBox inParent, IsochronousTrackInfo trackInfo) : this(inParent) { if (trackInfo.GetType() == typeof(RawAudioTrackInfo)) { SoundMediaHeaderBox = new SoundMediaHeaderBox(); this.Size += SoundMediaHeaderBox.Size; } else if (trackInfo.GetType() == typeof(RawVideoTrackInfo)) { VideoMediaHeaderBox = new VideoMediaHeaderBox(); this.Size += VideoMediaHeaderBox.Size; } DataInformationBox = new DataInformationBox(); this.Size += DataInformationBox.Size; SampleTableBox = new SampleTableBox(this, trackInfo); // Size for SampleTableBox is determined only during SampleTableBox.FinalizeBox }