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