hevc

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: MIT Imports: 5 Imported by: 4

Documentation

Index

Constants

View Source
const (
	NaluTypeSliceTrailN uint8 = 0 // 0x0
	NaluTypeSliceTrailR uint8 = 1 // 0x01

	// NaluTypeSliceIdr ...
	//
	// 19, 20, 21都是关键帧
	// TODO(chef): 16,17,18也是关键帧吗?
	//
	NaluTypeSliceIdr    uint8 = 19 // 0x13
	NaluTypeSliceIdrNlp uint8 = 20 // 0x14
	NaluTypeSliceCranut uint8 = 21 // 0x15

	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",
	NaluTypeSliceIdr:    "IDR",
	NaluTypeSliceIdrNlp: "IDRNLP",
	NaluTypeSliceCranut: "CRANUT",
	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 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