Exemplo n.º 1
0
        private H264NALU Create(JT1078Package package, ReadOnlySpan <byte> naluheader, int startCodePrefix)
        {
            H264NALU nALU = new H264NALU();

            nALU.SIM                = package.SIM;
            nALU.DataType           = package.Label3.DataType;
            nALU.LogicChannelNumber = package.LogicChannelNumber;
            nALU.LastFrameInterval  = package.LastFrameInterval;
            nALU.LastIFrameInterval = package.LastIFrameInterval;
            if (startCodePrefix == 3)
            {
                nALU.StartCodePrefix = H264NALU.Start1;
            }
            else if (startCodePrefix == 4)
            {
                nALU.StartCodePrefix = H264NALU.Start2;
            }
            nALU.NALUHeader = new NALUHeader(naluheader);
            return(nALU);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps
        /// for the NALUs to the next stream component.
        /// Also, preprocess caption and sequence parameter NALUs.
        /// 常用Nalu_type:
        /// 0x67 (0 11 00111) SPS   非常重要              type = 7
        /// 0x68 (0 11 01000) PPS   非常重要              type = 8
        /// 0x65 (0 11 00101) IDR帧 关键帧(非常重要)      type = 5
        /// 0x61 (0 11 00001) I帧   重要                  type = 1  非IDR的I帧不大常见
        /// 0x41 (0 10 00001) P帧   重要                  type = 1
        /// 0x01 (0 00 00001) B帧   不重要                type = 1
        /// 0x06 (0 00 00110) SEI   不重要                type = 6
        /// <see cref="https://blog.csdn.net/huibailingyu/article/details/42879573"/>
        /// </summary>
        /// <param name="h264NALU"></param>
        /// <returns></returns>
        private void NALUTypeFilter(H264NALU h264NALU)
        {
            switch (h264NALU.NALUHeader.NalUnitType)
            {
            //IPB帧
            case 1:

                break;

            //IDR
            case 5:

                break;

            //SEI
            case 6:
                h264NALU.RawData = DiscardEmulationPreventionBytes(h264NALU.RawData);

                break;

            //SPS
            case 7:
                h264NALU.RawData = DiscardEmulationPreventionBytes(h264NALU.RawData);
                ExpGolombReader h264GolombReader = new ExpGolombReader(h264NALU.RawData);
                var             spsInfo          = h264GolombReader.ReadSPS();

                break;

            //PPS
            case 8:

                break;

            //AUD
            case 9:

                break;
            }
        }