h265

package
v0.0.0-...-c3ad350 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: MIT Imports: 8 Imported by: 0

README

H265

Payloader code taken from pion library branch h265. Because it's still not in release. Thanks to @kevmo314.

Documentation

Overview

Package h265 - AVCC format related functions

Package h265 - MPEG4 format related functions

Index

Constants

View Source
const (
	NALUTypePFrame    = 1
	NALUTypeIFrame    = 19
	NALUTypeIFrame2   = 20
	NALUTypeIFrame3   = 21
	NALUTypeVPS       = 32
	NALUTypeSPS       = 33
	NALUTypePPS       = 34
	NALUTypePrefixSEI = 39
	NALUTypeSuffixSEI = 40
	NALUTypeFU        = 49
)

Variables

This section is empty.

Functions

func AVCCToCodec

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

func ConfigToCodec

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

func DecodeConfig

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

func DecodeStream deprecated

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 EncodeConfig

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

func GetParameterSet

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

func IsKeyframe

func IsKeyframe(b []byte) bool

func NALUType

func NALUType(b []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

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

func SafariPay

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

SafariPay - generate Safari friendly payload for H265 https://github.com/xaionaro-go/Blog/issues/5

func Types

func Types(data []byte) []byte

Types

type H265FragmentationUnitHeader

type H265FragmentationUnitHeader uint8

H265FragmentationUnitHeader is a H265 FU Header +---------------+ |0|1|2|3|4|5|6|7| +-+-+-+-+-+-+-+-+ |S|E| FuType | +---------------+

func (H265FragmentationUnitHeader) E

E represents the end of a fragmented NAL unit.

func (H265FragmentationUnitHeader) FuType

FuType MUST be equal to the field Type of the fragmented NAL unit.

func (H265FragmentationUnitHeader) S

S represents the start of a fragmented NAL unit.

type H265NALUHeader

type H265NALUHeader uint16

H265NALUHeader is a H265 NAL Unit Header https://datatracker.ietf.org/doc/html/rfc7798#section-1.1.4 +---------------+---------------+

|0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|F|   Type    |  LayerID  | TID |
+-------------+-----------------+

func (H265NALUHeader) F

func (h H265NALUHeader) F() bool

F is the forbidden bit, should always be 0.

func (H265NALUHeader) IsAggregationPacket

func (h H265NALUHeader) IsAggregationPacket() bool

IsAggregationPacket returns whether or not the packet is an Aggregation packet.

func (H265NALUHeader) IsFragmentationUnit

func (h H265NALUHeader) IsFragmentationUnit() bool

IsFragmentationUnit returns whether or not the packet is a Fragmentation Unit packet.

func (H265NALUHeader) IsPACIPacket

func (h H265NALUHeader) IsPACIPacket() bool

IsPACIPacket returns whether or not the packet is a PACI packet.

func (H265NALUHeader) IsTypeVCLUnit

func (h H265NALUHeader) IsTypeVCLUnit() bool

IsTypeVCLUnit returns whether or not the NAL Unit type is a VCL NAL unit.

func (H265NALUHeader) LayerID

func (h H265NALUHeader) LayerID() uint8

LayerID should always be 0 in non-3D HEVC context.

func (H265NALUHeader) TID

func (h H265NALUHeader) TID() uint8

TID is the temporal identifier of the NAL unit +1.

func (H265NALUHeader) Type

func (h H265NALUHeader) Type() uint8

Type of NAL Unit.

type Payloader

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

Payloader payloads H265 packets

func (*Payloader) Payload

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

Payload fragments a H265 packet across one or more byte arrays

type SPS

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

func DecodeSPS

func DecodeSPS(nalu []byte) *SPS

func (*SPS) Height

func (s *SPS) Height() uint16

func (*SPS) Width

func (s *SPS) Width() uint16

Jump to

Keyboard shortcuts

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