h265reader

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package h265reader implements a H265/HEVC Annex-B Reader

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type H265Reader

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

H265Reader reads data from stream and constructs h265 nal units.

func NewReader

func NewReader(in io.Reader) (*H265Reader, error)

NewReader creates new H265Reader.

func NewReaderWithOptions

func NewReaderWithOptions(in io.Reader, options ...Option) (*H265Reader, error)

NewReaderWithOptions creates new H265Reader with options. The default behavior is to skip SEI NAL units.

func (*H265Reader) NextNAL

func (reader *H265Reader) NextNAL() (*NAL, error)

NextNAL returns the next NAL unit, or io.EOF after the final unit.

type NAL

type NAL struct {
	PictureOrderCount uint32

	/* 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 |
	+-------------+-----------------+
	*/
	ForbiddenZeroBit bool
	NalUnitType      NalUnitType
	LayerID          uint8
	TemporalIDPlus1  uint8

	Data []byte // header bytes + rbsp
}

NAL H.265/HEVC Network Abstraction Layer.

type NalUnitType

type NalUnitType uint8

NalUnitType is the type of a NAL unit in H.265/HEVC.

const (
	// VCL NAL unit types.
	NalUnitTypeTrailN   NalUnitType = 0  // Coded slice segment of a non-TSA, non-STSA trailing picture
	NalUnitTypeTrailR   NalUnitType = 1  // Coded slice segment of a non-TSA, non-STSA trailing picture
	NalUnitTypeTsaN     NalUnitType = 2  // Coded slice segment of a TSA picture
	NalUnitTypeTsaR     NalUnitType = 3  // Coded slice segment of a TSA picture
	NalUnitTypeStsaN    NalUnitType = 4  // Coded slice segment of an STSA picture
	NalUnitTypeStsaR    NalUnitType = 5  // Coded slice segment of an STSA picture
	NalUnitTypeRadlN    NalUnitType = 6  // Coded slice segment of a RADL picture
	NalUnitTypeRadlR    NalUnitType = 7  // Coded slice segment of a RADL picture
	NalUnitTypeRaslN    NalUnitType = 8  // Coded slice segment of a RASL picture
	NalUnitTypeRaslR    NalUnitType = 9  // Coded slice segment of a RASL picture
	NalUnitTypeBlaWLp   NalUnitType = 16 // Coded slice segment of a BLA picture
	NalUnitTypeBlaWRadl NalUnitType = 17 // Coded slice segment of a BLA picture
	NalUnitTypeBlaNLp   NalUnitType = 18 // Coded slice segment of a BLA picture
	NalUnitTypeIdrWRadl NalUnitType = 19 // Coded slice segment of an IDR picture
	NalUnitTypeIdrNLp   NalUnitType = 20 // Coded slice segment of an IDR picture
	NalUnitTypeCraNut   NalUnitType = 21 // Coded slice segment of a CRA picture

	// Non-VCL NAL unit types.
	NalUnitTypeVps       NalUnitType = 32 // Video parameter set
	NalUnitTypeSps       NalUnitType = 33 // Sequence parameter set
	NalUnitTypePps       NalUnitType = 34 // Picture parameter set
	NalUnitTypeAud       NalUnitType = 35 // Access unit delimiter
	NalUnitTypeEos       NalUnitType = 36 // End of sequence
	NalUnitTypeEob       NalUnitType = 37 // End of bitstream
	NalUnitTypeFd        NalUnitType = 38 // Filler data
	NalUnitTypePrefixSei NalUnitType = 39 // Supplemental enhancement information
	NalUnitTypeSuffixSei NalUnitType = 40 // Supplemental enhancement information

	// Reserved.
	NalUnitTypeReserved41 NalUnitType = 41
	NalUnitTypeReserved47 NalUnitType = 47
	NalUnitTypeUnspec48   NalUnitType = 48
	NalUnitTypeUnspec63   NalUnitType = 63
)

Enums for H.265/HEVC NAL unit types.

func (*NalUnitType) String

func (n *NalUnitType) String() string

type Option

type Option func(*H265Reader) error

Option configures the behavior of H265Reader.

func WithIncludeSEI

func WithIncludeSEI(include bool) Option

WithIncludeSEI controls whether SEI (Supplemental Enhancement Information) NAL units are returned. Default is false (SEI is skipped).

Jump to

Keyboard shortcuts

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