sei

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 8 Imported by: 2

Documentation

Overview

Package SEI provides SEI (Supplementary Enhancement Information) parsing and encoding for both AVC and HEVC. The SEI RBSP syntax is defined in Section 7.3.2.3 of ISO/IEC 14496-10 (AVC) 2020 and earlier. For AVC, the SEI messages and their syntax is defined in ISO/IEC 14496-10 2020 Annex D. For HEVC, the SEI message and their syntax i defined in ISO/IEC 23008-2 Annex D.

Index

Constants

View Source
const (
	// Combined definition of AVC and HEVC messages. When names collide for the same number, AVC or HEVC is added in the name.
	// AVC defined in ISO/IEC 14496-10:2020 Annex D and HEVC in ISO/IEC 23008-2:2020 Annex D.
	// SEIBufferingPeriodType is defined in AVC D.1.2 and HEVC D.2.2. Definitions differ.
	SEIBufferingPeriodType = 0
	// SEIPicTimingType is defined in AVC D.1.3 and HEVC D.2.3. Definitions differ.
	SEIPicTimingType = 1
	// SEIPanScanRectType is defined in AVC D.1.4 and HEVC D.2.4. Definitions differ.
	SEIPanScanRectType = 2
	// SEIFillerPayloadType is defined in AVC D.1.5 and HEVC D.2.5. Definitions agree.
	SEIFillerPayloadType = 3
	// SEIUserDataRegisteredITUtT35Type is defined in AVC D.1.6 and HEVC D.2.6. Definitions agree.
	SEIUserDataRegisteredITUtT35Type = 4
	// SEIUserDataUnregisteredType is defined in AVC D.1.7 and HEVC D.2.7. Definitions agree.
	SEIUserDataUnregisteredType = 5
	// SEIRecoveryPointType is defined in AVC D.1.8 and HEVC D.2.8. Definitions differ.
	SEIRecoveryPointType = 6
	// SEIDecRefPicMarkingRepetitionType is defined in AVC D.1.9. Absent in HEVC.
	SEIDecRefPicMarkingRepetitionType = 7
	// SEISparePicType is defined in AVC D.1.10. Absent in HEVC.
	SEISparePicType = 8
	// SEISceneInfoType is defined in AVC D.1.11 and HEVC 2.9. Definitions differ.
	SEISceneInfoType = 9
	// SEISubSeqInfoType is defined in AVC D.1.12. Absent in HEVC.
	SEISubSeqInfoType = 10
	// SEISubSeqLayerCharacteristicsType is defined in AVC D.1.13. Absent in HEVC.
	SEISubSeqLayerCharacteristicsType = 11
	// SEISubSeqCharacteristicsType is defined in AVC D.1.14. Absent in HEVC.
	SEISubSeqCharacteristicsType = 12
	// SEIFullFrameFreezeType is defined in AVC D.1.15. Absent in HEVC.
	SEIFullFrameFreezeType = 13
	// SEIFullFrameFreezeReleaseType is defined in AVC D.1.16. Absent in HEVC.
	SEIFullFrameFreezeReleaseType = 14
	// SEIPictureSnapShotType is defined in AVC D.1.17 and HEVC D.2.10. Definitions agree, but called FullFrameSnapshot in AVC.
	SEIPictureSnapShotType = 15
	// SEIProgressiveRefinementSegmentStartType is defined in AVC D.1.18 and HEVC D.2.11. Definitions differ.
	SEIProgressiveRefinementSegmentStartType = 16
	// SEIProgressiveRefinementSegmentStartEnd is defined in AVC D.1.19 and HEVC D.2.12. Definitions agree.
	SEIProgressiveRefinementSegmentStartEnd = 17 // AVC and HEVC. Same definition
	// SEIMotionConstrainedSliceGroupSetType is defined in AVC D.1.20. Absent in HEVC.
	SEIMotionConstrainedSliceGroupSetType = 18
	// SEIFilmGrainCharacteristicsType is defined in AVC D.1.21 and HEVC D.2.13. Definitions differ.
	SEIFilmGrainCharacteristicsType = 19
	// SEIDeblockingFilterDisplayPreferenceType is defined in AVC D.1.22. Absent in HEVC.
	SEIDeblockingFilterDisplayPreferenceType = 20
	// SEIStereoVideoInfoType is defined in AVC D.1.23. Absent in HEVC.
	SEIStereoVideoInfoType = 21
	// SEIPostFilterHintType is defined in AVC D.1.24 and HEVC D.2.14. Definitions differ.
	SEIPostFilterHintType = 22
	// SEIToneMappingInfoType is defined in AVC D.1.25 and HEVC D.15. Definitions agree.
	SEIToneMappingInfoType = 23 // AVC and HEVC. Same definition
	// SEIScalabilityInfoType is defined in AVC Annex F. Absent in HEVC.
	SEIScalabilityInfoType = 24
	// SEISubPicScalableLayerType is defined in AVC Annex F. Absent in HEVC.
	SEISubPicScalableLayerType = 25
	// SEINonRequiredLayerRepType is defined in AVC Annex F. Absent in HEVC.
	SEINonRequiredLayerRepType = 26
	// SEIPriorityLayerInfoType is defined in AVC Annex F. Absent in HEVC.
	SEIPriorityLayerInfoType = 27
	// SEILayersNotPresentAVCType is defined in AVC Annex F. Absent in HEVC.
	SEILayersNotPresentAVCType = 28
	// SEILayerDependencyChangeType is defined in AVC Annex F. Absent in HEVC.
	SEILayerDependencyChangeType = 29
	// SEIScalableNestingAVCType is defined in AVC Annex F. Absent in HEVC.
	SEIScalableNestingAVCType = 30
	// SEIBaseLayerTemporalHrdType is defined in AVC Annex F. Absent in HEVC.
	SEIBaseLayerTemporalHrdType = 31
	// SEIQualityLayerIntegrityCheckTpe is defined in AVC Annex F. Absent in HEVC.
	SEIQualityLayerIntegrityCheckTpe = 32
	// SEIRedundantPicPropertyType is defined in AVC Annex F. Absent in HEVC.
	SEIRedundantPicPropertyType = 33
	// SEITl0DepRepIndexType is defined in AVC Annex F. Absent in HEVC.
	SEITl0DepRepIndexType = 34
	// SEITlSwitchingPointType is defined in AVC Annex F. Absent in HEVC.
	SEITlSwitchingPointType = 35
	// SEIParallelDecodingInfoType is defined in AVC Annex G. Absent in HEVC.
	SEIParallelDecodingInfoType = 36
	// SEIMVCScalableNestingType is defined in AVC Annex G. Absent in HEVC.
	SEIMVCScalableNestingType = 37
	// SEIViewScalabilityInfoType is defined in AVC Annex G. Absent in HEVC.
	SEIViewScalabilityInfoType = 38
	// SEIMultiviewSceneInfoAVCType is defined in AVC Annex G. Absent in HEVC.
	SEIMultiviewSceneInfoAVCType = 39
	// SEIMultiviewAcquisitionInfoAVCType is defined in AVC Annex G. Absent in HEVC.
	SEIMultiviewAcquisitionInfoAVCType = 40
	// SEINonRequiredViewComponentType is defined in AVC Annex G. Absent in HEVC.
	SEINonRequiredViewComponentType = 41
	// SEIViewDependencyChangeType is defined in AVC Annex G. Absent in HEVC.C.
	SEIViewDependencyChangeType = 42
	// SEIOperationPointsNotPresentType is defined in AVC Annex G. Absent in HEVC.
	SEIOperationPointsNotPresentType = 43
	// SEIBaseViewTemporalHrdType is defined in AVC Annex G. Absent in HEVC.
	SEIBaseViewTemporalHrdType = 44
	// SEIFramePackingArrangementType is defined in AVC D.1.26 and HEVC D.2.16. Definitions differ.
	SEIFramePackingArrangementType = 45
	// SEIMultiviewViewPositionAVCType is defined in AVC Annex G. Absent in HEVC.
	SEIMultiviewViewPositionAVCType = 46
	// SEIDisplayOrientationType is defined in AVC D.1.27 and HEVC D.2.17. Definitions differ.
	SEIDisplayOrientationType = 47
	// SEIMvcdScalableNestingType is defined in AVC Annex H. Absent in HEVC.
	SEIMvcdScalableNestingType = 48
	// SEIMvcdViewScalabilityInfoType is defined in AVC Annex H. Absent in HEVC.
	SEIMvcdViewScalabilityInfoType = 49
	// SEIDepthRepresentationInfoAVCType is defined in AVC Annex H. Absent in HEVC.
	SEIDepthRepresentationInfoAVCType = 50
	// SEIThreeDimensionalReferenceDisplaysInfoAVCType is defined in AVC Annex H. Absent in HEVC.
	SEIThreeDimensionalReferenceDisplaysInfoAVCType = 51
	// SEIDepthTimingType is defined in AVC Annex H. Absent in HEVC.
	SEIDepthTimingType = 52
	// SEIDepthSamplingInfoType is defined in AVC Annex H. Absent in HEVC.
	SEIDepthSamplingInfoType = 53
	// SEIConstrainedDepthParameterSetIdentifierType is defined in AVC Annex H. Absent in HEVC.
	SEIConstrainedDepthParameterSetIdentifierType = 54
	// SEIGreenMetaDataType is defined in AVC D.1.28 and HEVC D.2.17. Definitions agree and point to ISO/IEC 23001-11.
	SEIGreenMetaDataType = 56
	// SEIStructureOfPicturesInfoType is defined in HEVC D.2.19. Absent in AVC.
	SEIStructureOfPicturesInfoType = 128
	// SEIActiveParameterSetsType is defined in HEVC D.2.21. Absent in AVC.
	SEIActiveParameterSetsType = 129
	// SEIDecodingUnitInfoType is defined in HEVC D.2.22. Absent in AVC.
	SEIDecodingUnitInfoType = 130
	// SEITemporalSubLayerZeroIndexType is defined in HEVC D.2.23. Absent in AVC.
	SEITemporalSubLayerZeroIndexType = 131
	// SEIDecodedPictureHashType is defined in HEVC D.2.20. Only used as suffix SEI. Absent in AVC.
	SEIDecodedPictureHashType = 132
	// SEIScalableNestingHEVCType is defined in HEVC D.2.24. Absent in AVC.
	SEIScalableNestingHEVCType = 133
	// SEIRegionRefreshInfoType is defined in HEVC D.2.25. Absent in AVC.
	SEIRegionRefreshInfoType = 134
	// SEINoDisplayType is defined in HEVC D.2.26. Absent in AVC.
	SEINoDisplayType = 135
	// SEITimeCodeType is defined in HEVC D.2.27. Absent in AVC.
	SEITimeCodeType = 136
	// SEIMasteringDisplayColourVolumeType is defined in AVC D.1.29 and HEVC D.2.28. Definitions agree.
	SEIMasteringDisplayColourVolumeType = 137
	// SEISegmentedRectFramePackingArrangementType is defined in HEVC D.2.29. Absent in AVC.
	SEISegmentedRectFramePackingArrangementType = 138
	// SEITemporalMotionConstrainedTileSetsType is defined in HEVC D.2.30. Absent in AVC.
	SEITemporalMotionConstrainedTileSetsType = 139
	// SEIChromaResamplingFilterHintType is defined in HEVC D.2.31. Absent in AVC.
	SEIChromaResamplingFilterHintType = 140
	// SEIKneeFunctionInfoType is defined in HEVC D.2.32. Absent in AVC.
	SEIKneeFunctionInfoType = 141
	// SEIColourRemappingInfoType is defined in AVC D.1.30 and HEVC D.2.33. Definitions differ.
	SEIColourRemappingInfoType = 142
	// SEIDeinterlacedFieldIdentificationType is defined in HEVC D.2.34. Absent in AVC.
	SEIDeinterlacedFieldIdentificationType = 143
	// SEIContentLightLevelInformationType is defined in AVC D.1.31 and HEVC D.2.35. Definitions agree.
	SEIContentLightLevelInformationType = 144
	// SEIDependentRapIndicationType is defined in HEVC D.2.36. Absent in AVC.
	SEIDependentRapIndicationType = 145
	// SEICodedRegionCompletionType is defined in HEVC D.2.37. Absent in AVC.
	SEICodedRegionCompletionType = 146
	// SEIAlternativeTransferCharacteristicsType is defined in AVC D.1.32 and HEVC D.2.38. Definitions agree.
	SEIAlternativeTransferCharacteristicsType = 147
	// SEIAmbientViewingEnvironmentType is defined in HEVC D.2.39. Absent in AVC.
	SEIAmbientViewingEnvironmentType = 148
	// SEIContentColourVolumeType is defined in AVC D.1.33 and HEVC D.2.40. Definitions agree.
	SEIContentColourVolumeType = 149
	// SEIEquirectangularProjectionType is defined in AVC D.1.35.1 and HEVC D.2.41.1. Definitions agree.
	SEIEquirectangularProjectionType = 150
	// SEICubemapProjectionType is defined in AVC D.1.35.2 and HEVC D.2.41.2. Definitions agree.
	SEICubemapProjectionType = 151
	// SEIFisheyeVideoInfoType is defined in HEVC D.41.3. Absent in AVC.
	SEIFisheyeVideoInfoType = 152
	// SEISphereRotationType is defined in AVC D.1.35.3 and HEVC D.2.41.4. Definitions agree.
	SEISphereRotationType = 154
	// SEIRegionwisePackingType is defined in AVC D.1.35.4 and HEVC D.2.41.5. Definitions agree.
	SEIRegionwisePackingType = 155
	// SEIOmniViewportType is defined in AVC D.1.35.5 and HEVC D.2.41.6. Definitions agree.
	SEIOmniViewportType = 156
	// SEIRegionalNestingType is defined in HEVC D.2.42. Absent in AVC.
	SEIRegionalNestingType = 157
	// SEIMctsExtractionInfoSetsType is defined in HEVC D.2.43. Absent in AVC.
	SEIMctsExtractionInfoSetsType = 158
	// SEIMctsExtractionInfoNesting is defined in HEVC D.2.44. Absent in AVC.
	SEIMctsExtractionInfoNesting = 159
	// SEILayersNotPresentHEVCType is defined in HEVC Annex F. Absent in AVC.
	SEILayersNotPresentHEVCType = 160
	// SEIInterLayerConstrainedTileSetsType is defined in HEVC Annex F. Absent in AVC.
	SEIInterLayerConstrainedTileSetsType = 161
	// SEIBspNestingType is defined in HEVC Annex F. Absent in AVC.
	SEIBspNestingType = 162
	// SEIBspInitialArrivalTimeType is defined in HEVC Annex F. Absent in AVC.
	SEIBspInitialArrivalTimeType = 163
	// SEISubBitstreamPropertyType is defined in HEVC Annex F. Absent in AVC.
	SEISubBitstreamPropertyType = 164
	// SEIAlphaChannelInfoType is defined in HEVC Annex F. Absent in AVC.
	SEIAlphaChannelInfoType = 165
	// SEIOverlayInfoType is defined in HEVC Annex F. Absent in AVC.
	SEIOverlayInfoType = 166
	// SEITemporalMvPredictionConstraintsType is defined in HEVC Annex F. Absent in AVC.
	SEITemporalMvPredictionConstraintsType = 167
	// SEIFrameFieldInfoType is defined in HEVC Annex F. Absent in AVC.
	SEIFrameFieldInfoType = 168
	// SEIThreeDimensionalReferenceDisplaysInfoHEVCType is defined in HEVC Annex G. Absent in AVC.
	SEIThreeDimensionalReferenceDisplaysInfoHEVCType = 176
	// SEIDepthRepresentationInfoHEVCType is defined in HEVC Annex G. Absent in AVC.
	SEIDepthRepresentationInfoHEVCType = 177
	// SEIMultiviewSceneInfoHEVCType is defined in HEVC Annex G. Absent in AVC.
	SEIMultiviewSceneInfoHEVCType = 178
	// SEIMultiviewAcquisitionInfoHEVCType is defined in HEVC Annex G. Absent in AVC.
	SEIMultiviewAcquisitionInfoHEVCType = 179
	// SEIMultiviewViewPositionHEVCType is defined in HEVC Annex G. Absent in AVC.
	SEIMultiviewViewPositionHEVCType = 180
	// SEIAlternativeDepthInfoType is defined in HEVC Annex I. Absent in AVC.
	SEIAlternativeDepthInfoType = 181
	// SEISeiManifestType is defined in AVC D.1.36 and HEVC D.2.45. Definitions agree.
	SEISeiManifestType = 200
	// SEISeiPrefixIndicationType is defined in HEVC D.2.46. Absent in AVC.
	SEISeiPrefixIndicationType = 201
	// SEIAnnotatedRegionsType is defined in HEVC D.2.47. Absent in AVC.
	SEIAnnotatedRegionsType = 202
)

