hevc

package
v0.34.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const (
	NaluTypeSliceTrailN uint8 = 0 // 0x0
	NaluTypeSliceTrailR uint8 = 1 // 0x01
	NaluTypeSliceTsaN   uint8 = 2 // 0x02
	NaluTypeSliceTsaR   uint8 = 3 // 0x03
	NaluTypeSliceStsaN  uint8 = 4 // 0x04
	NaluTypeSliceStsaR  uint8 = 5 // 0x05
	NaluTypeSliceRadlN  uint8 = 6 // 0x06
	NaluTypeSliceRadlR  uint8 = 7 // 0x07
	NaluTypeSliceRaslN  uint8 = 8 // 0x06
	NaluTypeSliceRaslR  uint8 = 9 // 0x09

	NaluTypeSliceBlaWlp       uint8 = 16 // 0x10
	NaluTypeSliceBlaWradl     uint8 = 17 // 0x11
	NaluTypeSliceBlaNlp       uint8 = 18 // 0x12
	NaluTypeSliceIdr          uint8 = 19 // 0x13
	NaluTypeSliceIdrNlp       uint8 = 20 // 0x14
	NaluTypeSliceCranut       uint8 = 21 // 0x15
	NaluTypeSliceRsvIrapVcl22 uint8 = 22 // 0x16
	NaluTypeSliceRsvIrapVcl23 uint8 = 23 // 0x17

	NaluTypeVps       uint8 = 32 // 0x20
	NaluTypeSps       uint8 = 33 // 0x21
	NaluTypePps       uint8 = 34 // 0x22
	NaluTypeAud       uint8 = 35 // 0x23
	NaluTypeSei       uint8 = 39 // 0x27
	NaluTypeSeiSuffix uint8 = 40 // 0x28
)

ISO_IEC_23008-2_2013.pdf Table 7-1 – NAL unit type codes and NAL unit type classes

Variables

View Source
var (
	NaluStartCode4 = []byte{0x0, 0x0, 0x0, 0x1}

	// AudNalu aud nalu
	AudNalu = []byte{0x00, 0x00, 0x00, 0x01, 0x46, 0x01, 0x10}
)
View Source
var NaluTypeMapping = map[uint8]string{
	NaluTypeSliceTrailN: "TrailN",
	NaluTypeSliceTrailR: "TrailR",
	NaluTypeSliceTsaN:   "TsaN",
	NaluTypeSliceTsaR:   "TsaR",
	NaluTypeSliceStsaN:  "StsaN",
	NaluTypeSliceStsaR:  "StsaR",
	NaluTypeSliceRadlN:  "RadlN",
	NaluTypeSliceRadlR:  "RadlR",
	NaluTypeSliceRaslN:  "RaslN",
	NaluTypeSliceRaslR:  "RaslR",

	NaluTypeSliceBlaWlp:       "BlaWlp",
	NaluTypeSliceBlaWradl:     "BlaWradl",
	NaluTypeSliceBlaNlp:       "BlaNlp",
	NaluTypeSliceIdr:          "IDR",
	NaluTypeSliceIdrNlp:       "IDRNLP",
	NaluTypeSliceCranut:       "CRANUT",
	NaluTypeSliceRsvIrapVcl22: "IrapVcl22",
	NaluTypeSliceRsvIrapVcl23: "IrapVcl23",

	NaluTypeVps:       "VPS",
	NaluTypeSps:       "SPS",
	NaluTypePps:       "PPS",
	NaluTypeAud:       "AUD",
	NaluTypeSei:       "SEI",
	NaluTypeSeiSuffix: "SEISuffix",
}

Functions

func BuildSeqHeaderFromVpsSpsPps added in v0.23.0

func BuildSeqHeaderFromVpsSpsPps(vps, sps, pps []byte) ([]byte, error)

BuildSeqHeaderFromVpsSpsPps

@return 内存块为内部独立新申请

func BuildVpsSpsPps2Annexb added in v0.31.0

func BuildVpsSpsPps2Annexb(vps, sps, pps []byte) ([]byte, error)

func IsIrapNalu added in v0.29.0

func IsIrapNalu(typ uint8) bool

IsIrapNalu 是否是关键帧

@param typ 帧类型。注意,是经过 ParseNaluType 解析后的帧类型

func ParseNaluType added in v0.23.0

func ParseNaluType(v uint8) uint8

ParseNaluType

@param v 第一个字节

func ParseNaluTypeReadable added in v0.23.0

func ParseNaluTypeReadable(v uint8) string

func ParseSps added in v0.23.0

func ParseSps(sps []byte, ctx *Context) error

func ParseVps added in v0.23.0

func ParseVps(vps []byte, ctx *Context) error

func ParseVpsSpsPpsFromSeqHeader added in v0.23.0

func ParseVpsSpsPpsFromSeqHeader(payload []byte) (vps, sps, pps []byte, err error)

ParseVpsSpsPpsFromSeqHeader

见func ParseVpsSpsPpsFromSeqHeaderWithoutMalloc

@return vps, sps, pps: 内存块为内部独立新申请

func ParseVpsSpsPpsFromSeqHeaderWithoutMalloc added in v0.24.0

func ParseVpsSpsPpsFromSeqHeaderWithoutMalloc(payload []byte) (vps, sps, pps []byte, err error)

ParseVpsSpsPpsFromSeqHeaderWithoutMalloc

从HVCC格式的Seq Header中得到VPS,SPS,PPS内存块。

@param payload: rtmp message的payload部分或者flv tag的payload部分。

注意,包含了头部2字节类型以及3字节的cts。

@return vps, sps, pps: 复用传入参数`payload`的内存块。

func VpsSpsPpsSeqHeader2Annexb added in v0.23.0

func VpsSpsPpsSeqHeader2Annexb(payload []byte) ([]byte, error)

VpsSpsPpsSeqHeader2Annexb

HVCC Seq Header -> Annexb

@return 返回的内存块为内部独立新申请

Types

type Context added in v0.15.0

type Context struct {
	PicWidthInLumaSamples  uint32 // sps
	PicHeightInLumaSamples uint32 // sps
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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