h264parser

package
v1.1.4 Latest Latest
Warning

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

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

Documentation

Overview

Package h264parser Created by RTT. Author: teocci@yandex.com on 2021-Oct-27

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) (codecData CodecData, err error)

func NewCodecDataFromSPSAndPPS

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

func (CodecData) AVCDecoderConfRecordBytes

func (cd CodecData) AVCDecoderConfRecordBytes() []byte

func (CodecData) EmptyPPS

func (cd CodecData) EmptyPPS() bool

func (CodecData) EmptySPS

func (cd CodecData) EmptySPS() bool

func (CodecData) HasPPS

func (cd CodecData) HasPPS() bool

func (CodecData) HasSPS

func (cd CodecData) HasSPS() bool

func (CodecData) Height

func (cd CodecData) Height() int

func (CodecData) PPS

func (cd CodecData) PPS() []byte

func (CodecData) SPS

func (cd CodecData) SPS() []byte

func (CodecData) Type

func (cd CodecData) Type() av.CodecType

func (CodecData) Width

func (cd 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