Variables

View Source
var ErrRbspTrailingBitsMissing = errors.New("rbsp_trailing_bits byte 0x80 is missing")

Functions

func ParseCEA608

func ParseCEA608(payload []byte) ([]byte, []byte, error)

ParseCEA608 parsers the the fields of data from CEA-708 encapsulation. This is specified in Section 4.3 of ANSI/CTA-708-E R-2018.

func WriteSEIMessages

func WriteSEIMessages(w io.Writer, msgs []SEIMessage) error

WriteSEIMessages writes the messages in EBSP format with RBSPTrailing bits. The output corresponds to an SEI NAL unit payload.

Types

type CEA608sei

type CEA608sei struct {
	Field1 []byte
	Field2 []byte
	// contains filtered or unexported fields
}

CEA608sei data structure.

func ExtractCEA608sei

func ExtractCEA608sei(sd *SEIData) (*CEA608sei, error)

ExtractCEA608sei returns payload and parsed field for CEA 608 SEI message. CEA-608 encapsulation in SEI nal unit is defined in ATSC-120 and further in CTA-708 specification (previously CEA-708).

func (*CEA608sei) Payload

func (s *CEA608sei) Payload() []byte

Payload returns the SEI raw rbsp payload.

func (*CEA608sei) Size

func (s *CEA608sei) Size() uint

