Пример #1
0
 public HandlerReferenceBox(MediaBox inParent)
     : base(BoxTypes.HandlerReference)
 {
     parent = inParent;
       handler_type = new byte[4];
       this.Size += 20UL;  // does not include Name (see below)
 }
Пример #2
0
 public MediaHeaderBox(MediaBox inParent, ulong duration, uint timeScale)
     : this(inParent)
 {
     base.Version = (byte)((duration < uint.MaxValue) ? 0 : 1); // set this to 1 (see constructor above)
       //base.Version = 1;
       if (base.Version == 1)
     this.Size += 32UL;
       else
     this.Size += 20UL;
       this.creationTime = (ulong)DateTime.Now.Ticks;
       this.modificationTime = (ulong)DateTime.Now.Ticks;
       this.Duration = duration;
       this.TimeScale = timeScale;
       this.language = 5575; // 5575 (English language?)
 }
Пример #3
0
 public HandlerReferenceBox(MediaBox inParent, Codec codec)
     : this(inParent)
 {
     base.Version = 0;
       if (codec.CodecType == CodecTypes.Audio)
       {
     HandlerType = "soun";
     Name = "Sound Media Handler";
       }
       else if (codec.CodecType == CodecTypes.Video)
       {
     HandlerType = "vide";
     Name = "Video Media Handler";
       }
       else HandlerType = "unkn"; // unknown
       this.Size += (ulong)Name.Length + 1UL;
 }
Пример #4
0
 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
 }
Пример #5
0
 public MediaHeaderBox(MediaBox inParent, ulong duration, uint timeScale)
     : this(inParent)
 {
     base.Version = (byte)((duration < uint.MaxValue) ? 0 : 1); // set this to 1 (see constructor above)
     //base.Version = 1;
     if (base.Version == 1)
     {
         this.Size += 32UL;
     }
     else
     {
         this.Size += 20UL;
     }
     this.creationTime     = (ulong)DateTime.Now.Ticks;
     this.modificationTime = (ulong)DateTime.Now.Ticks;
     this.Duration         = duration;
     this.TimeScale        = timeScale;
     this.language         = 5575; // 5575 (English language?)
 }
Пример #6
0
 public HandlerReferenceBox(MediaBox inParent, Codec codec)
     : this(inParent)
 {
     base.Version = 0;
     if (codec.CodecType == CodecTypes.Audio)
     {
         HandlerType = "soun";
         Name        = "Sound Media Handler";
     }
     else if (codec.CodecType == CodecTypes.Video)
     {
         HandlerType = "vide";
         Name        = "Video Media Handler";
     }
     else
     {
         HandlerType = "unkn"; // unknown
     }
     this.Size += (ulong)Name.Length + 1UL;
 }
Пример #7
0
        public override string ToString()
        {
            StringBuilder xml = new StringBuilder();

            xml.Append(base.ToString());

            xml.Append(TrackHeaderBox.ToString());
            if (MediaBox != null)
            {
                xml.Append(MediaBox.ToString());
            }
            if (TrackReferenceBox != null)
            {
                xml.Append(TrackReferenceBox.ToString());
            }
            if (EdtsBox != null)
            {
                xml.Append(EdtsBox.ToString());
            }
            xml.Append("</box>");
            return(xml.ToString());
        }
Пример #8
0
        public TrackBox(IsochronousTrackInfo trackInfo)
            : this()
        {
            float height = 0.0f;
            float width  = 0.0f;

            if (trackInfo is RawVideoTrackInfo)
            {
                // set the TRACK width, which may differ from SampleDescription width and height, depending on Aspect Ratio
                RawVideoTrackInfo rvti = (RawVideoTrackInfo)trackInfo;
                height = rvti.Height;
                width  = rvti.Width * ((float)rvti.AspectRatioX / (float)rvti.AspectRatioY);
            }
            ulong scaledDuration = (ulong)TimeArithmetic.ConvertToTimeScale(trackInfo.MovieTimeScale, trackInfo.DurationIn100NanoSecs);

            TrackHeaderBox = new TrackHeaderBox((uint)trackInfo.TrackID, scaledDuration, height, width);
            // TrackHeaderBox = new TrackHeaderBox((uint)trackInfo.TrackID, (trackInfo.Duration * oneSecondTicks) / trackInfo.TimeScale, height, width);
            this.Size += TrackHeaderBox.Size;

            // skip the TrackReferenceBox for now
            //TrackReferenceBox = new TrackReferenceBox((uint)trackInfo.TrackID);
            //this.Size += TrackReferenceBox.Size;

#if EDTS_OUT
            EdtsBox = (EdtsBox)trackInfo.GetEdtsBox();
            if (EdtsBox != null)
            {
                this.Size += EdtsBox.Size;
                EdtsBox.ScaleToTarget(trackInfo.MovieTimeScale, trackInfo.TimeScale);
            }
#endif

            MediaBox = new MediaBox(trackInfo);
            // MediaBox.Size can only be determined during FinalizeBox
            // NOTE: NO Esds Box
        }
