h264

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package h264 - AVCC format related functions

Package h264 - MPEG4 format related functions

Index

Constants

View Source
const (
	NALUTypePFrame = 1 // Coded slice of a non-IDR picture
	NALUTypeIFrame = 5 // Coded slice of an IDR picture
	NALUTypeSEI    = 6 // Supplemental enhancement information (SEI)
	NALUTypeSPS    = 7 // Sequence parameter set
	NALUTypePPS    = 8 // Picture parameter set
	NALUTypeAUD    = 9 // Access unit delimiter
)
View Source
const (
	ProfileBaseline    = 0x42
	ProfileMain        = 0x4D
	ProfileHigh        = 0x64
	CapabilityBaseline = 0xE0
	CapabilityMain     = 0x40
)

https://developers.google.com/cast/docs/media

View Source
const PSMaxSize = 128 // the biggest SPS I've seen is 48 (EZVIZ CS-CV210)
View Source
const RTPPacketVersionAVC = 0

Variables

This section is empty.

Functions

func AVCCToCodec added in v1.7.0

func AVCCToCodec(avcc []byte) *core.Codec

func ConfigToCodec added in v1.7.0

func ConfigToCodec(conf []byte) *core.Codec

func DecodeAnnexB added in v1.3.0

func DecodeAnnexB(b []byte) []byte

DecodeAnnexB - convert AnnexB to AVC format support unknown separator size

func DecodeConfig added in v1.7.0

func DecodeConfig(conf []byte) (profile []byte, sps []byte, pps []byte)

DecodeConfig - extract profile, SPS and PPS from MPEG4 config

func DecodeStream deprecated added in v1.3.0

func DecodeStream(annexb []byte) ([]byte, int)

Deprecated: DecodeStream - find and return first AU in AVC format useful for processing live streams with unknown separator size

func EmitNalus added in v1.2.0

func EmitNalus(nals []byte, isAVC bool, emit func([]byte))

func EncodeConfig added in v1.7.0

func EncodeConfig(sps, pps []byte) []byte

func GetFmtpLine added in v1.2.0

func GetFmtpLine(avc []byte) string

GetFmtpLine from SPS+PPS+IFrame in AVC format

func GetParameterSet

func GetParameterSet(fmtp string) (sps, pps []byte)

func GetProfileLevelID

func GetProfileLevelID(fmtp string) string

GetProfileLevelID - get profile from fmtp line Some devices won't play video with high level, so limit max profile and max level. And return some profile even if fmtp line is empty.

func IndexFrom added in v1.3.0

func IndexFrom(b []byte, sep []byte, from int) int

func IsKeyframe

func IsKeyframe(b []byte) bool

IsKeyframe - check if any NALU in one AU is Keyframe

func Join

func Join(ps, iframe []byte) []byte

func JoinNALU added in v1.7.0

func JoinNALU(nalus ...[]byte) (avcc []byte)

func NALUType

func NALUType(b []byte) byte

func NALUTypes added in v1.7.0

func NALUTypes(avcc []byte) []byte

func RTPDepay

func RTPDepay(codec *core.Codec, handler core.HandlerFunc) core.HandlerFunc

func RTPPay

func RTPPay(mtu uint16, handler core.HandlerFunc) core.HandlerFunc

func RepairAVCC added in v1.7.0

func RepairAVCC(codec *core.Codec, handler core.HandlerFunc) core.HandlerFunc

func SplitNALU added in v1.7.0

func SplitNALU(avcc []byte) [][]byte

Types

type Payloader

type Payloader struct {
	IsAVC bool
	// contains filtered or unexported fields
}

Payloader payloads H264 packets

func (*Payloader) Payload

func (p *Payloader) Payload(mtu uint16, payload []byte) [][]byte

Payload fragments a H264 packet across one or more byte arrays

type SPS added in v1.7.0

type SPS struct {
	// contains filtered or unexported fields
}

func DecodeSPS added in v1.7.0

func DecodeSPS(sps []byte) *SPS

func (*SPS) Height added in v1.7.0

func (s *SPS) Height() uint16

func (*SPS) Width added in v1.7.0

func (s *SPS) Width() uint16

Directories

Path Synopsis
Package annexb - universal for H264 and H265
Package annexb - universal for H264 and H265

Jump to

Keyboard shortcuts

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