Size is size in bytes of raw SEI message rbsp payload.

func (*CEA608sei) String

func (s *CEA608sei) String() string

String provides a simple representation of the CEA608 data.

func (*CEA608sei) Type

func (s *CEA608sei) Type() uint

Type returns the SEI payload type.

type CbpDbpDelay added in v0.36.0

type CbpDbpDelay struct {
	CpbRemovalDelay uint
	DpbOutputDelay  uint
	// InitialCpbRemovalDelayLengthMinus1 comes from SPS HRD and is 5 bits
	InitialCpbRemovalDelayLengthMinus1 byte
	// CpbRemovalDelayLengthMinus1 comes from SPS HRD and is 5 bits
	CpbRemovalDelayLengthMinus1 byte
	// DpbOutputDelayLengthMinus1 comes from SPS HRD and is 5 bits
	DpbOutputDelayLengthMinus1 byte
}

CbpDbpDelay carries the optional data on CpbDpbDelay. This being set corresponds CpbDpbDelaysPresentFlag = true, which in turn is a calculated value if HRD info is present, i.e. NalHrdBpPresentFlag or VclHrdBpPresentFlag is set

type ClockTS

type ClockTS struct {
	TimeOffsetValue     uint32
	NFrames             uint16
	Hours               byte
	Minutes             byte
	Seconds             byte
	ClockTimeStampFlag  bool
	UnitsFieldBasedFlag bool
	FullTimeStampFlag   bool
	SecondsFlag         bool
	MinutesFlag         bool
	HoursFlag           bool
	DiscontinuityFlag   bool
	CntDroppedFlag      bool
	CountingType        byte
	TimeOffsetLength    byte
}

