Documentation ¶
Index ¶
Constants ¶
const ( PidPat uint16 = 0 PidVideo uint16 = 0x100 PidAudio uint16 = 0x101 // AdaptationFieldControlReserved ------------------------------------------ // <iso13818-1.pdf> <Table 2-5> <page 38/174> // ------------------------------------------ AdaptationFieldControlReserved uint8 = 0 // Reserved for future use by ISO/IEC AdaptationFieldControlNo uint8 = 1 // No adaptation_field, payload only AdaptationFieldControlOnly uint8 = 2 // Adaptation_field only, no payload AdaptationFieldControlFollowed uint8 = 3 // Adaptation_field followed by payload )
TS Packet Header
const ( // StreamIdAudio ----------------------------------------------------------------- // <iso13818-1.pdf> <Table 2-18-Stream_id assignments> <page 52/174> // ----------------------------------------------------------------- StreamIdAudio uint8 = 192 // 110x xxxx 0xC0 StreamIdVideo uint8 = 224 // 1110 xxxx // PtsDtsFlags0 ------------------------------ // <iso13818-1.pdf> <page 53/174> // ------------------------------ PtsDtsFlags0 uint8 = 0 // no PTS no DTS PtsDtsFlags1 uint8 = 1 // forbidden PtsDtsFlags2 uint8 = 2 // only PTS PtsDtsFlags3 uint8 = 3 // both PTS and DTS )
PES
Variables ¶
var FixedFragmentHeader = []byte{}/* 376 elements not displayed */
FixedFragmentHeader 每个TS文件都以固定的PAT,PMT开始
var FixedFragmentHeaderHevc = []byte{}/* 376 elements not displayed */
FixedFragmentHeaderHevc 每个TS文件都以固定的PAT,PMT开始
var Log = nazalog.GetGlobalLogger()
Functions ¶
This section is empty.
Types ¶
type FileWriter ¶ added in v0.22.0
type FileWriter struct {
// contains filtered or unexported fields
}
func (*FileWriter) Create ¶ added in v0.22.0
func (fw *FileWriter) Create(filename string) (err error)
func (*FileWriter) Dispose ¶ added in v0.22.0
func (fw *FileWriter) Dispose() error
func (*FileWriter) Name ¶ added in v0.22.0
func (fw *FileWriter) Name() string
func (*FileWriter) Write ¶ added in v0.22.0
func (fw *FileWriter) Write(b []byte) (err error)
type Frame ¶
type Frame struct { Pts uint64 // =(毫秒 * 90) Dts uint64 Cc uint8 // continuity_counter of TS Header // PID of PES Header // 音频 mpegts.PidAudio // 视频 mpegts.PidVideo Pid uint16 // stream_id of PES Header // 音频 mpegts.StreamIdAudio // 视频 mpegts.StreamIdVideo Sid uint8 // 音频 全部为false // 视频 关键帧为true,非关键帧为false Key bool // 音频AAC 格式为2字节ADTS头加raw frame // 视频AVC 格式为Annexb Raw []byte }
Frame 帧数据,用于打包成mpegts格式的数据
func (*Frame) DebugString ¶ added in v0.31.0
type Pat ¶ added in v0.23.0
type Pat struct {
// contains filtered or unexported fields
}
Pat --------------------------------------------------------------------------------------------------- Program association section <iso13818-1.pdf> <2.4.4.3> <page 61/174> table_id [8b] * section_syntax_indicator [1b] '0' [1b] reserved [2b] section_length [12b] ** transport_stream_id [16b] ** reserved [2b] version_number [5b] current_next_indicator [1b] * section_number [8b] * last_section_number [8b] * -----loop----- program_number [16b] ** reserved [3b] program_map_PID [13b] ** if program_number == 0 then network_PID else then program_map_PID -------------- CRC_32 [32b] **** ---------------------------------------------------------------------------------------------------
type PatProgramElement ¶ added in v0.23.0
type PatProgramElement struct {
// contains filtered or unexported fields
}
type Pes ¶ added in v0.23.0
type Pes struct {
// contains filtered or unexported fields
}
Pes ----------------------------------------------------------- <iso13818-1.pdf> <2.4.3.6 PES packet> <page 49/174> <Table E.1 - PES packet header example> <page 142/174> <F.0.2 PES packet> <page 144/174> packet_start_code_prefix [24b] *** always 0x00, 0x00, 0x01 stream_id [8b] * PES_packet_length [16b] ** '10' [2b] PES_scrambling_control [2b] PES_priority [1b] data_alignment_indicator [1b] copyright [1b] original_or_copy [1b] * PTS_DTS_flags [2b] ESCR_flag [1b] ES_rate_flag [1b] DSM_trick_mode_flag [1b] additional_copy_info_flag [1b] PES_CRC_flag [1b] PES_extension_flag [1b] * PES_header_data_length [8b] * -----------------------------------------------------------
type Pmt ¶ added in v0.23.0
type Pmt struct { ProgramElements []PmtProgramElement // contains filtered or unexported fields }
Pmt
---------------------------------------- Program Map Table <iso13818-1.pdf> <2.4.4.8> <page 64/174> table_id [8b] * section_syntax_indicator [1b] 0 [1b] reserved [2b] section_length [12b] ** program_number [16b] ** reserved [2b] version_number [5b] current_next_indicator [1b] * section_number [8b] * last_section_number [8b] * reserved [3b] PCR_PID [13b] ** reserved [4b] program_info_length [12b] ** -----loop----- stream_type [8b] * reserved [3b] elementary_PID [13b] ** reserved [4b] ES_info_length_length [12b] ** -------------- CRC32 [32b] **** ----------------------------------------
func (*Pmt) SearchPid ¶ added in v0.23.0
func (pmt *Pmt) SearchPid(pid uint16) *PmtProgramElement
type PmtProgramElement ¶ added in v0.23.0
type TsPacketAdaptation ¶ added in v0.23.0
type TsPacketAdaptation struct {
Length uint8
}
TsPacketAdaptation ---------------------------------------------------------- <iso13818-1.pdf> <Table 2-6> <page 40/174> adaptation_field_length [8b] * 不包括自己这1字节 discontinuity_indicator [1b] random_access_indicator [1b] elementary_stream_priority_indicator [1b] PCR_flag [1b] OPCR_flag [1b] splicing_point_flag [1b] transport_private_data_flag [1b] adaptation_field_extension_flag [1b] * -----if PCR_flag == 1----- program_clock_reference_base [33b] reserved [6b] program_clock_reference_extension [9b] ****** ----------------------------------------------------------
func ParseTsPacketAdaptation ¶ added in v0.23.0
func ParseTsPacketAdaptation(b []byte) (f TsPacketAdaptation)
ParseTsPacketAdaptation TODO chef
type TsPacketHeader ¶ added in v0.23.0
type TsPacketHeader struct { Sync uint8 Err uint8 PayloadUnitStart uint8 Prio uint8 Pid uint16 Scra uint8 Adaptation uint8 Cc uint8 }
TsPacketHeader ------------------------------------------------ <iso13818-1.pdf> <2.4.3.2> <page 36/174> sync_byte [8b] * always 0x47 transport_error_indicator [1b] payload_unit_start_indicator [1b] transport_priority [1b] PID [13b] ** transport_scrambling_control [2b] adaptation_field_control [2b] continuity_counter [4b] * ------------------------------------------------
func ParseTsPacketHeader ¶ added in v0.23.0
func ParseTsPacketHeader(b []byte) (h TsPacketHeader)
ParseTsPacketHeader 解析4字节TS Packet header