Documentation ¶
Overview ¶
The oryx AVC package includes some utilites. The NALU(Netowrk Abstraction Layer Unit) is suitable for transmission over network. We could package NALUs by AnnexB, IBMF or RTP according to different scenarios.
@note AnnexB is designed for bit-oriented stream, such as MPEG-TS/HLS, please read ISO_IEC_14496-10-AVC-2003.pdf at page 211, AnnexB Byte stream Format. @note IBMF is designed for file storage, such as MP4/FLV, please read ISO_IEC_14496-15-AVC-format-2012.pdf at page 16, 5.2.4.1 AVC decoder configuration record. @note RTP payload for H.264, defined in RFC6184 https://tools.ietf.org/html/rfc6184 it directly uses and extends the NAL header.
Index ¶
Constants ¶
const ( AVCLevel_1 = 10 AVCLevel_11 = 11 AVCLevel_12 = 12 AVCLevel_13 = 13 AVCLevel_2 = 20 AVCLevel_21 = 21 AVCLevel_22 = 22 AVCLevel_3 = 30 AVCLevel_31 = 31 AVCLevel_32 = 32 AVCLevel_4 = 40 AVCLevel_41 = 41 AVCLevel_5 = 50 AVCLevel_51 = 51 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AVCDecoderConfigurationRecord ¶
type AVCDecoderConfigurationRecord struct { // It is a byte defined exactly the same as the byte which occurs between the // profile_IDC and level_IDC in a sequence parameter set (SPS), as defined in // ISO/IEC 14496-10. // @remark It's 8 bits. AVCProfileIndication AVCProfile // It indicates the length in bytes of the NALUnitLength field in an AVC video sample // or AVC parameter set sample of the associated stream minus one. AVCLevelIndication AVCLevel // It indicates the length in bytes of the NALUnitLength field in an AVC video sample // or AVC parameter set sample of the associated stream minus one. LengthSizeMinusOne uint8 // It contains a SPS NAL unit, as specified in ISO/IEC 14496-10. SPSs shall occur in // order of ascending parameter set identifier with gaps being allowed. SequenceParameterSetNALUnits []*NALU // It contains a PPS NAL unit, as specified in ISO/IEC 14496-10. PPSs shall occur in // order of ascending parameter set identifier with gaps being allowed. PictureParameterSetNALUnits []*NALU // contains filtered or unexported fields }
@doc ISO_IEC_14496-15-AVC-format-2012.pdf at page 16, 5.2.4.1.1 Syntax
func NewAVCDecoderConfigurationRecord ¶
func NewAVCDecoderConfigurationRecord() *AVCDecoderConfigurationRecord
func (*AVCDecoderConfigurationRecord) MarshalBinary ¶
func (v *AVCDecoderConfigurationRecord) MarshalBinary() ([]byte, error)
func (*AVCDecoderConfigurationRecord) UnmarshalBinary ¶
func (v *AVCDecoderConfigurationRecord) UnmarshalBinary(data []byte) error
type AVCLevel ¶
type AVCLevel uint8
@doc Annex A Profiles and levels, ISO_IEC_14496-10-AVC-2003.pdf, page 207.
type AVCProfile ¶
type AVCProfile uint16
@doc Annex A Profiles and levels, ISO_IEC_14496-10-AVC-2003.pdf, page 205. @note that it's uint8 in IBMF, but extended in other specs, so we use uint16.
const ( // @see ffmpeg, libavcodec/avcodec.h:2713 AVCProfileBaseline AVCProfile = 66 AVCProfileConstrainedBaseline AVCProfile = 578 AVCProfileMain AVCProfile = 77 AVCProfileExtended AVCProfile = 88 AVCProfileHigh AVCProfile = 100 AVCProfileHigh10 AVCProfile = 110 AVCProfileHigh10Intra AVCProfile = 2158 AVCProfileHigh422 AVCProfile = 122 AVCProfileHigh422Intra AVCProfile = 2170 AVCProfileHigh444 AVCProfile = 144 AVCProfileHigh444Predictive AVCProfile = 244 AVCProfileHigh444Intra AVCProfile = 2192 )
func (AVCProfile) String ¶
func (v AVCProfile) String() string
type AVCSample ¶
type AVCSample struct { NALUs []*NALU // contains filtered or unexported fields }
@doc ISO_IEC_14496-15-AVC-format-2012.pdf at page 20, 5.3.4.2 Sample format
func NewAVCSample ¶
func (*AVCSample) MarshalBinary ¶
func (*AVCSample) UnmarshalBinary ¶
type NALRefIDC ¶
type NALRefIDC uint8
@doc ISO_IEC_14496-10-AVC-2003.pdf at page 44, 7.3.1 NAL unit syntax
type NALU ¶
type NALU struct { *NALUHeader Data []byte }
@doc ISO_IEC_14496-10-AVC-2003.pdf at page 60, 7.4.1 NAL unit semantics
func (*NALU) MarshalBinary ¶
func (*NALU) UnmarshalBinary ¶
type NALUHeader ¶
type NALUHeader struct { // The 2-bits nal_ref_idc. NALRefIDC NALRefIDC // The 5-bits nal_unit_type. NALUType NALUType }
@doc ISO_IEC_14496-10-AVC-2003.pdf at page 60, 7.4.1 NAL unit semantics
func NewNALUHeader ¶
func NewNALUHeader() *NALUHeader
func (*NALUHeader) MarshalBinary ¶
func (v *NALUHeader) MarshalBinary() ([]byte, error)
func (*NALUHeader) Size ¶
func (v *NALUHeader) Size() int
func (*NALUHeader) String ¶
func (v *NALUHeader) String() string
func (*NALUHeader) UnmarshalBinary ¶
func (v *NALUHeader) UnmarshalBinary(data []byte) error
type NALUType ¶
type NALUType uint8
@doc ISO_IEC_14496-10-AVC-2003.pdf at page 44, 7.3.1 NAL unit syntax
const ( NALUTypeNonIDR NALUType = 1 // Coded slice of a non-IDR picture slice_layer_without_partitioning_rbsp( ) NALUTypeDataPartitionA NALUType = 2 // Coded slice data partition A slice_data_partition_a_layer_rbsp( ) NALUTypeDataPartitionB NALUType = 3 // Coded slice data partition B slice_data_partition_b_layer_rbsp( ) NALUTypeDataPartitionC NALUType = 4 // Coded slice data partition C slice_data_partition_c_layer_rbsp( ) NALUTypeIDR NALUType = 5 // Coded slice of an IDR picture slice_layer_without_partitioning_rbsp( ) NALUTypeSEI NALUType = 6 // Supplemental enhancement information (SEI) sei_rbsp( ) NALUTypeSPS NALUType = 7 // Sequence parameter set seq_parameter_set_rbsp( ) NALUTypePPS NALUType = 8 // Picture parameter set pic_parameter_set_rbsp( ) NALUTypeAccessUnitDelimiter NALUType = 9 // Access unit delimiter access_unit_delimiter_rbsp( ) NALUTypeEOSequence NALUType = 10 // End of sequence end_of_seq_rbsp( ) NALUTypeEOStream NALUType = 11 // End of stream end_of_stream_rbsp( ) NALUTypeFilterData NALUType = 12 // Filler data filler_data_rbsp( ) NALUTypeSPSExt NALUType = 13 // Sequence parameter set extension seq_parameter_set_extension_rbsp( ) NALUTypePrefixNALU NALUType = 14 // Prefix NAL unit prefix_nal_unit_rbsp( ) NALUTypeSubsetSPS NALUType = 15 // Subset sequence parameter set subset_seq_parameter_set_rbsp( ) NALUTypeLayerWithoutPartition NALUType = 19 // Coded slice of an auxiliary coded picture without partitioning slice_layer_without_partitioning_rbsp( ) NALUTypeCodedSliceExt NALUType = 20 // Coded slice extension slice_layer_extension_rbsp( ) )