ClockTS carries a clock time stamp.

func CreateClockTS

func CreateClockTS() ClockTS

CreateClockTS creates a clock timestamp with time parts set to -1.

func DecodeClockTS

func DecodeClockTS(br *bits.Reader) ClockTS

func (ClockTS) String

func (c ClockTS) String() string

String returns time stamp

type ClockTSAvc added in v0.36.0

type ClockTSAvc struct {
	CtType             byte // scan type
	NuitFieldBasedFlag bool // misspelled in AVC spec, changed in HEVC to UnitsFieldBasedFlag
	CountingType       byte
	NFrames            byte
	Hours              byte
	Minutes            byte
	Seconds            byte
	ClockTimeStampFlag bool
	FullTimeStampFlag  bool
	SecondsFlag        bool
	MinutesFlag        bool
	HoursFlag          bool
	DiscontinuityFlag  bool
	CntDroppedFlag     bool
	TimeOffsetLength   byte
	TimeOffsetValue    int
}

ClockTSAvc carries a clock time stamp for SEI type 1.

func CreateClockTSAvc added in v0.36.0

func CreateClockTSAvc(timeOffsetLen byte) ClockTSAvc

CreatePTClockTS creates a clock timestamp.

func DecodeClockTSAvc added in v0.36.0

func DecodeClockTSAvc(br *bits.Reader, timeOffsetLen byte) ClockTSAvc

