h264reader

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 h264reader implements a H264 Annex-B Reader

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type H264Reader

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

H264Reader reads data from stream and constructs h264 nal units.

func NewReader

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

NewReader creates new H264Reader.

func NewReaderWithOptions

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

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

func (*H264Reader) NextNAL

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

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

type NAL

type NAL struct {
	PictureOrderCount uint32

	// NAL header
	ForbiddenZeroBit bool
	RefIdc           uint8
	UnitType         NalUnitType

	Data []byte // header byte + rbsp
}

NAL H.264 Network Abstraction Layer.

type NalUnitType

type NalUnitType uint8

NalUnitType is the type of a NAL.

const (
	NalUnitTypeUnspecified              NalUnitType = 0  // Unspecified
	NalUnitTypeCodedSliceNonIdr         NalUnitType = 1  // Coded slice of a non-IDR picture
	NalUnitTypeCodedSliceDataPartitionA NalUnitType = 2  // Coded slice data partition A
	NalUnitTypeCodedSliceDataPartitionB NalUnitType = 3  // Coded slice data partition B
	NalUnitTypeCodedSliceDataPartitionC NalUnitType = 4  // Coded slice data partition C
	NalUnitTypeCodedSliceIdr            NalUnitType = 5  // Coded slice of an IDR picture
	NalUnitTypeSEI                      NalUnitType = 6  // Supplemental enhancement information (SEI)
	NalUnitTypeSPS                      NalUnitType = 7  // Sequence parameter set
	NalUnitTypePPS                      NalUnitType = 8  // Picture parameter set
	NalUnitTypeAUD                      NalUnitType = 9  // Access unit delimiter
	NalUnitTypeEndOfSequence            NalUnitType = 10 // End of sequence
	NalUnitTypeEndOfStream              NalUnitType = 11 // End of stream
	NalUnitTypeFiller                   NalUnitType = 12 // Filler data
	NalUnitTypeSpsExt                   NalUnitType = 13 // Sequence parameter set extension
	NalUnitTypeCodedSliceAux            NalUnitType = 19 // Coded slice of an auxiliary coded picture without partitioning

)

Enums for NalUnitTypes.

func (*NalUnitType) String

func (n *NalUnitType) String() string

type Option

type Option func(*H264Reader) error

Option configures the behavior of H264Reader.

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