Documentation
¶
Overview ¶
Package hevc holds the HEVC (H.265) bitstream helpers the containers share: parameter-set NAL units, the sequence parameter set fields a decoder configuration repeats, and the hvcC decoder configuration record (ISO/IEC 14496-15, 8.3.3). Inside goav, HEVC packets travel as Annex B, as H.264 ones do (see internal/h264).
Index ¶
Constants ¶
const ( NALVPS = 32 NALSPS = 33 NALPPS = 34 )
The parameter-set NAL unit types.
Variables ¶
var ErrInvalid = errors.New("hevc: invalid bitstream")
ErrInvalid reports a malformed parameter set or hvcC record.
Functions ¶
func CompleteConfig ¶
CompleteConfig returns a copy of record as an hvc1 sample entry carries it, whose samples hold no parameter sets: 4-byte NAL lengths, and the parameter-set arrays marked complete.
func ConfigFromAnnexB ¶
ConfigFromAnnexB builds a complete hvcC record, with 4-byte NAL lengths, from the VPS, SPS, and PPS that Annex B data (a keyframe, or extradata) carries; the profile, tier, level, chroma format, and bit depths come from the first SPS.
func ParameterSet ¶
ParameterSet reports a VPS, SPS, or PPS NAL unit type.
Types ¶
type Config ¶
type Config struct {
// LengthSize is the byte width (1, 2, or 4) of each NAL length prefix.
LengthSize int
// ParameterSets are the record's VPS, SPS, and PPS units, aliasing it.
ParameterSets [][]byte
}
Config is what the conversions need from an hvcC record.
func ParseConfig ¶
ParseConfig parses an hvcC record.
type SPS ¶
type SPS struct {
// ProfileTierLevel is the general profile, tier, and level: the 12
// bytes an hvcC record copies.
ProfileTierLevel [12]byte
TemporalLayers byte
TemporalIDNested byte
// ChromaFormat is chroma_format_idc: 0 monochrome, 1 4:2:0, 2 4:2:2,
// 3 4:4:4.
ChromaFormat byte
LumaDepth, ChromaDepth byte
// Width and Height are the picture size after the conformance window.
Width, Height int
}
SPS is what a decoder configuration repeats from a sequence parameter set, and the picture size it declares.