func (*ClockTSAvc) MarshalJSON added in v0.42.0

func (c *ClockTSAvc) MarshalJSON() ([]byte, error)

func (ClockTSAvc) NrBits added in v0.36.0

func (c ClockTSAvc) NrBits() int

NrBits returns size of PTClockTS in bits.

func (ClockTSAvc) String added in v0.36.0

func (c ClockTSAvc) String() string

String returns time stamp

func (ClockTSAvc) WriteToSliceWriter added in v0.36.0

func (c ClockTSAvc) WriteToSliceWriter(sw bits.SliceWriter)

WriteToSliceWriter writes PTClockTS to slice writer.

type Codec

type Codec uint
const (
	AVC Codec = iota
	HEVC
)

type ContentLightLevelInformationSEI

type ContentLightLevelInformationSEI struct {
	MaxContentLightLevel    uint16
	MaxPicAverageLightLevel uint16
}

ContentLightLevelInformationSEI is HEVC SEI Message 144. Defined in ISO/IEC 23008-2 D.2.35

func (ContentLightLevelInformationSEI) Payload

func (c ContentLightLevelInformationSEI) Payload() []byte

func (ContentLightLevelInformationSEI) Size

func (ContentLightLevelInformationSEI) String

func (ContentLightLevelInformationSEI) Type

