diff --git a/src/JT1078.FMp4/Boxs/AVCConfigurationBox.cs b/src/JT1078.FMp4/Boxs/AVCConfigurationBox.cs index d2c71b2..364a98b 100644 --- a/src/JT1078.FMp4/Boxs/AVCConfigurationBox.cs +++ b/src/JT1078.FMp4/Boxs/AVCConfigurationBox.cs @@ -17,27 +17,33 @@ namespace JT1078.FMp4 public AVCConfigurationBox() : base("avcC") { } - + #region + //public const int LengthSizeMinusOnePaddingBits = 63; + //public const int NumberOfSequenceParameterSetsPaddingBits = 7; + //public const int ChromaFormatPaddingBits = 31; + //public const int BitDepthLumaMinus8PaddingBits = 31; + //public const int BitDepthChromaMinus8PaddingBits = 31; + #endregion //AVCDecoderConfigurationRecord 结构的定义: //aligned(8) class AVCDecoderConfigurationRecord //{ - //unsigned int (8) configurationVersion = 1; - //unsigned int (8) AVCProfileIndication; - //unsigned int (8) profile_compatibility; - //unsigned int (8) AVCLevelIndication; - //bit(6) reserved = ‘111111’b; - //unsigned int (2) lengthSizeMinusOne; - //bit(3) reserved = ‘111’b; - //unsigned int (5) numOfSequenceParameterSets; - //for (i=0; i SPS { get; set; } + //public List<(ushort SequenceParameterSetLength,byte[] SequenceParameterSetNALUnit)> SPS { get; set; } public byte[] SPSBuffer { get; set; } public byte NumOfPictureParameterSets { get; set; } = 1; - public List<(ushort PictureParameterSetLength,byte[] PictureParameterSetNALUnit)> PPS { get; set; } + //public List<(ushort PictureParameterSetLength,byte[] PictureParameterSetNALUnit)> PPS { get; set; } public byte[] PPSBuffer { get; set; } public void ToBuffer(ref FMp4MessagePackWriter writer) { Start(ref writer); - //todo:AVCConfigurationBox - - + writer.WriteByte(ConfigurationVersion); + writer.WriteByte(AVCProfileIndication); + writer.WriteByte(ProfileCompatibility); + writer.WriteByte(AVCLevelIndication); + writer.WriteByte((byte)(0xfc | LengthSizeMinusOne)); + writer.WriteByte((byte)(0xE0 | NumOfSequenceParameterSets)); + writer.WriteUInt16((ushort)SPSBuffer.Length); + writer.WriteArray(SPSBuffer); + writer.WriteByte(NumOfPictureParameterSets); + writer.WriteUInt16((ushort)PPSBuffer.Length); + writer.WriteArray(PPSBuffer); End(ref writer); } }