Пример #9
0
        public TrackBox(IsochronousTrackInfo trackInfo)
            : this()
        {
            float height = 0.0f;
              float width = 0.0f;
              if (trackInfo is RawVideoTrackInfo)
              {
            // set the TRACK width, which may differ from SampleDescription width and height, depending on Aspect Ratio
            RawVideoTrackInfo rvti = (RawVideoTrackInfo)trackInfo;
            height = rvti.Height;
            width = rvti.Width * ((float)rvti.AspectRatioX / (float)rvti.AspectRatioY);
              }
              ulong scaledDuration = (ulong)TimeArithmetic.ConvertToTimeScale(trackInfo.MovieTimeScale, trackInfo.DurationIn100NanoSecs);
              TrackHeaderBox = new TrackHeaderBox((uint)trackInfo.TrackID, scaledDuration, height, width);
              // TrackHeaderBox = new TrackHeaderBox((uint)trackInfo.TrackID, (trackInfo.Duration * oneSecondTicks) / trackInfo.TimeScale, height, width);
              this.Size += TrackHeaderBox.Size;

              // skip the TrackReferenceBox for now
              //TrackReferenceBox = new TrackReferenceBox((uint)trackInfo.TrackID);
              //this.Size += TrackReferenceBox.Size;

            #if EDTS_OUT
              EdtsBox = (EdtsBox)trackInfo.GetEdtsBox();
              if (EdtsBox != null)
              {
            this.Size += EdtsBox.Size;
            EdtsBox.ScaleToTarget(trackInfo.MovieTimeScale, trackInfo.TimeScale);
              }
            #endif

              MediaBox = new MediaBox(trackInfo);
              // MediaBox.Size can only be determined during FinalizeBox
              // NOTE: NO Esds Box
        }
Пример #10
0
        public override void Read(BoxReader reader)
        {
            using (new SizeChecker(this, reader)) {
            base.Read(reader);

            TrackHeaderBox.Read(reader);
            while (this.Size > (ulong)(reader.BaseStream.Position - (long)this.Offset)) {
              long pos = reader.BaseStream.Position;
              BoxType next = reader.PeekNextBoxType();
              if (next == BoxTypes.Edts)
              {
              EdtsBox = new EdtsBox();
              EdtsBox.movieTimeScale = movieTimeScale;
              EdtsBox.Read(reader);
              }
              else if (next == BoxTypes.TrackReference)
              {
              TrackReferenceBox = new TrackReferenceBox();
              TrackReferenceBox.Read(reader);
              }
              else if (next == BoxTypes.Media)
              {
              MediaBox = new MediaBox(this);
              MediaBox.Read(reader);
              }
              else
              {
              Box unknown = new Box(BoxTypes.Any);
              unknown.Read(reader);
              Debug.WriteLine(string.Format("Unknow box type {0} in Trak box, skipped", next.ToString()));
              }
            }
              }
        }
Пример #11
0
 public MediaHeaderBox(MediaBox inParent)
     : base(BoxTypes.MediaHeader)
 {
     parent = inParent;
 }
Пример #12
0
 public HandlerReferenceBox(MediaBox inParent) : base(BoxTypes.HandlerReference)
 {
     parent       = inParent;
     handler_type = new byte[4];
     this.Size   += 20UL; // does not include Name (see below)
 }
Пример #13
0
 public void FinalizeBox()
 {
     MediaBox.FinalizeBox();
     this.Size += MediaBox.Size;
 }
Пример #14
0
 public MediaInformationBox(MediaBox inParent) : base(BoxTypes.MediaInformation)
 {
     parent = inParent;
 }
Пример #15
0
 public MediaInformationBox(MediaBox inParent)
     : base(BoxTypes.MediaInformation)
 {
     parent = inParent;
 }
Пример #16
0
 public MediaHeaderBox(MediaBox inParent) : base(BoxTypes.MediaHeader)
 {
     parent = inParent;
 }