type HEVCFrameFieldInfo added in v0.42.0

type HEVCFrameFieldInfo struct {
	PicStruct      uint8 // 4 bits
	SourceScanType uint8 // 2 bits
	DuplicateFlag  bool  `json:"DuplicateFlag,omitempty"` // 1bit
}

type HEVCPicTimingParams added in v0.42.0

type HEVCPicTimingParams struct {
	FrameFieldInfoPresentFlag              bool
	CpbDpbDelaysPresentFlag                bool
	SubPicHrdParamsPresentFlag             bool
	SubPicCpbParamsInPicTimingSeiFlag      bool
	AuCbpRemovalDelayLengthMinus1          uint8
	DpbOutputDelayLengthMinus1             uint8
	DpbOutputDelayDuLengthMinus1           uint8
	DuCpbRemovalDelayIncrementLengthMinus1 uint8
}

type ITUData

type ITUData struct {
	CountryCode      byte
	UserDataTypeCode byte
	ProviderCode     uint16
	UserIdentifier   uint32
}

ITUData identifies registered payload in SEI of type 4 (User data registered by ITU-T Rec T 35).

func (ITUData) IsCEA608

func (i ITUData) IsCEA608() bool

IsCEA608 checks if ITU-T data corresponds to CEA-608.

type MasteringDisplayColourVolumeSEI

type MasteringDisplayColourVolumeSEI struct {
	DisplayPrimariesX            [3]uint16
	DisplayPrimariesY            [3]uint16
	WhitePointX                  uint16
	WhitePointY                  uint16
	MaxDisplayMasteringLuminance uint32
	MinDisplayMasteringLuminance uint32
}

MasteringDisplayColourVolumeSEI is HEVC SEI Message 137. Defined in ISO/IEC 23008-2 D.2.28

func (MasteringDisplayColourVolumeSEI) Payload

func (m MasteringDisplayColourVolumeSEI) Payload() []byte

func (MasteringDisplayColourVolumeSEI) Size

func (MasteringDisplayColourVolumeSEI) String

func (MasteringDisplayColourVolumeSEI) Type

type PicTimingAvcSEI added in v0.36.0

type PicTimingAvcSEI struct {
	// CbpDbpDelay is optional and triggered by VUI HRD data
	CbpDbpDelay *CbpDbpDelay `json:"-"`
	// TimeOffsetLength is 5 bits and comes from SPS HRD if present
	TimeOffsetLength uint8        `json:"-"`
	PictStruct       uint8        `json:"pict_struct"`
	Clocks           []ClockTSAvc `json:"clocks"`
}

PicTimingAvcSEI carries the data of an SEI 1 PicTiming message for AVC. The corresponding SEI 1 for HEVC is very different.

func (*PicTimingAvcSEI) Payload added in v0.36.0

func (s *PicTimingAvcSEI) Payload() []byte

Payload returns the SEI raw rbsp payload.

func (*PicTimingAvcSEI) Size added in v0.36.0

func (s *PicTimingAvcSEI) Size() uint

Size is size in bytes of raw SEI message rbsp payload.

func (*PicTimingAvcSEI) String added in v0.36.0

func (s *PicTimingAvcSEI) String() string

String returns string representation of PicTiming SEI1.

func (*PicTimingAvcSEI) Type added in v0.36.0

func (s *PicTimingAvcSEI) Type() uint

Type returns the SEI payload type.

type PicTimingHevcSEI added in v0.42.0

