예제 #1
0
        public override void WriteFields(Mp4Stream stream)
        {
            stream.WriteUInt08((byte)this.ObjectTypeIndication);
            byte num = (byte)(((this.StreamType << 2) | (this.UpStream ? 2 : 0)) | 1);

            stream.WriteUInt08(num);
            stream.WriteUInt24(this.BufferSize);
            stream.WriteUInt32(this.MaxBitrate);
            stream.WriteUInt32(this.AverageBitrate);
            foreach (Mp4Descriptor descriptor in this.SubDescriptors)
            {
                descriptor.Write(stream);
            }
        }
예제 #2
0
 public override void WriteHeader(Mp4Stream stream)
 {
     base.WriteHeader(stream);
     stream.WriteUInt08((byte)this.Version);
     stream.WriteUInt24(this.Flags);
 }
예제 #3
0
        public override void WriteBody(Mp4Stream stream)
        {
            stream.WriteUInt32(this.TrackId);
            uint num = (uint)(this.Reserved << 6);

            num |= (uint)(this.LengthSizeOfTrafNum << 4);
            num |= (uint)(this.LengthSizeOfTrunNum << 2);
            num |= this.LengthSizeOfSampleNum;
            stream.WriteUInt32(num);
            stream.WriteUInt32((uint)this.NumberOfEntry);
            for (int i = 0; i < this.Entries.Count; i++)
            {
                Mp4TfraEntry entry = this.Entries[i];
                if (base.Version == 1)
                {
                    stream.WriteUInt64(entry.Time);
                    stream.WriteUInt64(entry.MoofOffset);
                }
                else
                {
                    stream.WriteUInt32((uint)entry.Time);
                    stream.WriteUInt32((uint)entry.MoofOffset);
                }
                switch (this.LengthSizeOfTrafNum)
                {
                case 0:
                    stream.WriteUInt08((byte)entry.TrafNumber);
                    break;

                case 1:
                    stream.WriteUInt16((ushort)entry.TrafNumber);
                    break;

                case 2:
                    stream.WriteUInt24(entry.TrafNumber);
                    break;

                case 3:
                    stream.WriteUInt32(entry.TrafNumber);
                    break;
                }
                switch (this.LengthSizeOfTrunNum)
                {
                case 0:
                    stream.WriteUInt08((byte)entry.TrunNumber);
                    break;

                case 1:
                    stream.WriteUInt16((ushort)entry.TrunNumber);
                    break;

                case 2:
                    stream.WriteUInt24(entry.TrunNumber);
                    break;

                case 3:
                    stream.WriteUInt32(entry.TrunNumber);
                    break;
                }
                switch (this.LengthSizeOfSampleNum)
                {
                case 0:
                    stream.WriteUInt08((byte)entry.SampleNumber);
                    break;

                case 1:
                    stream.WriteUInt16((ushort)entry.SampleNumber);
                    break;

                case 2:
                    stream.WriteUInt24(entry.SampleNumber);
                    break;

                case 3:
                    stream.WriteUInt32(entry.SampleNumber);
                    break;
                }
            }
        }