/// <summary> /// Reads the box properties from stream. /// </summary> /// <param name="reader">The binary reader with the stream.</param> protected override void ReadBoxPropertiesFromStream(BoxBinaryReader reader) { var num = reader.ReadByte(); this.Profile = (num >> 6); this.Level = (num & 0xF) >> 1; this.AdvancedProfileLevel = reader.ReadByte() >> 5; this.flags = reader.ReadByte(); //no_interlace, no_multiple_seq, no_multiple_entry, no_slice_code, no_bframe this.Framerate = reader.ReadUInt32(); this.CodecPrivateData = reader.ReadBytes((int)(this.Size - (reader.Offset - this.Offset))); }
/// <summary> /// Reads the descriptor properties from stream. /// </summary> /// <param name="reader">The binary reader with the stream.</param> protected override void ReadDescriptorPropertiesFromStream(BoxBinaryReader reader) { var initialOffset = reader.Offset; this.ObjectTypeIndication = (DecoderObjectTypes)reader.ReadByte(); byte num = reader.ReadByte(); this.StreamType = (byte)((num >> 2) & 0x3f); this.UpStream = (num & 2) != 0; this.BufferSize = reader.ReadUInt24(); this.MaxBitrate = reader.ReadUInt32(); this.AverageBitrate = reader.ReadUInt32(); ReadSubDescriptors(reader, initialOffset); }
/// <summary> /// Reads the box properties from stream. /// </summary> /// <param name="reader">The binary reader with the stream.</param> protected override void ReadBoxPropertiesFromStream(BoxBinaryReader reader) { var offset = reader.Offset; this.RawBytes = reader.ReadBytes((int)this.Size); reader.GotoPosition(offset); this.ConfigurationVersion = reader.ReadByte(); this.AvcProfileIndication = reader.ReadByte(); this.AvcCompatibleProfiles = reader.ReadByte(); this.AvcLevelIndication = reader.ReadByte(); this.NaluLengthSize = (byte)(1 + (reader.ReadByte() & 3)); var numSequenceParameters = (byte)(reader.ReadByte() & 0x1f); for (uint i = 0; i < numSequenceParameters; i++) { var length = reader.ReadUInt16(); this.SequenceParameters.Add(reader.ReadBytes(length)); } var numPictureParameters = reader.ReadByte(); for (uint j = 0; j < numPictureParameters; j++) { var length = reader.ReadUInt16(); this.PictureParameters.Add(reader.ReadBytes(length)); } }
/// <summary> /// Reads the descriptor properties from stream. /// </summary> /// <param name="reader">The binary reader with the stream.</param> protected override void ReadDescriptorPropertiesFromStream(BoxBinaryReader reader) { var initialOffset = reader.Offset; this.ElementaryStreamId = reader.ReadUInt16(); byte num = reader.ReadByte(); this.Flags = (uint)((num >> 5) & 7); this.StreamPriority = (byte)(num & 0x1f); if ((this.Flags & 1) != 0) { this.DependsOn = reader.ReadUInt16(); } else { this.DependsOn = 0; } if ((this.Flags & 2) != 0) { byte count = reader.ReadByte(); if (count != 0) { byte[] buffer = new byte[count + 1]; reader.Read(buffer, 0, count); buffer[count] = 0; this.Url = Encoding.UTF8.GetString(buffer, 0, count); } } if ((this.Flags & 2) != 0) { this.OcrElementaryStreamId = reader.ReadUInt16(); } else { this.OcrElementaryStreamId = 0; } ReadSubDescriptors(reader, initialOffset); }
/// <summary> /// Reads the full box properties from stream. /// </summary> /// <param name="reader">The binary reader with the stream.</param> protected override void ReadFullBoxPropertiesFromStream(BoxBinaryReader reader) { int capacity = ((int)Size) - 12; for (int i = 0; i < capacity; i++) { var sample = new Sample(); byte num = reader.ReadByte(); sample.SampleDependsOn = (num & 0x30) >> 4; sample.SampleIsDependedOn = (num & 12) >> 2; sample.SampleHasRedundancy = num & 3; this.Samples.Add(sample); } }
/// <summary> /// Reads the box properties from stream. /// </summary> /// <param name="reader">The binary reader with the stream.</param> protected override void ReadFullBoxPropertiesFromStream(BoxBinaryReader reader) { if ((this.Flags & 1) != 0) { this.AuxInfoType = reader.ReadUInt32(); this.AuxInfoTypeParameter = reader.ReadUInt32(); } this.DefaultSampleInfoSize = reader.ReadByte(); this.SampleCount = reader.ReadUInt32(); if (this.DefaultSampleInfoSize == 0) { this.SampleInfoSize = reader.ReadBytes(System.Convert.ToInt32(this.SampleCount)); } }
private uint ReadIntValueFromBytes(BoxBinaryReader reader, byte numberOfBytes) { switch (numberOfBytes) { case 0: return(reader.ReadByte()); case 1: return(reader.ReadUInt16()); case 2: return(reader.ReadUInt24()); case 3: return(reader.ReadUInt32()); default: throw new BoxException("Specified number of bytes to parse an integer is not supported in the traf box."); } }
/// <summary> /// Reads the full box properties from stream. /// </summary> /// <param name="reader">The binary reader with the stream.</param> protected override void ReadFullBoxPropertiesFromStream(BoxBinaryReader reader) { this.DefaultIsEntrypted = reader.ReadUInt24(); this.DefaultIVSize = reader.ReadByte(); this.DefaultKID = reader.ReadGuid(); }
/// <summary> /// Reads the descriptor properties from stream. /// </summary> /// <param name="reader">The binary reader with the stream.</param> protected override void ReadDescriptorPropertiesFromStream(BoxBinaryReader reader) { this.Predefined = reader.ReadByte(); }
private uint ReadIntValueFromBytes(BoxBinaryReader reader, byte numberOfBytes) { switch (numberOfBytes) { case 0: return reader.ReadByte(); case 1: return reader.ReadUInt16(); case 2: return reader.ReadUInt24(); case 3: return reader.ReadUInt32(); default: throw new BoxException("Specified number of bytes to parse an integer is not supported in the traf box."); } }