type PicTimingHevcSEI struct {
	ExternalParams                         HEVCPicTimingParams `json:"-"`
	FrameFieldInfo                         *HEVCFrameFieldInfo `json:"FrameFieldInfo,omitempty"`
	AuCpbRemovalDelayMinus1                uint32              `json:"AuCpbRemovalDelayMinus1,omitempty"`
	PicDpbOutputDelay                      uint32              `json:"PicDpbOutputDelay,omitempty"`
	PicDpbOutputDuDelay                    uint32              `json:"PicDpbOutputDuDelay,omitempty"`
	NumDecodingUnitsMinus1                 uint32              `json:"NumDecodingUnitsMinus1,omitempty"`
	DuCommonCpbRemovalDelayFlag            bool                `json:"DuCommonCpbRemovalDelayFlag,omitempty"`
	DuCommonCpbRemovalDelayIncrementMinus1 uint32              `json:"DuCommonCpbRemovalDelayIncrementMinus1,omitempty"`
	NumNalusInDuMinus1                     []uint32            `json:"NumNalusInDuMinus1,omitempty"`
	DuCpbRemovalDelayIncrementMinus1       []uint32            `json:"DuCpbRemovalDelayIncrementMinus1,omitempty"`
	// contains filtered or unexported fields
}

PicTimingHevcSEI carries the data of an SEI 1 PicTiming message for HEVC. The corresponding SEI 1 for AVC is very different. Time code is in SEI 136 for HEVC. Defined in ISO/IEC 23008-2 Ed 5. Section D.2.3 (page 372) and D.3.2.3 (page 405)

func (*PicTimingHevcSEI) Payload added in v0.42.0

func (s *PicTimingHevcSEI) Payload() []byte

Payload returns the SEI raw rbsp payload.

func (*PicTimingHevcSEI) Size added in v0.42.0

func (s *PicTimingHevcSEI) Size() uint

Size is size in bytes of raw SEI message rbsp payload.

func (*PicTimingHevcSEI) String added in v0.42.0

func (s *PicTimingHevcSEI) String() string

String returns string representation of PicTiming SEI1.

func (*PicTimingHevcSEI) Type added in v0.42.0

func (s *PicTimingHevcSEI) Type() uint

Type returns the SEI payload type.

type RegisteredSEI

type RegisteredSEI struct {
	ITUTData ITUData
	// contains filtered or unexported fields
}

RegisteredSEI is user_data_registered_itu_t_t35 (type 4) SEI message.

func NewRegisteredSEI

func NewRegisteredSEI(sd *SEIData, ituData ITUData) *RegisteredSEI

NewRegisteredSEI creates an ITU-T registered SEI message (type 4).

func (*RegisteredSEI) Payload

func (s *RegisteredSEI) Payload() []byte

Payload returns the SEI raw rbsp payload.

func (*RegisteredSEI) Size

func (s *RegisteredSEI) Size() uint

Size returns size in bytes of raw SEI message rbsp payload.

func (*RegisteredSEI) String

func (s *RegisteredSEI) String() string

String provides a short description of the SEI message.

func (*RegisteredSEI) Type

func (s *RegisteredSEI) Type() uint

Type returns the SEI payload type.

type SEI

type SEI struct {
	SEIMessages []SEIMessage
}

SEI is Supplementary Enhancement Information. High level syntax in ISO/IEC 14496-10 Section 7.3.2.3. The actual types are listed in Annex D.

type SEIData

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

SEIData is raw parsed SEI message including payload rbsp data.

func ExtractSEIData

func ExtractSEIData(r io.ReadSeeker) (seiData []SEIData, err error)

ExtractSEIData parses ebsp (after NALU header) and returns a slice of SEIData in rbsp format. In case the rbsp_trailing_bits 0x80 byte is missing at end, []seiData and an ErrMissingRbspTrailingBits error are both returned.

func NewSEIData

func NewSEIData(msgType uint, payload []byte) *SEIData

NewSEIData returns SEIData struct.

func (*SEIData) Payload

func (s *SEIData) Payload() []byte

Payload returns the SEI raw rbsp payload.

func (*SEIData) Size

func (s *SEIData) Size() uint

Size is the size in bytes of the raw SEI message rbsp payload.

func (*SEIData) String

func (s *SEIData) String() string

String provides a description of the SEI message.

func (*SEIData) Type

func (s *SEIData) Type() uint

Type returns the SEI payload type.

type SEIMessage

type SEIMessage interface {
	Type() uint
	Size() uint
	String() string
	Payload() []byte
}

