Documentation
¶
Index ¶
- Constants
- Variables
- func AACSampleIdxToSample(idx int) int
- func CalcCrc32(crc uint32, buffer []byte) uint32
- func CodecString(codecid CodecID) string
- func ConvertAnnexBToAVCC(annexb []byte) []byte
- func CovertAVCCToAnnexB(avcc []byte)
- func CovertExtradata(extraData []byte) ([][]byte, [][]byte)
- func CovertRbspToSodb(rbsp []byte) []byte
- func CreateH264AVCCExtradata(spss [][]byte, ppss [][]byte) ([]byte, error)
- func FindSyncword(aac []byte, offset int) int
- func GetH264FirstMbInSlice(nalu []byte) uint64
- func GetH264Resolution(sps []byte) (width uint32, height uint32)
- func GetH265FirstMbInSlice(nalu []byte) uint64
- func GetH265PPSId(pps []byte) uint64
- func GetH265PPSIdWithStartCode(pps []byte) uint64
- func GetH265Resolution(sps []byte) (width uint32, height uint32)
- func GetH265SPSId(sps []byte) uint64
- func GetH265SPSIdWithStartCode(sps []byte) uint64
- func GetPPSId(pps []byte) uint64
- func GetPPSIdWithStartCode(pps []byte) uint64
- func GetSPSId(sps []byte) uint64
- func GetSPSIdWithStartCode(sps []byte) uint64
- func GetVPSId(vps []byte) uint8
- func GetVPSIdWithStartCode(vps []byte) uint8
- func IsH264IDRFrame(h264 []byte) bool
- func IsH264VCLNaluType(nal_type H264_NAL_TYPE) bool
- func IsH265IDRFrame(h265 []byte) bool
- func IsH265VCLNaluType(nal_type H265_NAL_TYPE) bool
- func Max(x, y int) int
- func Min(x, y int) int
- func OpusPacketDuration(packet []byte) uint64
- func SampleToAACSampleIndex(sampling int) int
- func ShowPacketHexdump(data []byte)
- func SplitAACFrame(frames []byte, onFrame func(aac []byte))
- func SplitFrame(frames []byte, onFrame func(nalu []byte) bool)
- func SplitFrameWithStartCode(frames []byte, onFrame func(nalu []byte) bool)
- func SplitMp3Frames(data []byte, onFrame func(head *MP3FrameHead, frame []byte)) error
- func WriteDefaultOpusExtraData() []byte
- type AAC_PROFILE
- type AAC_SAMPLING_FREQUENCY
- type ADTS_Fix_Header
- type ADTS_Frame_Header
- type ADTS_Variable_Header
- type AudioSpecificConfiguration
- type BitStream
- func (bs *BitStream) Bits() []byte
- func (bs *BitStream) ByteOffset() int
- func (bs *BitStream) DistanceFromMarkDot() int
- func (bs *BitStream) EOS() bool
- func (bs *BitStream) GetBit() uint8
- func (bs *BitStream) GetBits(n int) uint64
- func (bs *BitStream) GetBytes(n int) []byte
- func (bs *BitStream) Markdot()
- func (bs *BitStream) NextBits(n int) uint64
- func (bs *BitStream) ReadSE() int64
- func (bs *BitStream) ReadUE() uint64
- func (bs *BitStream) RemainBits() int
- func (bs *BitStream) RemainBytes() int
- func (bs *BitStream) RemainData() []byte
- func (bs *BitStream) SkipBits(n int)
- func (bs *BitStream) Uint16(n int) uint16
- func (bs *BitStream) Uint32(n int) uint32
- func (bs *BitStream) Uint8(n int) uint8
- func (bs *BitStream) UnRead(n int)
- type BitStreamWriter
- func (bsw *BitStreamWriter) BitOffset() int
- func (bsw *BitStreamWriter) Bits() []byte
- func (bsw *BitStreamWriter) ByteOffset() int
- func (bsw *BitStreamWriter) DistanceFromMarkDot() int
- func (bsw *BitStreamWriter) FillRemainData(v byte)
- func (bsw *BitStreamWriter) Markdot()
- func (bsw *BitStreamWriter) PutByte(v byte)
- func (bsw *BitStreamWriter) PutBytes(v []byte)
- func (bsw *BitStreamWriter) PutRepetValue(v byte, n int)
- func (bsw *BitStreamWriter) PutUint16(v uint16, n int)
- func (bsw *BitStreamWriter) PutUint32(v uint32, n int)
- func (bsw *BitStreamWriter) PutUint64(v uint64, n int)
- func (bsw *BitStreamWriter) PutUint8(v uint8, n int)
- func (bsw *BitStreamWriter) Reset()
- func (bsw *BitStreamWriter) SetByte(v byte, where int)
- func (bsw *BitStreamWriter) SetUint16(v uint16, where int)
- type ChannelMap
- type ChannelOrder
- type CodecID
- type H264NaluHdr
- type H264_NAL_TYPE
- type H265NaluHdr
- type H265RawPPS
- type H265RawSPS
- type H265_NAL_TYPE
- type HEVCRecordConfiguration
- func (hvcc *HEVCRecordConfiguration) Decode(hevc []byte)
- func (hvcc *HEVCRecordConfiguration) Encode() ([]byte, error)
- func (hvcc *HEVCRecordConfiguration) ToNalus() (nalus []byte)
- func (hvcc *HEVCRecordConfiguration) UpdatePPS(pps []byte)
- func (hvcc *HEVCRecordConfiguration) UpdateSPS(sps []byte)
- func (hvcc *HEVCRecordConfiguration) UpdateVPS(vps []byte)
- type HVCCNALUnitArray
- type ID3V2
- type MP3FrameHead
- type NalUnit
- type OpusContext
- type OpusPacket
- type PPS
- type ProfileTierLevel
- type SEI
- type SEIReaderWriter
- type SPS
- type START_CODE_TYPE
- type SliceHeader
- type UserDataUnregistered
- type VPS
- type VPSTimeInfo
- type VUI_Parameters
Constants ¶
const ( VERSION_RESERVED = 0 VERSION_MPEG_1 = 1 VERSION_MPEG_2 = 2 VERSION_MPEG_2_5 = 3 )
const ( LAYER_RESERVED = 0 LAYER_1 = 1 LAYER_2 = 2 LAYER_3 = 3 )
const ( LEFT_CHANNEL = 0 RIGHT_CHANNEL = 1 )
Variables ¶
var ( /// 10ms,20ms,40ms,60ms, samplerate 48000 // sample num per millisecond // 48000 / 1000ms * 10 = 480 ... SLKOpusSampleSize [4]int = [4]int{480, 960, 1920, 2880} HybridOpusSampleSize [4]int = [4]int{480, 960} CELTOpusSampleSize [4]int = [4]int{120, 210, 480, 960} )
var AAC_Sampling_Idx [13]int = [13]int{96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350}
var BitMask [8]byte = [8]byte{0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF}
var BitRateTable [2][3][16]int = [2][3][16]int{
{
{0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, -1},
{0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 380, -1},
{0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1},
},
{
{0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, -1},
{0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1},
{0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1},
},
}
ffmpeg mpegaudiotabs.h ff_mpa_bitrate_tab
var SampleRateTable [3][4]int = [3][4]int{
{44100, 48000, 32000, 0},
{22050, 24000, 16000, 0},
{11025, 12000, 8000, 0},
}
Functions ¶
func AACSampleIdxToSample ¶
func CodecString ¶
func ConvertAnnexBToAVCC ¶
func CovertAVCCToAnnexB ¶
func CovertAVCCToAnnexB(avcc []byte)
func CovertExtradata ¶
func CovertRbspToSodb ¶
func CreateH264AVCCExtradata ¶
func FindSyncword ¶
func GetH264FirstMbInSlice ¶
func GetH264Resolution ¶
https://stackoverflow.com/questions/12018535/get-the-width-height-of-the-video-from-h-264-nalu int Width = ((pic_width_in_mbs_minus1 +1)*16) - frame_crop_right_offset *2 - frame_crop_left_offset *2; int Height = ((2 - frame_mbs_only_flag)* (pic_height_in_map_units_minus1 +1) * 16) - (frame_crop_bottom_offset* 2) - (frame_crop_top_offset* 2);
func GetH265FirstMbInSlice ¶
func GetH265PPSId ¶
func GetH265Resolution ¶
func GetH265SPSId ¶
func GetPPSIdWithStartCode ¶
func GetSPSIdWithStartCode ¶
func GetVPSIdWithStartCode ¶
func IsH264IDRFrame ¶
func IsH264VCLNaluType ¶
func IsH264VCLNaluType(nal_type H264_NAL_TYPE) bool
func IsH265IDRFrame ¶
func IsH265VCLNaluType ¶
func IsH265VCLNaluType(nal_type H265_NAL_TYPE) bool
func OpusPacketDuration ¶
func SampleToAACSampleIndex ¶
func ShowPacketHexdump ¶
func ShowPacketHexdump(data []byte)
func SplitAACFrame ¶
func SplitFrame ¶
func SplitFrameWithStartCode ¶
func SplitMp3Frames ¶
func SplitMp3Frames(data []byte, onFrame func(head *MP3FrameHead, frame []byte)) error
func WriteDefaultOpusExtraData ¶
func WriteDefaultOpusExtraData() []byte
Types ¶
type AAC_SAMPLING_FREQUENCY ¶
type AAC_SAMPLING_FREQUENCY int
const ( AAC_SAMPLE_96000 AAC_SAMPLING_FREQUENCY = iota AAC_SAMPLE_88200 AAC_SAMPLE_64000 AAC_SAMPLE_48000 AAC_SAMPLE_44100 AAC_SAMPLE_32000 AAC_SAMPLE_24000 AAC_SAMPLE_22050 AAC_SAMPLE_16000 AAC_SAMPLE_12000 AAC_SAMPLE_11025 AAC_SAMPLE_8000 AAC_SAMPLE_7350 )
type ADTS_Fix_Header ¶
type ADTS_Frame_Header ¶
type ADTS_Frame_Header struct {
Fix_Header ADTS_Fix_Header
Variable_Header ADTS_Variable_Header
}
func ConvertASCToADTS ¶
func ConvertASCToADTS(asc []byte, aacbytes int) (*ADTS_Frame_Header, error)
func NewAdtsFrameHeader ¶
func NewAdtsFrameHeader() *ADTS_Frame_Header
func (*ADTS_Frame_Header) Decode ¶
func (frame *ADTS_Frame_Header) Decode(aac []byte)
func (*ADTS_Frame_Header) Encode ¶
func (frame *ADTS_Frame_Header) Encode() []byte
type ADTS_Variable_Header ¶
type AudioSpecificConfiguration ¶
type AudioSpecificConfiguration struct {
Audio_object_type uint8
Sample_freq_index uint8
Channel_configuration uint8
GA_framelength_flag uint8
GA_depends_on_core_coder uint8
GA_extension_flag uint8
}
func ConvertADTSToASC ¶
func ConvertADTSToASC(frame []byte) (*AudioSpecificConfiguration, error)
func NewAudioSpecificConfiguration ¶
func NewAudioSpecificConfiguration() *AudioSpecificConfiguration
func (*AudioSpecificConfiguration) Decode ¶
func (asc *AudioSpecificConfiguration) Decode(buf []byte) error
func (*AudioSpecificConfiguration) Encode ¶
func (asc *AudioSpecificConfiguration) Encode() []byte
type BitStream ¶
type BitStream struct {
// contains filtered or unexported fields
}
func NewBitStream ¶
func (*BitStream) ByteOffset ¶
func (*BitStream) DistanceFromMarkDot ¶
func (*BitStream) RemainBits ¶
func (*BitStream) RemainBytes ¶
func (*BitStream) RemainData ¶
type BitStreamWriter ¶
type BitStreamWriter struct {
// contains filtered or unexported fields
}
func NewBitStreamWriter ¶
func NewBitStreamWriter(n int) *BitStreamWriter
func (*BitStreamWriter) BitOffset ¶
func (bsw *BitStreamWriter) BitOffset() int
func (*BitStreamWriter) Bits ¶
func (bsw *BitStreamWriter) Bits() []byte
func (*BitStreamWriter) ByteOffset ¶
func (bsw *BitStreamWriter) ByteOffset() int
func (*BitStreamWriter) DistanceFromMarkDot ¶
func (bsw *BitStreamWriter) DistanceFromMarkDot() int
func (*BitStreamWriter) FillRemainData ¶
func (bsw *BitStreamWriter) FillRemainData(v byte)
用v 填充剩余字节
func (*BitStreamWriter) Markdot ¶
func (bsw *BitStreamWriter) Markdot()
func (*BitStreamWriter) PutByte ¶
func (bsw *BitStreamWriter) PutByte(v byte)
func (*BitStreamWriter) PutBytes ¶
func (bsw *BitStreamWriter) PutBytes(v []byte)
func (*BitStreamWriter) PutRepetValue ¶
func (bsw *BitStreamWriter) PutRepetValue(v byte, n int)
func (*BitStreamWriter) PutUint16 ¶
func (bsw *BitStreamWriter) PutUint16(v uint16, n int)
func (*BitStreamWriter) PutUint32 ¶
func (bsw *BitStreamWriter) PutUint32(v uint32, n int)
func (*BitStreamWriter) PutUint64 ¶
func (bsw *BitStreamWriter) PutUint64(v uint64, n int)
func (*BitStreamWriter) PutUint8 ¶
func (bsw *BitStreamWriter) PutUint8(v uint8, n int)
func (*BitStreamWriter) Reset ¶
func (bsw *BitStreamWriter) Reset()
func (*BitStreamWriter) SetByte ¶
func (bsw *BitStreamWriter) SetByte(v byte, where int)
func (*BitStreamWriter) SetUint16 ¶
func (bsw *BitStreamWriter) SetUint16(v uint16, where int)
type ChannelMap ¶
type ChannelOrder ¶
type H264NaluHdr ¶
func (*H264NaluHdr) Decode ¶
func (hdr *H264NaluHdr) Decode(bs *BitStream)
type H264_NAL_TYPE ¶
type H264_NAL_TYPE int
const ( H264_NAL_RESERVED H264_NAL_TYPE = iota H264_NAL_P_SLICE H264_NAL_SLICE_A H264_NAL_SLICE_B H264_NAL_SLICE_C H264_NAL_I_SLICE H264_NAL_SEI H264_NAL_SPS H264_NAL_PPS H264_NAL_AUD )
func H264NaluType ¶
func H264NaluType(h264 []byte) H264_NAL_TYPE
func H264NaluTypeWithoutStartCode ¶
func H264NaluTypeWithoutStartCode(h264 []byte) H264_NAL_TYPE
type H265NaluHdr ¶
type H265NaluHdr struct {
Forbidden_zero_bit uint8
Nal_unit_type uint8
Nuh_layer_id uint8
Nuh_temporal_id_plus1 uint8
}
func (*H265NaluHdr) Decode ¶
func (hdr *H265NaluHdr) Decode(bs *BitStream)
type H265RawPPS ¶
type H265RawPPS struct {
Pps_pic_parameter_set_id uint64
Pps_seq_parameter_set_id uint64
Dependent_slice_segments_enabled_flag uint8
Output_flag_present_flag uint8
Num_extra_slice_header_bits uint8
Sign_data_hiding_enabled_flag uint8
Cabac_init_present_flag uint8
Num_ref_idx_l0_default_active_minus1 uint64
Num_ref_idx_l1_default_active_minus1 uint64
Init_qp_minus26 int64
Constrained_intra_pred_flag uint8
Transform_skip_enabled_flag uint8
Cu_qp_delta_enabled_flag uint8
Diff_cu_qp_delta_depth uint64
Pps_cb_qp_offset int64
Pps_cr_qp_offset int64
Pps_slice_chroma_qp_offsets_present_flag uint8
Weighted_pred_flag uint8
Weighted_bipred_flag uint8
Transquant_bypass_enabled_flag uint8
Tiles_enabled_flag uint8
Entropy_coding_sync_enabled_flag uint8
}
type H265RawSPS ¶
type H265RawSPS struct {
Sps_video_parameter_set_id uint8
Sps_max_sub_layers_minus1 uint8
Sps_temporal_id_nesting_flag uint8
Ptl ProfileTierLevel
Sps_seq_parameter_set_id uint64
Chroma_format_idc uint64
Pic_width_in_luma_samples uint64
Pic_height_in_luma_samples uint64
Conformance_window_flag uint8
Conf_win_left_offset uint64
Conf_win_right_offset uint64
Conf_win_top_offset uint64
Conf_win_bottom_offset uint64
Bit_depth_luma_minus8 uint64
Bit_depth_chroma_minus8 uint64
Log2_max_pic_order_cnt_lsb_minus4 uint64
Sps_sub_layer_ordering_info_present_flag uint8
Vui_parameters_present_flag uint8
Vui VUI_Parameters
}
type H265_NAL_TYPE ¶
type H265_NAL_TYPE int
const ( H265_NAL_Slice_TRAIL_N H265_NAL_TYPE = iota H265_NAL_LICE_TRAIL_R H265_NAL_SLICE_TSA_N H265_NAL_SLICE_TSA_R H265_NAL_SLICE_STSA_N H265_NAL_SLICE_STSA_R H265_NAL_SLICE_RADL_N H265_NAL_SLICE_RADL_R H265_NAL_SLICE_RASL_N H265_NAL_SLICE_RASL_R //IDR H265_NAL_SLICE_BLA_W_LP H265_NAL_TYPE = iota + 6 H265_NAL_SLICE_BLA_W_RADL H265_NAL_SLICE_BLA_N_LP H265_NAL_SLICE_IDR_W_RADL H265_NAL_SLICE_IDR_N_LP H265_NAL_SLICE_CRA //vps pps sps H265_NAL_VPS H265_NAL_TYPE = iota + 16 H265_NAL_SPS H265_NAL_PPS H265_NAL_AUD //SEI H265_NAL_SEI H265_NAL_TYPE = iota + 19 H265_NAL_SEI_SUFFIX )
func H265NaluType ¶
func H265NaluType(h265 []byte) H265_NAL_TYPE
func H265NaluTypeWithoutStartCode ¶
func H265NaluTypeWithoutStartCode(h265 []byte) H265_NAL_TYPE
type HEVCRecordConfiguration ¶
type HEVCRecordConfiguration struct {
ConfigurationVersion uint8
General_profile_space uint8
General_tier_flag uint8
General_profile_idc uint8
General_profile_compatibility_flags uint32
General_constraint_indicator_flags uint64
General_level_idc uint8
Min_spatial_segmentation_idc uint16
ParallelismType uint8
ChromaFormat uint8
BitDepthLumaMinus8 uint8
BitDepthChromaMinus8 uint8
AvgFrameRate uint16
ConstantFrameRate uint8
NumTemporalLayers uint8
TemporalIdNested uint8
LengthSizeMinusOne uint8
NumOfArrays uint8
Arrays []*HVCCNALUnitArray
}
func NewHEVCRecordConfiguration ¶
func NewHEVCRecordConfiguration() *HEVCRecordConfiguration
func (*HEVCRecordConfiguration) Decode ¶
func (hvcc *HEVCRecordConfiguration) Decode(hevc []byte)
func (*HEVCRecordConfiguration) Encode ¶
func (hvcc *HEVCRecordConfiguration) Encode() ([]byte, error)
func (*HEVCRecordConfiguration) ToNalus ¶
func (hvcc *HEVCRecordConfiguration) ToNalus() (nalus []byte)
func (*HEVCRecordConfiguration) UpdatePPS ¶
func (hvcc *HEVCRecordConfiguration) UpdatePPS(pps []byte)
func (*HEVCRecordConfiguration) UpdateSPS ¶
func (hvcc *HEVCRecordConfiguration) UpdateSPS(sps []byte)
func (*HEVCRecordConfiguration) UpdateVPS ¶
func (hvcc *HEVCRecordConfiguration) UpdateVPS(vps []byte)
type HVCCNALUnitArray ¶
type MP3FrameHead ¶
type MP3FrameHead struct {
Version uint8
Layer uint8
Protecttion uint8
BitrateIndex uint8
SampleRateIndex uint8
Padding uint8
Private uint8
Mode uint8
ModeExtension uint8
Copyright uint8
Original uint8
Emphasis uint8
SampleSize int
FrameSize int
}
func DecodeMp3Head ¶
func DecodeMp3Head(data []byte) (*MP3FrameHead, error)
func (*MP3FrameHead) GetBitRate ¶
func (mp3 *MP3FrameHead) GetBitRate() int
func (*MP3FrameHead) GetChannelCount ¶
func (mp3 *MP3FrameHead) GetChannelCount() int
func (*MP3FrameHead) GetSampleRate ¶
func (mp3 *MP3FrameHead) GetSampleRate() int
type OpusContext ¶
type OpusContext struct {
Preskip int
SampleRate int
ChannelCount int
StreamCount int
StereoStreamCount int
OutputGain uint16
MapType uint8
Channel []byte
ChannelMaps []ChannelMap
}
func (*OpusContext) ParseExtranData ¶
func (ctx *OpusContext) ParseExtranData(extraData []byte) error
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+
| Stream Count |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Coupled Count | Channel Mapping... : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func (*OpusContext) WriteOpusExtraData ¶
func (ctx *OpusContext) WriteOpusExtraData() []byte
type OpusPacket ¶
type OpusPacket struct {
Code int
Config int
Stereo int
Vbr int
FrameCount int
FrameLen []uint16
Frame []byte
Duration uint64
}
ffmpeg opus.h OpusPacket
func DecodeOpusPacket ¶
func DecodeOpusPacket(packet []byte) *OpusPacket
type PPS ¶
type ProfileTierLevel ¶
type ProfileTierLevel struct {
General_profile_space uint8
General_tier_flag uint8
General_profile_idc uint8
General_profile_compatibility_flag uint32
General_constraint_indicator_flag uint64
General_level_idc uint8
Sub_layer_profile_present_flag [8]uint8
Sub_layer_level_present_flag [8]uint8
}
func Profile_tier_level ¶
func Profile_tier_level(profilePresentFlag uint8, maxNumSubLayersMinus1 uint8, bs *BitStream) ProfileTierLevel
ffmpeg hevc.c static void hvcc_parse_ptl(GetBitContext *gb,HEVCDecoderConfigurationRecord *hvcc,unsigned int max_sub_layers_minus1)
type SEI ¶
type SEI struct {
PayloadType uint16
PayloadSize uint16
Sei_payload SEIReaderWriter
}
func (*SEI) Encode ¶
func (sei *SEI) Encode(bsw *BitStreamWriter) []byte
type SEIReaderWriter ¶
type SEIReaderWriter interface {
Read(size uint16, bs *BitStream)
Write(bsw *BitStreamWriter)
}
type SPS ¶
type SPS struct {
Profile_idc uint8
Constraint_set0_flag uint8
Constraint_set1_flag uint8
Constraint_set2_flag uint8
Constraint_set3_flag uint8
Constraint_set4_flag uint8
Constraint_set5_flag uint8
Reserved_zero_2bits uint8
Level_idc uint8
Seq_parameter_set_id uint64
Chroma_format_idc uint64
Separate_colour_plane_flag uint8
Bit_depth_luma_minus8 uint64
Bit_depth_chroma_minus8 uint64
Log2_max_frame_num_minus4 uint64
Pic_order_cnt_type uint64
Max_num_ref_frames uint64
Gaps_in_frame_num_value_allowed_flag uint8
Pic_width_in_mbs_minus1 uint64
Pic_height_in_map_units_minus1 uint64
Frame_mbs_only_flag uint8
Direct_8x8_inference_flag uint8
Frame_cropping_flag uint8
Frame_crop_left_offset uint64
Frame_crop_right_offset uint64
Frame_crop_top_offset uint64
Frame_crop_bottom_offset uint64
Vui_parameters_present_flag uint8
}
type START_CODE_TYPE ¶
type START_CODE_TYPE int
const ( START_CODE_3 START_CODE_TYPE = 3 START_CODE_4 START_CODE_TYPE = 4 )
func FindStartCode ¶
func FindStartCode(nalu []byte, offset int) (int, START_CODE_TYPE)
type SliceHeader ¶
type SliceHeader struct {
First_mb_in_slice uint64
Slice_type uint64
Pic_parameter_set_id uint64
Frame_num uint64
}
func (*SliceHeader) Decode ¶
func (sh *SliceHeader) Decode(bs *BitStream)
调用方根据sps中的log2_max_frame_num_minus4的值来解析Frame_num
type UserDataUnregistered ¶
func (*UserDataUnregistered) Read ¶
func (udu *UserDataUnregistered) Read(size uint16, bs *BitStream)
func (*UserDataUnregistered) Write ¶
func (udu *UserDataUnregistered) Write(bsw *BitStreamWriter)
type VPS ¶
type VPS struct {
Vps_video_parameter_set_id uint8
Vps_base_layer_internal_flag uint8
Vps_base_layer_available_flag uint8
Vps_max_layers_minus1 uint8
Vps_max_sub_layers_minus1 uint8
Vps_temporal_id_nesting_flag uint8
Vps_reserved_0xffff_16bits uint16
Ptl ProfileTierLevel
Vps_sub_layer_ordering_info_present_flag uint8
Vps_max_dec_pic_buffering_minus1 [8]uint64
Vps_max_num_reorder_pics [8]uint64
Vps_max_latency_increase_plus1 [8]uint64
Vps_max_layer_id uint8
Vps_num_layer_sets_minus1 uint64
Layer_id_included_flag [][]uint8
Vps_timing_info_present_flag uint8
TimeInfo VPSTimeInfo
}
type VPSTimeInfo ¶
type VPSTimeInfo struct {
Vps_num_units_in_tick uint32
Vps_time_scale uint32
Vps_poc_proportional_to_timing_flag uint8
Vps_num_ticks_poc_diff_one_minus1 uint64
Vps_num_hrd_parameters uint64
Hrd_layer_set_idx []uint64
Cprms_present_flag []uint8
}
func ParserVPSTimeinfo ¶
func ParserVPSTimeinfo(bs *BitStream) VPSTimeInfo
type VUI_Parameters ¶
type VUI_Parameters struct {
Aspect_ratio_info_present_flag uint8
Overscan_info_present_flag uint8
Chroma_loc_info_present_flag uint8
Neutral_chroma_indication_flag uint8
Field_seq_flag uint8
Frame_field_info_present_flag uint8
Default_display_window_flag uint8
Vui_timing_info_present_flag uint8
Vui_num_units_in_tick uint32
Vui_time_scale uint32
Vui_poc_proportional_to_timing_flag uint8
Vui_hrd_parameters_present_flag uint8
Bitstream_restriction_flag uint8
Tiles_fixed_structure_flag uint8
Motion_vectors_over_pic_boundaries_flag uint8
Restricted_ref_pic_lists_flag uint8
Min_spatial_segmentation_idc uint64
Max_bytes_per_pic_denom uint64
Max_bits_per_min_cu_denom uint64
Log2_max_mv_length_horizontal uint64
Log2_max_mv_length_vertical uint64
}
func (*VUI_Parameters) Decode ¶
func (vui *VUI_Parameters) Decode(bs *BitStream, max_sub_layers_minus1 uint8)