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 override void Write(BoxWriter writer) { using (new SizeCalculator(this, writer)) { base.Write(writer); MediaHeaderBox.Write(writer); HandlerReferenceBox.Write(writer); MediaInformationBox.Write(writer); } }
public override string ToString() { StringBuilder xml = new StringBuilder(); xml.Append(base.ToString()); xml.Append(MediaHeaderBox.ToString()); xml.Append(HandlerReferenceBox.ToString()); xml.Append(MediaInformationBox.ToString()); xml.Append("</box>"); return(xml.ToString()); }
public override void Read(BoxReader reader) { using (new SizeChecker(this, reader)) { base.Read(reader); MediaHeaderBox = new MediaHeaderBox(this); HandlerReferenceBox = new HandlerReferenceBox(this); MediaInformationBox = new MediaInformationBox(this); MediaHeaderBox.Read(reader); HandlerReferenceBox.Read(reader); MediaInformationBox.Read(reader); } }
/// <summary> /// Constructor to use when building the box from scratch. /// NOTE: We don't compute the Size of this box in this constructor. /// The Size of this box is computed during FinalizeBox. /// NOTE: The ordering of the sub-boxes is not determined in the constructor. /// Writing out the sub-boxes (see the Write method below) determines the order of sub-boxes. /// </summary> /// <param name="inParent">MediaInformationBox</param> /// <param name="trackInfo">IsochronousTrackInfo</param> public SampleTableBox(MediaInformationBox inParent, IsochronousTrackInfo trackInfo) : this(inParent) { CTTSOut = trackInfo.CTTSOut; fragmented = trackInfo.IsFragment; SampleDescriptionsBox = new SampleDescriptionsBox(this, trackInfo); DecodingTimeToSampleBox = new DecodingTimeToSampleBox(this); SampleToChunkBox = new SampleToChunkBox(this); SampleSizeBox = new SampleSizeBox(this); ChunkOffSetBox = new ChunkOffSetBox(this); if ((trackInfo is RawVideoTrackInfo) && !fragmented) { SyncSampleMapBox = new SyncSampleMapBox(); //CompositionTimeToSample = new CompositionTimeToSample(this); } }
public SampleTableBox(MediaInformationBox inParent) : base(BoxTypes.SampleTable) { parent = inParent; }
public void FinalizeBox() { MediaInformationBox.FinalizeBox(); this.Size += MediaInformationBox.Size; }