SEIMessage is common part of any SEI message.

func DecodeContentLightLevelInformationSEI

func DecodeContentLightLevelInformationSEI(sd *SEIData) (SEIMessage, error)

DecodeContentLightLevelInformationSEI decodes HEVC SEI 144.

func DecodeGeneralSEI

func DecodeGeneralSEI(sd *SEIData) SEIMessage

DecodeGeneralSEI is a fallback decoder for non-implemented SEI message types.

func DecodeMasteringDisplayColourVolumeSEI

func DecodeMasteringDisplayColourVolumeSEI(sd *SEIData) (SEIMessage, error)

DecodeUserDataUnregisteredSEI - Decode an unregistered SEI message (type 5)

func DecodePicTimingAvcSEI added in v0.36.0

func DecodePicTimingAvcSEI(sd *SEIData) (SEIMessage, error)

DecodePicTimingAvcSEI decodes SEI message 1 TimeCode without HRD parameters.

func DecodePicTimingAvcSEIHRD added in v0.36.0

func DecodePicTimingAvcSEIHRD(sd *SEIData, cbpDbpDelay *CbpDbpDelay, timeOffsetLen byte) (SEIMessage, error)

DecodePicTimingAvcSEIHRD decodes AVC SEI message 1 PicTiming with HRD parameters. cbpDbpDelay length fields must be properly set if cbpDbpDelay is not nil. The delay values in cbpDbpDelay will then be set by the decoder by reading the bits. It is assumed that pict_struct_present_flag is true, so that a 4-bit pict_struct value is present.

func DecodePicTimingHevcSEI added in v0.42.0

func DecodePicTimingHevcSEI(sd *SEIData, exPar HEVCPicTimingParams) (SEIMessage, error)

func DecodeSEIMessage

func DecodeSEIMessage(sd *SEIData, codec Codec) (SEIMessage, error)

DecodeSEIMessage decodes or at least provides some information about an SEIMessage.

func DecodeTimeCodeSEI

func DecodeTimeCodeSEI(sd *SEIData) (SEIMessage, error)

DecodeTimeCodeSEI decodes SEI message 136 TimeCode.

func DecodeUserDataRegisteredSEI

func DecodeUserDataRegisteredSEI(sd *SEIData) (SEIMessage, error)

DecodeUserDataRegisteredSEI decodes a SEI message of type 4.

func DecodeUserDataUnregisteredSEI

func DecodeUserDataUnregisteredSEI(sd *SEIData) (SEIMessage, error)

DecodeUserDataUnregisteredSEI decodes an unregistered SEI message (type 5).

type SEIType

type SEIType uint

SEIType is SEI payload type in AVC or HEVC.

func (SEIType) String

func (h SEIType) String() string

String provides the camel-case name for the SEIType.

type TimeCodeSEI

type TimeCodeSEI struct {
	Clocks []ClockTS
}

TimeCodeSEI carries the data of an SEI 136 TimeCode message.

func (*TimeCodeSEI) Payload

func (s *TimeCodeSEI) Payload() []byte

Payload returns the SEI raw rbsp payload.

func (*TimeCodeSEI) Size

func (s *TimeCodeSEI) Size() uint

Size is size in bytes of raw SEI message rbsp payload.

func (*TimeCodeSEI) String

func (s *TimeCodeSEI) String() string

String returns string representation of TimeCodeSEI.

func (*TimeCodeSEI) Type

func (s *TimeCodeSEI) Type() uint

Type returns the SEI payload type.

type UnregisteredSEI

type UnregisteredSEI struct {
	UUID []byte
	// contains filtered or unexported fields
}

UnregisteredSEI is SEI message of type 5.

func NewUnregisteredSEI

func NewUnregisteredSEI(sd *SEIData, uuid []byte) *UnregisteredSEI

NewUnregisteredSEI creates an unregistered SEI message (type 5).

func (*UnregisteredSEI) Payload

func (s *UnregisteredSEI) Payload() []byte

Payload returns the SEI raw rbsp payload.

func (*UnregisteredSEI) Size

func (s *UnregisteredSEI) Size() uint

Size returns size in bytes of raw SEI message rbsp payload.

func (*UnregisteredSEI) String

func (s *UnregisteredSEI) String() string

String provides a short description of the SEI message.

func (*UnregisteredSEI) Type

func (s *UnregisteredSEI) Type() uint

Type returns SEI payload type.

Jump to

Keyboard shortcuts

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