mpegts/parser/
stream_id.rs

1
2use mpegts::stream_id::*;
3
4pub fn get_stream_id(stream_id: u8) -> StreamId {
5  match stream_id {
6    0x00 => StreamId::Reserved,
7    0x01 => StreamId::IsoIec_11172_2_Mpeg1_Video,
8    0x02 => StreamId::IsoIec_13818_2_Mpeg2_Video,
9    0x03 => StreamId::IsoIec_11172_3_Mpeg1_Audio,
10    0x04 => StreamId::IsoIec_13818_3_Mpeg2_Audio,
11    0x05 => StreamId::IsoIec_13818_1_PrivateSection,
12    0x06 => StreamId::IsoIec_13818_1_Pes,
13    0x07 => StreamId::IsoIec_13522_Mheg,
14    0x08 => StreamId::Itu_T_H222_0_Annex_A_Dsm_Cc,
15    0x09 => StreamId::Itu_T_H222_1,
16    0x0a => StreamId::IsoIec_13818_6_Dsm_Cc_Type_A,
17    0x0b => StreamId::IsoIec_13818_6_Dsm_Cc_Type_B,
18    0x0c => StreamId::IsoIec_13818_6_Dsm_Cc_Type_C,
19    0x0d => StreamId::IsoIec_13818_6_Dsm_Cc_Type_D,
20    0x0e => StreamId::IsoIec_13818_1_Auxiliary,
21    0x0f => StreamId::IsoIec_13818_7_AAC_Audio,
22    0x10 => StreamId::IsoIec_14496_2_Mpeg4_Video,
23    0x11 => StreamId::IsoIec_14496_3_AAC_Latm_Audio,
24    0x1b => StreamId::Itu_T_H264_Video,
25    0x24 => StreamId::Itu_T_H265_Video,
26    0xea => StreamId::Vc1_Video,
27    0xd1 => StreamId::Dirac_Video,
28    0x81 => StreamId::Ac3_Audio,
29    0x8a => StreamId::Dts_Audio,
30    0xbd => StreamId::NonMpegAudioSubpictures,
31    0xbe => StreamId::PaddingStream,
32    0xbf => StreamId::NavigationData,
33       _ => {
34      if (stream_id >= 0xc0) && (stream_id <= 0xdf) {
35        StreamId::AudioStream{id: stream_id}
36      } else {
37        if (stream_id >= 0xe0) && (stream_id <= 0xef) {
38          StreamId::VideoStream{id: stream_id}
39        } else {
40          println!("Unknown Stream ID {:?}", stream_id);
41          StreamId::Unknown
42        }
43      }
44    }
45  }
46}