示例#1
0
        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
        }
示例#2
0
 public override void Write(BoxWriter writer)
 {
     using (new SizeCalculator(this, writer))
     {
         base.Write(writer);
         MediaHeaderBox.Write(writer);
         HandlerReferenceBox.Write(writer);
         MediaInformationBox.Write(writer);
     }
 }
示例#3
0
        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());
        }
示例#4
0
        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);
              }
        }
示例#5
0
        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);
            }
        }
示例#6
0
 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
 }