From 6ddfa37fd20cc2a179ca593d26eb3e5fa6a13db8 Mon Sep 17 00:00:00 2001 From: "SmallChi(Koike)" <564952747@qq.com> Date: Thu, 24 Sep 2020 17:56:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0avcC=E7=9B=92=E5=AD=90?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/JT1078.FMp4/Boxs/AVCConfigurationBox.cs | 60 +++++++++++++-------- 1 file changed, 37 insertions(+), 23 deletions(-) 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); } }