enigma2 (20120321 rel32 -> 20120327 rel32)
[enigma2.git] / usr / include / enigma2 / lib / dvb / specs.h
1 #ifndef __lib_dvb_specs_h
2 #define __lib_dvb_specs_h
3
4 #include <lib/dvb/idvb.h>
5 #include <lib/dvb/idemux.h>
6 #include <dvbsi++/program_map_section.h>
7 #include <dvbsi++/service_description_section.h>
8 #include <dvbsi++/network_information_section.h>
9 #include <dvbsi++/bouquet_association_section.h>
10 #include <dvbsi++/program_association_section.h>
11 #include <dvbsi++/event_information_section.h>
12
13 struct eDVBPMTSpec
14 {
15         eDVBTableSpec m_spec;
16 public:
17         eDVBPMTSpec(int pid, int sid, int timeout = 20000)
18         {
19                 m_spec.pid     = pid;
20                 m_spec.tid     = ProgramMapSection::TID;
21                 m_spec.tidext  = sid;
22                 m_spec.timeout = timeout; // ProgramMapSection::TIMEOUT;
23                 m_spec.flags   = eDVBTableSpec::tfAnyVersion | 
24                         eDVBTableSpec::tfHaveTID | eDVBTableSpec::tfHaveTIDExt | 
25                         eDVBTableSpec::tfCheckCRC | eDVBTableSpec::tfHaveTimeout;
26         }
27         operator eDVBTableSpec &()
28         {
29                 return m_spec;
30         }
31 };
32
33 struct eDVBSDTSpec
34 {
35         eDVBTableSpec m_spec;
36 public:
37         eDVBSDTSpec()
38         {
39                 m_spec.pid     = ServiceDescriptionSection::PID;
40                 m_spec.tid     = ServiceDescriptionSection::TID;
41                 m_spec.timeout = 20000; // ServiceDescriptionSection::TIMEOUT;
42                 m_spec.flags   = eDVBTableSpec::tfAnyVersion |
43                         eDVBTableSpec::tfHaveTID | eDVBTableSpec::tfCheckCRC |
44                         eDVBTableSpec::tfHaveTimeout;
45         }
46         eDVBSDTSpec(int tsid, bool other=false)
47         {
48                 m_spec.pid     = ServiceDescriptionSection::PID;
49                 m_spec.tid     = ServiceDescriptionSection::TID;
50                 m_spec.tidext  = tsid;
51                 m_spec.timeout = 60000; // ServiceDescriptionSection::TIMEOUT;
52                 m_spec.flags   = eDVBTableSpec::tfAnyVersion |
53                         eDVBTableSpec::tfHaveTID | eDVBTableSpec::tfCheckCRC |
54                         eDVBTableSpec::tfHaveTIDExt | eDVBTableSpec::tfHaveTimeout;
55                 if (other)
56                 {
57                         // SDT other transport stream have TID 0x46 (current is 0x42)
58                         // so we mask out the third bit in table id mask..
59                         m_spec.flags |= eDVBTableSpec::tfHaveTIDMask;
60                         m_spec.tid_mask = 0xFB;
61                 }
62         }
63         operator eDVBTableSpec &()
64         {
65                 return m_spec;
66         }
67 };
68
69 struct eDVBNITSpec
70 {
71         eDVBTableSpec m_spec;
72 public:
73         eDVBNITSpec()
74         {
75                 m_spec.pid     = NetworkInformationSection::PID;
76                 m_spec.tid     = NetworkInformationSection::TID;
77                 m_spec.timeout = NetworkInformationSection::TIMEOUT;
78                 m_spec.flags   = eDVBTableSpec::tfAnyVersion |
79                         eDVBTableSpec::tfHaveTID | eDVBTableSpec::tfCheckCRC |
80                         eDVBTableSpec::tfHaveTimeout;
81         }
82         operator eDVBTableSpec &()
83         {
84                 return m_spec;
85         }
86 };
87
88 struct eDVBBATSpec
89 {
90         eDVBTableSpec m_spec;
91 public:
92         eDVBBATSpec()
93         {
94                 m_spec.pid     = BouquetAssociationSection::PID;
95                 m_spec.tid     = BouquetAssociationSection::TID;
96                 m_spec.timeout = BouquetAssociationSection::TIMEOUT;
97                 m_spec.flags   = eDVBTableSpec::tfAnyVersion |
98                         eDVBTableSpec::tfHaveTID | eDVBTableSpec::tfCheckCRC |
99                         eDVBTableSpec::tfHaveTimeout;
100         }
101         operator eDVBTableSpec &()
102         {
103                 return m_spec;
104         }
105 };
106
107 struct eDVBPATSpec
108 {
109         eDVBTableSpec m_spec;
110 public:
111         eDVBPATSpec(int timeout=20000)
112         {
113                 m_spec.pid     = ProgramAssociationSection::PID;
114                 m_spec.tid     = ProgramAssociationSection::TID;
115                 m_spec.timeout = timeout; // ProgramAssociationSection::TIMEOUT;
116                 m_spec.flags   = eDVBTableSpec::tfAnyVersion |
117                         eDVBTableSpec::tfHaveTID | eDVBTableSpec::tfCheckCRC |
118                         eDVBTableSpec::tfHaveTimeout;
119         }
120         operator eDVBTableSpec &()
121         {
122                 return m_spec;
123         }
124 };
125
126 class eDVBEITSpec
127 {
128         eDVBTableSpec m_spec;
129 public:
130                 /* this is for now&next on actual transponder. */
131         eDVBEITSpec(int sid)
132         {
133                 m_spec.pid     = EventInformationSection::PID;
134                 m_spec.tid     = EventInformationSection::TID;
135                 m_spec.tidext  = sid;
136                 m_spec.timeout = EventInformationSection::TIMEOUT;
137                 m_spec.flags   = eDVBTableSpec::tfAnyVersion | 
138                         eDVBTableSpec::tfHaveTID | eDVBTableSpec::tfHaveTIDExt |
139                         eDVBTableSpec::tfCheckCRC | eDVBTableSpec::tfHaveTimeout;
140         }
141         operator eDVBTableSpec &()
142         {
143                 return m_spec;
144         }
145 };
146
147 class eDVBEITSpecOther
148 {
149         eDVBTableSpec m_spec;
150 public:
151                 /* this is for now&next on actual transponder. */
152         eDVBEITSpecOther(int sid)
153         {
154                 m_spec.pid     = EventInformationSection::PID;
155                 m_spec.tid     = TID_EIT_OTHER;
156                 m_spec.tidext  = sid;
157                 m_spec.timeout = EventInformationSection::TIMEOUT;
158                 m_spec.flags   = eDVBTableSpec::tfAnyVersion |
159                         eDVBTableSpec::tfHaveTID | eDVBTableSpec::tfHaveTIDExt |
160                         eDVBTableSpec::tfCheckCRC | eDVBTableSpec::tfHaveTimeout;
161         }
162         operator eDVBTableSpec &()
163         {
164                 return m_spec;
165         }
166 };
167
168 #endif