h264parser

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NALU_SEI = 6
	NALU_SPS = 7
	NALU_PPS = 8
	NALU_AUD = 9
)
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 AUDBytes = []byte{0, 0, 0, 1, 0x9, 0xf0, 0, 0, 0, 1} // AUD
View Source
var ErrDecconfInvalid = fmt.Errorf("h264parser: AVCDecoderConfRecord invalid")
View Source
var StartCodeBytes = []byte{0, 0, 1}

Functions

func CheckNALUsType

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

func IsDataNALU

func IsDataNALU(b []byte) bool

func RemoveH264orH265EmulationBytes

func RemoveH264orH265EmulationBytes(b []byte) []byte

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) Bandwidth

func (self CodecData) Bandwidth() string

func (CodecData) FPS

func (self CodecData) FPS() int

func (CodecData) Height

func (self CodecData) Height() int

func (CodecData) PPS

func (self CodecData) PPS() []byte

func (CodecData) PacketDuration

func (self CodecData) PacketDuration(data []byte) time.Duration

func (CodecData) Resolution

func (self CodecData) Resolution() string

func (CodecData) SPS

func (self CodecData) SPS() []byte

func (CodecData) Tag

func (self CodecData) Tag() string

func (CodecData) Type

func (self CodecData) Type() av.CodecType

func (CodecData) Width

func (self CodecData) Width() int

type SPSInfo

type SPSInfo struct {
	Id                uint
	ProfileIdc        uint
	LevelIdc          uint
	ConstraintSetFlag uint

	MbWidth  uint
	MbHeight uint

	CropLeft   uint
	CropRight  uint
	CropTop    uint
	CropBottom uint

	Width  uint
	Height uint
	FPS    uint
}

func ParseSPS

func ParseSPS(data []byte) (s 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

Jump to

Keyboard shortcuts

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