xref: /xiu/library/container/mpegts/src/define.rs (revision 15fa2386)
1 pub mod epat_pid {
2     pub const PAT_TID_PAS: u16 = 0x00;
3     pub const PAT_TID_CAS: u16 = 0x01; // conditional_access_section(CA_section)
4     pub const PAT_TID_PMS: u16 = 0x02; // TS_program_map_section
5 }
6 
7 pub mod ts {
8     pub const TS_PACKET_SIZE: u8 = 188;
9 }
10 
11 pub mod epsi_stream_type {
12     pub const PSI_STREAM_MP3: u8 = 0x04; // ISO/IEC 13818-3 Audio
13     pub const PSI_STREAM_PRIVATE_DATA: u8 = 0x06;
14     pub const PSI_STREAM_H264: u8 = 0x1b; // H.264
15     pub const PSI_STREAM_AAC: u8 = 0x0f;
16     pub const PSI_STREAM_MPEG4_AAC: u8 = 0x1c;
17     pub const PSI_STREAM_AUDIO_OPUS: u8 = 0x9c;
18 }
19 
20 pub mod epes_stream_id {
21 
22     pub const PES_SID_AUDIO: u8 = 0xC0; // ISO/IEC 13818-3/11172-3/13818-7/14496-3 audio stream '110x xxxx'
23     pub const PES_SID_VIDEO: u8 = 0xE0; // H.262 | H.264 | H.265 | ISO/IEC 13818-2/11172-2/14496-2/14496-10 video stream '1110 xxxx'
24     pub const PES_SID_PRIVATE_1: u8 = 0xBD; // private_stream_1
25 }
26 
27 pub const AF_FLAG_PCR: u8 = 0x10;
28 pub const AF_FLAG_RANDOM_ACCESS_INDICATOR: u8 = 0x40;
29 pub const PTS_NO_VALUE: i64 = i64::MIN; //(int64_t)0x8000000000000000L
30 
31 pub const TS_HEADER_LEN: u8 = 4; // 1-bytes sync byte + 2-bytes PID + 1-byte CC
32 pub const PES_HEADER_LEN: u8 = 6; // 3-bytes packet_start_code_prefix + 1-byte stream_id + 2-bytes PES_packet_length
33 
34 pub const TS_PAYLOAD_UNIT_START_INDICATOR: u8 = 0x40;
35 
36 pub const TS_PACKET_SIZE: usize = 188;
37 
38 pub const MPEG_FLAG_IDR_FRAME: u16 = 0x0001;
39 pub const MPEG_FLAG_H264_H265_WITH_AUD: u16 = 0x8000;
40 
41 pub const PAT_PERIOD: i64 = 400 * 90;
42