Documentation ¶
Index ¶
- Constants
- Variables
- func BuildSeqHeaderFromSPSPPS(sps, pps []byte) ([]byte, error)
- func CaptureAVCC2AnnexB(w io.Writer, payload []byte) error
- func ParseNALUType(v uint8) uint8
- func ParseNALUTypeReadable(v uint8) string
- func ParseSPS(payload []byte, ctx *Context) error
- func ParseSPSPPSFromSeqHeader(payload []byte) (sps, pps []byte, err error)
- func ParseSliceType(nalu []byte) (uint8, error)
- func ParseSliceTypeReadable(nalu []byte) (string, error)
- func SPSPPSSeqHeader2AnnexB(payload []byte) ([]byte, error)
- func TryParsePPS(payload []byte) error
- func TryParseSeqHeader(payload []byte) error
- type Context
- type DecoderConfigurationRecord
- type SPS
Constants ¶
Variables ¶
View Source
var ( NALUStartCode3 = []byte{0x0, 0x0, 0x1} NALUStartCode4 = []byte{0x0, 0x0, 0x0, 0x1} )
View Source
var ErrAVC = errors.New("lal.avc: fxxk")
View Source
var NALUTypeMapping = map[uint8]string{
1: "SLICE",
5: "IDR",
6: "SEI",
7: "SPS",
8: "PPS",
9: "AUD",
}
View Source
var SliceTypeMapping = map[uint8]string{
0: "P",
1: "B",
2: "I",
3: "SP",
4: "SI",
5: "P",
6: "B",
7: "I",
8: "SP",
9: "SI",
}
Functions ¶
func BuildSeqHeaderFromSPSPPS ¶
返回的内存块为新申请的独立内存块
func CaptureAVCC2AnnexB ¶
AVCC -> AnnexB
@param <payload> rtmp message的payload部分或者flv tag的payload部分
注意,包含了头部2字节类型以及3字节的cts
func ParseNALUType ¶
func ParseNALUTypeReadable ¶
func ParseSPSPPSFromSeqHeader ¶
从AVCC格式的Seq Header中得到SPS和PPS内存块
@param <payload> rtmp message的payload部分或者flv tag的payload部分
注意,包含了头部2字节类型以及3字节的cts
@return 注意,返回的sps,pps内存块指向的是传入参数<payload>内存块的内存
func ParseSliceType ¶
func ParseSliceTypeReadable ¶
func SPSPPSSeqHeader2AnnexB ¶
AVCC Seq Header -> AnnexB 注意,返回的内存块为独立的内存块,不依赖指向传输参数<payload>内存块
func TryParseSeqHeader ¶
尝试解析SeqHeader所有字段,实验中,请勿直接使用该函数
@param <payload> rtmp message的payload部分或者flv tag的payload部分
注意,包含了头部2字节类型以及3字节的cts
Types ¶
type DecoderConfigurationRecord ¶
type DecoderConfigurationRecord struct { ConfigurationVersion uint8 AVCProfileIndication uint8 ProfileCompatibility uint8 AVCLevelIndication uint8 LengthSizeMinusOne uint8 NumOfSPS uint8 SPSLength uint16 NumOfPPS uint8 PPSLength uint16 }
H.264-AVC-ISO_IEC_14496-15.pdf 5.2.4 Decoder configuration information
type SPS ¶
type SPS struct { ProfileIdc uint8 ConstraintSet0Flag uint8 ConstraintSet1Flag uint8 ConstraintSet2Flag uint8 LevelIdc uint8 SPSId uint32 ChromaFormatIdc uint32 ResidualColorTransformFlag uint8 BitDepthLuma uint32 BitDepthChroma uint32 TransFormBypass uint8 Log2MaxFrameNumMinus4 uint32 PicOrderCntType uint32 Log2MaxPicOrderCntLsb uint32 NumRefFrames uint32 // num_ref_frames GapsInFrameNumValueAllowedFlag uint8 // gaps_in_frame_num_value_allowed_flag PicWidthInMbsMinusOne uint32 // pic_width_in_mbs_minus1 PicHeightInMapUnitsMinusOne uint32 // pic_height_in_map_units_minus1 FrameMbsOnlyFlag uint8 // frame_mbs_only_flag MbAdaptiveFrameFieldFlag uint8 // mb_adaptive_frame_field_flag Direct8X8InferenceFlag uint8 // direct_8x8_inference_flag FrameCroppingFlag uint8 // frame_cropping_flag FrameCropLeftOffset uint32 // frame_crop_left_offset FrameCropRightOffset uint32 // frame_crop_right_offset FrameCropTopOffset uint32 // frame_crop_top_offset FrameCropBottomOffset uint32 // frame_crop_bottom_offset }
ISO-14496-10.pdf 7.3.2.1 Sequence parameter set RBSP syntax 7.4.2.1 Sequence parameter set RBSP semantics
Click to show internal directories.
Click to hide internal directories.