1#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
4pub enum TableID {
5 ProgramAssociationSection,
6 ConditionalAccessSection,
7 ProgramMapSection,
8 TransportStreamDescriptionSection,
9
10 NetworkInformationSectionActualNetwork,
11 NetworkInformationSectionOtherNetwork,
12 ServiceDescriptionSectionActualTransportStream,
13
14 ServiceDescriptionSectionOtherTransportStream,
15 BouquetAssociationSection,
16 EISActualTransportStream,
17 EISOtherTransportStream,
18
19 EISActualTransportStreamSchedule(u8),
20 EISOtherTransportStreamSchedule(u8),
21
22 TimeDateSection,
23 RunningStatusSection,
24 StuffingSection,
25 TimeOffsetSection,
26 ApplicationInformationSection,
27 ContainerSection,
28 RelatedContentSection,
29 ContentIdentifierSection,
30 MPEFECSection,
31 ResolutionNotificationSection,
32 MPEIFECSection,
33 DiscontinuityInformationSection,
34 SelectionInformationSection,
35
36 Reserved(u8),
37
38 Other(u8),
39}
40
41impl From<u8> for TableID {
42 fn from(d: u8) -> Self {
43 match d {
44 0x00 => TableID::ProgramAssociationSection,
45 0x01 => TableID::ConditionalAccessSection,
46 0x02 => TableID::ProgramMapSection,
47 0x03 => TableID::TransportStreamDescriptionSection,
48
49 0x40 => TableID::NetworkInformationSectionActualNetwork,
50 0x41 => TableID::NetworkInformationSectionOtherNetwork,
51 0x42 => TableID::ServiceDescriptionSectionActualTransportStream,
52
53 0x46 => TableID::ServiceDescriptionSectionOtherTransportStream,
54 0x4A => TableID::BouquetAssociationSection,
55 0x4E => TableID::EISActualTransportStream,
56 0x4F => TableID::EISOtherTransportStream,
57
58 0x70 => TableID::TimeDateSection,
59 0x71 => TableID::RunningStatusSection,
60 0x72 => TableID::StuffingSection,
61 0x73 => TableID::TimeOffsetSection,
62 0x74 => TableID::ApplicationInformationSection,
63 0x75 => TableID::ContainerSection,
64 0x76 => TableID::RelatedContentSection,
65 0x77 => TableID::ContentIdentifierSection,
66 0x78 => TableID::MPEFECSection,
67 0x79 => TableID::ResolutionNotificationSection,
68 0x7A => TableID::MPEIFECSection,
69 0x7E => TableID::DiscontinuityInformationSection,
70 0x7F => TableID::SelectionInformationSection,
71
72 0x04..=0x3F | 0x43..=0x45 => TableID::Reserved(d),
73
74 0x50..=0x5F => TableID::EISActualTransportStreamSchedule(d),
75 0x60..=0x6F => TableID::EISOtherTransportStreamSchedule(d),
76
77 _ => TableID::Other(d),
78 }
79 }
80}
81
82impl From<TableID> for u8 {
83 fn from(id: TableID) -> u8 {
84 match id {
85 TableID::ProgramAssociationSection => 0x00,
86 TableID::ConditionalAccessSection => 0x01,
87 TableID::ProgramMapSection => 0x02,
88 TableID::TransportStreamDescriptionSection => 0x03,
89
90 TableID::NetworkInformationSectionActualNetwork => 0x40,
91 TableID::NetworkInformationSectionOtherNetwork => 0x41,
92 TableID::ServiceDescriptionSectionActualTransportStream => 0x42,
93
94 TableID::ServiceDescriptionSectionOtherTransportStream => 0x46,
95 TableID::BouquetAssociationSection => 0x4A,
96 TableID::EISActualTransportStream => 0x4E,
97 TableID::EISOtherTransportStream => 0x4F,
98
99 TableID::TimeDateSection => 0x70,
100 TableID::RunningStatusSection => 0x71,
101 TableID::StuffingSection => 0x72,
102 TableID::TimeOffsetSection => 0x73,
103 TableID::ApplicationInformationSection => 0x74,
104 TableID::ContainerSection => 0x75,
105 TableID::RelatedContentSection => 0x76,
106 TableID::ContentIdentifierSection => 0x77,
107 TableID::MPEFECSection => 0x78,
108 TableID::ResolutionNotificationSection => 0x79,
109 TableID::MPEIFECSection => 0x7A,
110 TableID::DiscontinuityInformationSection => 0x7E,
111 TableID::SelectionInformationSection => 0x7F,
112
113 TableID::Reserved(d) => d,
114
115 TableID::EISActualTransportStreamSchedule(d) => d,
116 TableID::EISOtherTransportStreamSchedule(d) => d,
117
118 TableID::Other(d) => d,
119 }
120 }
121}