h264parser

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NALU_SEI     = 6
	NALU_SPS     = 7
	NALU_PPS     = 8
	NALU_AUD     = 9
	Extended_SAR = 255
)
View Source
const (
	NALU_RAW = iota
	NALU_AVCC
	NALU_ANNEXB
)
View Source
const (
	SLICE_P = iota + 1
	SLICE_B
	SLICE_I
)

Variables

View Source
var (
	StartCodeBytes = []byte{0, 0, 1}
	AUDBytes       = []byte{0, 0, 0, 1, 0x9, 0xf0, 0, 0, 0, 1} // AUD
)
View Source
var ErrDecconfInvalid = fmt.Errorf("h264parser: AVCDecoderConfRecord invalid")

Functions

func CheckNALUsType

func CheckNALUsType(b []byte) (typ int)

func GetNALUType

func GetNALUType(b []byte) byte

func IsDataNALU

func IsDataNALU(b []byte) bool

func IsSPSNALU

func IsSPSNALU(b []byte) bool

func SplitNALUs

func SplitNALUs(b []byte) (nalus [][]byte, typ int)

Types

type AVCDecoderConfRecord

type AVCDecoderConfRecord struct {
	AVCProfileIndication uint8
	ProfileCompatibility uint8
	AVCLevelIndication   uint8
	LengthSizeMinusOne   uint8
	SPS                  [][]byte
	PPS                  [][]byte
}

func (AVCDecoderConfRecord) Len

func (self AVCDecoderConfRecord) Len() (n int)

func (AVCDecoderConfRecord) Marshal

func (self AVCDecoderConfRecord) Marshal(b []byte) (n int)

func (*AVCDecoderConfRecord) Unmarshal

func (self *AVCDecoderConfRecord) Unmarshal(b []byte) (n int, err error)

type CodecData

type CodecData struct {
	Record     []byte
	RecordInfo AVCDecoderConfRecord
	SPSInfo    SPSInfo
}

func NewCodecDataFromAVCDecoderConfRecord

func NewCodecDataFromAVCDecoderConfRecord(record []byte) (self CodecData, err error)

func NewCodecDataFromSPSAndPPS

func NewCodecDataFromSPSAndPPS(sps, pps []byte) (self CodecData, err error)

func (CodecData) AVCDecoderConfRecordBytes

func (self CodecData) AVCDecoderConfRecordBytes() []byte

func (CodecData) Height

func (self CodecData) Height() int

func (CodecData) PPS

func (self CodecData) PPS() []byte

func (CodecData) SPS

func (self CodecData) SPS() []byte

func (CodecData) Type

func (self CodecData) Type() av.CodecType

func (CodecData) Width

func (self CodecData) Width() int

type SPSInfo

type SPSInfo struct {
	ProfileIdc uint
	LevelIdc   uint

	MbWidth  uint
	MbHeight uint

	CropLeft   uint
	CropRight  uint
	CropTop    uint
	CropBottom uint

	Width  uint
	Height uint
}

func ParseSPS

func ParseSPS(data []byte) (self SPSInfo, err error)

type SliceType

type SliceType uint

func ParseSliceHeaderFromNALU

func ParseSliceHeaderFromNALU(packet []byte) (sliceType SliceType, err error)

func (SliceType) String

func (self SliceType) String() string

type VUIInfo

type VUIInfo struct {
	Aspect_ratio_info_present_flag          uint // u(1)
	Aspect_ratio_idc                        uint // u(8)
	Sar_width                               uint // u(16)
	Sar_height                              uint // u(16)
	Overscan_info_present_flag              uint // u(1)
	Overscan_appropriate_flag               uint // u(1)
	Video_signal_type_present_flag          uint // u(1)
	Video_format                            uint // u(3)
	Video_full_range_flag                   uint // u(1)
	Colour_description_present_flag         uint // u(1)
	Colour_primaries                        uint // u(8)
	Transfer_characteristics                uint // u(8)
	Matrix_coefficients                     uint // u(8)
	Chroma_loc_info_present_flag            uint // u(1)
	Chroma_sample_loc_type_top_field        uint // ue(v)
	Chroma_sample_loc_type_bottom_field     uint // ue(v)
	Timing_info_present_flag                uint // u(1)
	Num_units_in_tick                       uint // u(32)
	Time_scale                              uint // u(32)
	Fixed_frame_rate_flag                   uint // u(1)
	Nal_hrd_parameters_present_flag         uint // u(1)
	Vcl_hrd_parameters_present_flag         uint // u(1)
	Low_delay_hrd_flag                      uint // u(1)
	Pic_struct_present_flag                 uint // u(1)
	Bitstream_restriction_flag              uint // u(1)
	Motion_vectors_over_pic_boundaries_flag uint // u(1)
	Max_bytes_per_pic_denom                 uint // ue(v)
	Max_bits_per_mb_denom                   uint // ue(v)
	Log2_max_mv_length_horizontal           uint // ue(v)
	Log2_max_mv_length_vertical             uint // ue(v)
	Max_num_reorder_frames                  uint // ue(v)
	Max_dec_frame_buffering                 uint // ue(v)
}

func ParseVUI

func ParseVUI(data []byte, bitPointer int) (self VUIInfo, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL