blob: 2912203e62aafc3c358a9eb43e00227c6e89d162
1 | // |
2 | // |
3 | // amlogic 2013 |
4 | // |
5 | // @ Project : tv |
6 | // @ File Name : CTvChannel.h |
7 | // @ Date : 2013-11 |
8 | // @ Author : |
9 | // |
10 | // |
11 | |
12 | |
13 | #if !defined(_CTVCHANNEL_H) |
14 | #define _CTVCHANNEL_H |
15 | #include <utils/Vector.h> |
16 | #include "CTvDatabase.h" |
17 | #include <utils/String8.h> |
18 | #include <utils/RefBase.h> |
19 | #include <stdlib.h> |
20 | |
21 | #include "CTvLog.h" |
22 | using namespace android; |
23 | // 对应模拟电视中的一个频点,数字电视中的一个频点调制的TS流 |
24 | class CTvChannel: public LightRefBase<CTvChannel> |
25 | { |
26 | |
27 | public : |
28 | static const int FE_HAS_SIGNAL = 0x01; |
29 | static const int FE_HAS_CARRIER = 0x02; |
30 | static const int FE_HAS_VITERBI = 0x04; |
31 | static const int FE_HAS_SYNC = 0x08; |
32 | /**锁定*/ |
33 | static const int FE_HAS_LOCK = 0x10; |
34 | /**超时*/ |
35 | static const int FE_TIMEDOUT = 0x20; |
36 | static const int FE_REINIT = 0x40; |
37 | |
38 | /**QPSK模式*/ |
39 | static const int MODE_QPSK = 0; |
40 | /**QAM模式*/ |
41 | static const int MODE_QAM = 1; |
42 | /**OFDM模式*/ |
43 | static const int MODE_OFDM = 2; |
44 | /**ATSC模式*/ |
45 | static const int MODE_ATSC = 3; |
46 | /**模拟模式*/ |
47 | static const int MODE_ANALOG = 4; |
48 | /**DTMB模式*/ |
49 | static const int MODE_DTMB = 5; |
50 | |
51 | |
52 | /**8MHz带宽*/ |
53 | static const int BANDWIDTH_8_MHZ = 0; |
54 | /**7MHz带宽*/ |
55 | static const int BANDWIDTH_7_MHZ = 1; |
56 | /**6MHz带宽*/ |
57 | static const int BANDWIDTH_6_MHZ = 2; |
58 | /**自动带宽检测*/ |
59 | static const int BANDWIDTH_AUTO = 3; |
60 | /**5MHZ带宽*/ |
61 | static const int BANDWIDTH_5_MHZ = 4; |
62 | /**10MHZ带宽*/ |
63 | static const int BANDWIDTH_10_MHZ = 5; |
64 | |
65 | /**QPSK调制*/ |
66 | static const int MODULATION_QPSK = 0; |
67 | /**QAM16调制*/ |
68 | static const int MODULATION_QAM_16 = 1; |
69 | /**QAM32调制*/ |
70 | static const int MODULATION_QAM_32 = 2; |
71 | /**QAM64调制*/ |
72 | static const int MODULATION_QAM_64 = 3; |
73 | /**QAM128调制*/ |
74 | static const int MODULATION_QAM_128 = 4; |
75 | /**QAM256调制*/ |
76 | static const int MODULATION_QAM_256 = 5; |
77 | /**QAM调制(自动检测)*/ |
78 | static const int MODULATION_QAM_AUTO = 6; |
79 | /**VSB8调制*/ |
80 | static const int MODULATION_VSB_8 = 7; |
81 | /**VSB16调制*/ |
82 | static const int MODULATION_VSB_16 = 8; |
83 | /**PSK8调制*/ |
84 | static const int MODULATION_PSK_8 = 9; |
85 | /**APSK16调制*/ |
86 | static const int MODULATION_APSK_16 = 10; |
87 | /**APSK32调制*/ |
88 | static const int MODULATION_APSK_32 = 11; |
89 | /**DQPSK调制*/ |
90 | static const int MODULATION_DQPSK = 12; |
91 | |
92 | /**单声道*/ |
93 | static const int AUDIO_MONO = 0x0000; |
94 | /**立体声*/ |
95 | static const int AUDIO_STEREO = 0x0001; |
96 | /**语言2*/ |
97 | static const int AUDIO_LANG2 = 0x0002; |
98 | /**SAP*/ |
99 | static const int AUDIO_SAP = 0x0002; |
100 | /**语言1*/ |
101 | static const int AUDIO_LANG1 = 0x0003; |
102 | /**语言1/2*/ |
103 | static const int AUDIO_LANG1_LANG2 = 0x0004; |
104 | |
105 | /**PAL B*/ |
106 | static const int STD_PAL_B = 0x00000001; |
107 | /**PAL B1*/ |
108 | static const int STD_PAL_B1 = 0x00000002; |
109 | /**PAL G*/ |
110 | static const int STD_PAL_G = 0x00000004; |
111 | /**PAL H*/ |
112 | static const int STD_PAL_H = 0x00000008; |
113 | /**PAL I*/ |
114 | static const int STD_PAL_I = 0x00000010; |
115 | /**PAL D*/ |
116 | static const int STD_PAL_D = 0x00000020; |
117 | /**PAL D1*/ |
118 | static const int STD_PAL_D1 = 0x00000040; |
119 | /**PAL K*/ |
120 | static const int STD_PAL_K = 0x00000080; |
121 | /**PAL M*/ |
122 | static const int STD_PAL_M = 0x00000100; |
123 | /**PAL N*/ |
124 | static const int STD_PAL_N = 0x00000200; |
125 | /**PAL Nc*/ |
126 | static const int STD_PAL_Nc = 0x00000400; |
127 | /**PAL 60*/ |
128 | static const int STD_PAL_60 = 0x00000800; |
129 | /**NTSC M*/ |
130 | static const int STD_NTSC_M = 0x00001000; |
131 | /**NTSC M JP*/ |
132 | static const int STD_NTSC_M_JP = 0x00002000; |
133 | /**NTSC 443*/ |
134 | static const int STD_NTSC_443 = 0x00004000; |
135 | /**NTSC M KR*/ |
136 | static const int STD_NTSC_M_KR = 0x00008000; |
137 | /**SECAM B*/ |
138 | static const int STD_SECAM_B = 0x00010000; |
139 | /**SECAM D*/ |
140 | static const int STD_SECAM_D = 0x00020000; |
141 | /**SECAM G*/ |
142 | static const int STD_SECAM_G = 0x00040000; |
143 | /**SECAM H*/ |
144 | static const int STD_SECAM_H = 0x00080000; |
145 | /**SECAM K*/ |
146 | static const int STD_SECAM_K = 0x00100000; |
147 | /**SECAM K1*/ |
148 | static const int STD_SECAM_K1 = 0x00200000; |
149 | /**SECAM L*/ |
150 | static const int STD_SECAM_L = 0x00400000; |
151 | /**SECAM LC*/ |
152 | static const int STD_SECAM_LC = 0x00800000; |
153 | /**ATSC VSB8*/ |
154 | static const int STD_ATSC_8_VSB = 0x01000000; |
155 | /**ATSC VSB16*/ |
156 | static const int STD_ATSC_16_VSB = 0x02000000; |
157 | /**NTSC*/ |
158 | static const int STD_NTSC = STD_NTSC_M | STD_NTSC_M_JP | STD_NTSC_M_KR; |
159 | /**SECAM DK*/ |
160 | static const int STD_SECAM_DK = STD_SECAM_D | STD_SECAM_K | STD_SECAM_K1; |
161 | /**SECAM*/ |
162 | static const int STD_SECAM = STD_SECAM_B | STD_SECAM_G | STD_SECAM_H | STD_SECAM_DK | STD_SECAM_L | STD_SECAM_LC; |
163 | /**PAL BG*/ |
164 | static const int STD_PAL_BG = STD_PAL_B | STD_PAL_B1 | STD_PAL_G; |
165 | /**PAL DK*/ |
166 | static const int STD_PAL_DK = STD_PAL_D | STD_PAL_D1 | STD_PAL_K; |
167 | /**PAL*/ |
168 | static const int STD_PAL = STD_PAL_BG | STD_PAL_DK | STD_PAL_H | STD_PAL_I; |
169 | |
170 | //static const int TUNER_STD_MN = STD_PAL_M|STD_PAL_N|STD_PAL_Nc| STD_NTSC |
171 | static const int STD_B = STD_PAL_B | STD_PAL_B1 | STD_SECAM_B; |
172 | static const int STD_GH = STD_PAL_G | STD_PAL_H | STD_SECAM_G | STD_SECAM_H; |
173 | static const int STD_DK = STD_PAL_DK | STD_SECAM_DK; |
174 | static const int STD_M = STD_PAL_M | STD_NTSC_M; |
175 | static const int STD_BG = STD_PAL_BG | STD_SECAM_B | STD_SECAM_G ; |
176 | |
177 | static const int COLOR_AUTO = 0x02000000; |
178 | static const int COLOR_PAL = 0x04000000; |
179 | static const int COLOR_NTSC = 0x08000000; |
180 | static const int COLOR_SECAM = 0x10000000; |
181 | |
182 | /**水平极性*/ |
183 | static const int SAT_POLARISATION_H = 0; |
184 | /**垂直极限*/ |
185 | static const int SAT_POLARISATION_V = 1; |
186 | |
187 | public: |
188 | CTvChannel(); |
189 | CTvChannel(int dbID, int mode, int freq, int bw, int mod, int sym, int ofdm, int channelNum); |
190 | ~CTvChannel(); |
191 | // 根据TVChannelParams,向数据库添加一个Channel |
192 | |
193 | // *创建当前卫星所有通道 |
194 | // *@param sat_id 卫星id |
195 | // *@return 返回创建的通道 |
196 | static Vector<CTvChannel> tvChannelList(int sat_id); |
197 | static int selectByID(int id, CTvChannel &c); |
198 | static int updateByID(int progID, int std, int freq, int fineFreq); |
199 | static int SelectByFreq(int freq, CTvChannel &channel); |
200 | static int DeleteBetweenFreq(int beginFreq, int endFreq); |
201 | static int CleanAllChannelBySrc(int src); |
202 | static int getChannelListBySrc(int src, Vector< sp<CTvChannel> > &v_channel); |
203 | void tvChannelDel(); |
204 | static void tvChannelDelBySatID(int id); |
205 | int getID() |
206 | { |
207 | return id; |
208 | }; |
209 | int getDVBTSID(); |
210 | void getDVBOrigNetID(); |
211 | void getFrontendID(); |
212 | void getTSSourceID(); |
213 | void isDVBCMode(); |
214 | void setFrequency(); |
215 | int getFrequency() |
216 | { |
217 | return frequency; |
218 | } |
219 | int getSymbolRate() |
220 | { |
221 | return symbolRate; |
222 | } |
223 | int getModulation() |
224 | { |
225 | return modulation; |
226 | } |
227 | int getBandwidth() |
228 | { |
229 | return bandwidth; |
230 | } |
231 | int getMode() |
232 | { |
233 | return mode; |
234 | } |
235 | |
236 | int getStd() |
237 | { |
238 | return standard; |
239 | }; |
240 | int getAfcData() |
241 | { |
242 | return afc_data; |
243 | }; |
244 | int getLogicalChannelNum() |
245 | { |
246 | return logicalChannelNum; |
247 | }; |
248 | // 设置符号率(QPSK/QAM模式) |
249 | // @param symbolRate 符号率 |
250 | void setSymbolRate(); |
251 | // 设置极性(QPSK模式) |
252 | void setPolarisation(); |
253 | void setATVAudio(); |
254 | // 修改模拟视频制式 |
255 | void setATVVideoFormat(); |
256 | void setATVAudioFormat(); |
257 | void setATVFreq(); |
258 | void setATVAfcData(); |
259 | // |
260 | private: |
261 | |
262 | void createFromCursor(CTvDatabase::Cursor &c); |
263 | |
264 | // |
265 | int id; |
266 | int dvbTSID; |
267 | int dvbOrigNetID; |
268 | int fendID; |
269 | int tsSourceID; |
270 | |
271 | int mode; |
272 | int frequency; |
273 | int symbolRate; |
274 | int modulation; |
275 | int bandwidth; |
276 | int audio; |
277 | int standard; |
278 | int afc_data; |
279 | int sat_id; |
280 | int logicalChannelNum; |
281 | //showboz |
282 | //public TVSatelliteParams tv_satparams; |
283 | int sat_polarisation; |
284 | |
285 | }; |
286 | |
287 | #endif //_CTVCHANNEL_H |
288 | |
289 |