h264parser

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NALU_SEI = 6
	NALU_PPS = 7
	NALU_SPS = 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 PktToCodecData

func PktToCodecData(pkt av.Packet) (h264CodecData av.CodecData, err error)

PktToCodecData parses NAL units to find SPS and PPS, and derive codec data from them. h264CodecData can be nil if the SPS and/or PPS is not found

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

func (self CodecData) Framerate() (int, int)

func (CodecData) Height

func (self CodecData) Height() int

func (CodecData) PPS

func (self CodecData) PPS() []byte

func (CodecData) PacketDuration

func (self CodecData) PacketDuration([]byte) (dur time.Duration, err error)

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

	FpsNum uint
	FpsDen 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

Jump to

Keyboard shortcuts

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