blob: 4df10969df3653c81d418317b8a0f989da248ce0
1 | |
2 | // amlogic 2013 |
3 | // |
4 | // @ Project : tv |
5 | // @ File Name : CDtv.h |
6 | // @ Date : 2013-11 |
7 | // @ Author : |
8 | |
9 | #if !defined(_CDTV_H) |
10 | #define _CDTV_H |
11 | #include <stdint.h> |
12 | #include <sys/time.h> |
13 | #include <am_epg.h> |
14 | #include <am_mem.h> |
15 | #include <utils/threads.h> |
16 | #include "CTvProgram.h" |
17 | #include "CTvEpg.h" |
18 | #include "CTvScanner.h" |
19 | #include "CTvLog.h" |
20 | #include "CTvTime.h" |
21 | #include "CTvEvent.h" |
22 | #include "CTvEv.h" |
23 | #include "CTvBooking.h" |
24 | #include "CFrontEnd.h" |
25 | #include "../vpp/CVpp.h" |
26 | #include "../vpp/CPQdb.h" |
27 | #include "../tvin/CTvin.h" |
28 | #include "../tvutils/CMsgQueue.h" |
29 | #include "../tvutils/CSerialCommunication.h" |
30 | #include "../tvutils/serial_operate.h" |
31 | #include "CTvRecord.h" |
32 | #include "CTvSubtitle.h" |
33 | #include "CUpgradeFBC.h" |
34 | #include "CAv.h" |
35 | #include "CTvDmx.h" |
36 | #include "../audio/audio_api.h" |
37 | #include "AutoBackLight.h" |
38 | using namespace android; |
39 | |
40 | static const char *TV_CONFIG_FILE_PATH = "/param/tvconfig.conf"; |
41 | static const char *TV_DB_PATH = "/param/dtv.db"; |
42 | static const char *TV_CONFIG_FILE_SYSTEM_PATH = "/system/etc/tvconfig.conf"; |
43 | static const char *TV_CONFIG_FILE_PARAM_PATH = "/param/tvconfig.conf"; |
44 | static const char *TV_CHANNEL_LIST_SYSTEM_PATH = "/system/etc/tv_default.xml"; |
45 | static const char *TV_CHANNEL_LIST_PARAM_PATH = "/param/tv_default.xml"; |
46 | static const char *TV_SSM_DATA_SYSTEM_PATH = "/system/etc/ssm_data"; |
47 | static const char *TV_SSM_DATA_PARAM_PATH = "/param/ssm_data"; |
48 | |
49 | #define DEVICE_CLASS_TSYNC_AV_THRESHOLD_MIN "/sys/class/tsync/av_threshold_min" |
50 | #define AV_THRESHOLD_MIN_MS "540000" //6S = 6*90000 |
51 | |
52 | #define DEFAULT_COMPENSATION_VALUE 0 |
53 | |
54 | |
55 | typedef enum tv_fmt_ratio_e { |
56 | RATIO_43, |
57 | RATIO_169, |
58 | RATIO_MAX, |
59 | } tv_fmt_ratio_t; |
60 | |
61 | typedef enum tv_color_fmt_e { |
62 | COLOR_RGB444, |
63 | COLOR_YUV422, |
64 | COLOR_YUV444, |
65 | COLOR_MAX, |
66 | } tv_color_fmt_t; |
67 | |
68 | |
69 | |
70 | typedef enum tv_window_mode_e { |
71 | NORMAL_WONDOW, |
72 | PREVIEW_WONDOW, |
73 | } tv_window_mode_t; |
74 | |
75 | typedef enum tv_dtv_scan_running_status_e { |
76 | DTV_SCAN_RUNNING_NORMAL, |
77 | DTV_SCAN_RUNNING_ANALYZE_CHANNEL, |
78 | } tv_dtv_scan_running_status_t; |
79 | |
80 | typedef struct tv_config_s { |
81 | unsigned int overscan_3d; |
82 | unsigned int tv_out_counter; |
83 | bool kernelpet_disable; |
84 | unsigned int kernelpet_timeout; |
85 | bool userpet; |
86 | unsigned int userpet_timeout; |
87 | unsigned int userpet_reset; |
88 | unsigned int dtv_videopath_switch; |
89 | bool title_shake; |
90 | bool memory512m; |
91 | } tv_config_t; |
92 | |
93 | typedef enum TvRunStatus_s { |
94 | TV_INIT_ED = -1, |
95 | TV_OPEN_ED = 0, |
96 | TV_START_ED , |
97 | TV_RESUME_ED, |
98 | TV_PAUSE_ED, |
99 | TV_STOP_ED, |
100 | TV_CLOSE_ED, |
101 | } TvRunStatus_t; |
102 | |
103 | class CTv : public CTvin::CTvinSigDetect::ISigDetectObserver, public CTvin::CSourceConnectDetect::ISourceConnectObserver, public CTvin::CHDMIRxCEC::IHDMIRxCECObserver, public CUpgradeFBC::IUpgradeFBCObserver, public CSerialCommunication::ISerialCommunicationObserver |
104 | { |
105 | public: |
106 | static const int TV_ACTION_NULL = 0x0000; |
107 | static const int TV_ACTION_STARTING = 0x0001; |
108 | static const int TV_ACTION_STOPING = 0x0002; |
109 | static const int TV_ACTION_SCANNING = 0x0004; |
110 | static const int TV_ACTION_PLAYING = 0x0008; |
111 | static const int TV_ACTION_RECORDING = 0x0010; |
112 | static const int TV_ACTION_SOURCE_SWITCHING = 0x0020; |
113 | public: |
114 | class TvIObserver |
115 | { |
116 | public: |
117 | TvIObserver() {}; |
118 | virtual ~TvIObserver() {}; |
119 | virtual void onTvEvent ( const CTvEv &ev ) = 0; |
120 | }; |
121 | //main |
122 | CTv(); |
123 | virtual ~CTv(); |
124 | virtual int OpenTv ( void ); |
125 | virtual int CloseTv ( void ); |
126 | virtual int StartTvLock (); |
127 | virtual int StopTvLock ( void ); |
128 | virtual TvRunStatus_t GetTvStatus(); |
129 | virtual int ClearAnalogFrontEnd(); |
130 | virtual tv_source_input_t GetLastSourceInput (void); |
131 | virtual int SetSourceSwitchInput (tv_source_input_t source_input ); |
132 | virtual tv_source_input_t GetCurrentSourceInputLock ( void ); |
133 | virtual tvin_info_t GetCurrentSignalInfo ( void ); |
134 | virtual int SetPreviewWindow ( tvin_window_pos_t pos ); |
135 | virtual int dtvAutoScan(); |
136 | virtual int dtvManualScan (int beginFreq, int endFreq, int modulation = -1); |
137 | virtual int atvAutoScan(int videoStd, int audioStd, int searchType); |
138 | virtual int clearAllProgram(int arg0); |
139 | virtual int clearDbAllProgramInfoTable(); |
140 | virtual void setSourceSwitchAndPlay(); |
141 | virtual int GetDisplayResolutionConfig(); |
142 | virtual int GetDisplayResolutionInfo(); |
143 | virtual int atvMunualScan ( int startFreq, int endFreq, int videoStd, int audioStd, int store_Type = 0, int channel_num = 0 ); |
144 | virtual int stopScanLock(); |
145 | virtual int dtvAutoScanAtscLock(int attenna, int videoStd, int audioStd); |
146 | virtual void SetRecordFileName ( char *name ); |
147 | virtual void StartToRecord(); |
148 | virtual void StopRecording(); |
149 | virtual void SetRecCurTsOrCurProgram ( int sel ); |
150 | virtual int startCC(int country, int src, int channel, int service); |
151 | virtual int stopCC(); |
152 | virtual void printDebugInfo(); |
153 | virtual int playProgramLock ( int progId ); |
154 | virtual int playDvbcProgram ( int progId ); |
155 | virtual int playDtmbProgram ( int progId ); |
156 | virtual int playAtvProgram ( int progId ); |
157 | virtual int stopPlayingLock(); |
158 | virtual int resetFrontEndPara ( frontend_para_set_t feParms ); |
159 | int SetCurProgramAudioVolumeCompensationVal ( int tmpVal ); |
160 | int GetAudioVolumeCompensationVal(int progDbId); |
161 | //dtv audio track info |
162 | int getAudioTrackNum ( int progId ); |
163 | int getAudioInfoByIndex ( int progId, int idx, int *pAFmt, String8 &lang ); |
164 | int switchAudioTrack ( int progId, int idx ); |
165 | int getVideoFormatInfo ( int *pWidth, int *pHeight, int *pFPS, int *pInterlace ); |
166 | int ResetAudioDecoderForPCMOutput(); |
167 | int setAudioChannel ( int channelIdx ); |
168 | int getAudioChannel(); |
169 | int setTvObserver (TvIObserver *ob); |
170 | int getAtscAttenna(); |
171 | long getTvTime() |
172 | { |
173 | return mTvTime.getTime(); |
174 | }; |
175 | void getFrontendStatus(); |
176 | int getFrontendSignalStrength(); |
177 | int getFrontendSNR(); |
178 | int getFrontendBER(); |
179 | int getChannelInfoBydbID ( int dbID, channel_info_t &chan_info ); |
180 | int setBlackoutEnable(int enable); |
181 | int getSaveBlackoutEnable(); |
182 | void startAutoBackLight(); |
183 | void stopAutoBackLight(); |
184 | int getAutoBackLight_on_off(); |
185 | int saveATVProgramID ( int dbID ); |
186 | int getATVProgramID ( void ); |
187 | int saveDTVProgramID ( int dbID ); |
188 | int getDTVProgramID ( void ); |
189 | int getCurPlayProgId(); |
190 | int getATVMinMaxFreq ( int *scanMinFreq, int *scanMaxFreq ); |
191 | |
192 | int Tv_SSMRestoreDefaultSetting(); |
193 | |
194 | // |
195 | int GetSourceConnectStatus(int source_input); |
196 | int IsDVISignal(); |
197 | int isVgaFmtInHdmi(); |
198 | // |
199 | int getHDMIFrameRate ( void ); |
200 | void RefreshAudioMasterVolume ( tv_source_input_t source_input ); |
201 | |
202 | int Tv_Set3DMode ( VIDEO_3D_MODE_T mode ); |
203 | VIDEO_3D_MODE_T Tv_Get3DMode ( void ); |
204 | int Tv_Set3DLRSwith ( int on_off); |
205 | int Tv_Get3DLRSwith ( void ); |
206 | int Tv_Set3DTo2DMode ( int mode); |
207 | int Tv_Get3DTo2DMode ( void ); |
208 | int Tv_Set3DDepth ( int value ); |
209 | int GetSave3DDepth ( void ); |
210 | is_3d_type_t Check2Dor3D ( VIDEO_3D_MODE_T mode3d, tvin_trans_fmt_t trans_fmt ); |
211 | int Tvin_SetPLLValues (); |
212 | int SetCVD2Values (); |
213 | unsigned int Vpp_GetDisplayResolutionInfo(tvin_window_pos_t *win_pos); |
214 | int get_hdmi_sampling_rate(); |
215 | //SSM |
216 | int Tv_SSMFacRestoreDefaultSetting(); |
217 | |
218 | CTvin::CTvinSigDetect mSigDetectThread; |
219 | CTvin::CSourceConnectDetect mSourceConnectDetectThread; |
220 | CTvin::CHDMIRxCEC mHDMIRxCEC; |
221 | CUpgradeFBC *mpUpgradeFBC; |
222 | CSerialCommunication mSerialA; |
223 | CSerialCommunication mSerialB; |
224 | CSerialCommunication mSerialC; |
225 | |
226 | int SendHDMIRxCECCustomMessage(unsigned char data_buf[]); |
227 | int SendHDMIRxCECCustomMessageAndWaitReply(unsigned char data_buf[], unsigned char reply_buf[], int WaitCmd, int timeout); |
228 | int SendHDMIRxCECBoradcastStandbyMessage(); |
229 | int SendHDMIRxCECGiveCECVersionMessage(tv_source_input_t source_input, unsigned char data_buf[]); |
230 | int SendHDMIRxCECGiveDeviceVendorIDMessage(tv_source_input_t source_input, unsigned char data_buf[]); |
231 | int SendHDMIRxCECGiveOSDNameMessage(tv_source_input_t source_input, unsigned char data_buf[]); |
232 | |
233 | int GetHdmiHdcpKeyKsvInfo(int data_buf[]); |
234 | int StartUpgradeFBC(char *file_name, int mode, int upgrade_blk_size); |
235 | int SetSerialSwitch(int dev_id, int switch_val); |
236 | int SendSerialData(int dev_id, int data_len, unsigned char data_buf[]); |
237 | int ChannelExport(const char *destPath); |
238 | int ChannelImport(const char *srcPath); |
239 | int Tv_GetProjectInfo(project_info_t *ptrInfo); |
240 | int Tv_GetPlatformType(); |
241 | int Tv_SetDDDRCMode(tv_source_input_t source_input); |
242 | int Tv_SetAudioSourceType (tv_source_input_t source_input); |
243 | |
244 | //PQ |
245 | int Tv_SetBrightness ( int brightness, tv_source_input_type_t source_type, int is_save ); |
246 | int Tv_GetBrightness ( tv_source_input_type_t source_type ); |
247 | int Tv_SetContrast ( int contrast, tv_source_input_type_t source_type, int is_save ); |
248 | int Tv_GetContrast ( tv_source_input_type_t source_type ); |
249 | int Tv_SetSaturation ( int satuation, tv_source_input_type_t source_type, tvin_sig_fmt_t sig_fmt, int is_save ); |
250 | int Tv_GetSaturation ( tv_source_input_type_t source_type ); |
251 | int Tv_SetHue ( int hue, tv_source_input_type_t source_type, tvin_sig_fmt_t sig_fmt, int is_save ); |
252 | int Tv_GetHue ( tv_source_input_type_t source_type ); |
253 | int Tv_SetPQMode ( vpp_picture_mode_t mode, tv_source_input_type_t source_type, int is_save ); |
254 | vpp_picture_mode_t Tv_GetPQMode ( tv_source_input_type_t source_type ); |
255 | int Tv_SetSharpness ( int value, tv_source_input_type_t source_type, int en, int is_save ); |
256 | int Tv_GetSharpness ( tv_source_input_type_t source_type ); |
257 | int Tv_SaveSharpness ( int value, tv_source_input_type_t source_type, int is_enable ); |
258 | int Tv_SetBacklight ( int value, tv_source_input_type_t source_type, int is_save ); |
259 | int Tv_GetBacklight ( tv_source_input_type_t source_type ); |
260 | int Tv_SetColorTemperature ( vpp_color_temperature_mode_t mode, tv_source_input_type_t source_type, int is_save ); |
261 | vpp_color_temperature_mode_t Tv_GetColorTemperature ( tv_source_input_type_t source_type ); |
262 | int Tv_SaveColorTemp ( vpp_color_temperature_mode_t mode, tv_source_input_type_t source_type ); |
263 | int Tv_SetDisplayMode ( vpp_display_mode_t mode, tv_source_input_type_t source_type, tvin_sig_fmt_t fmt, int is_save ); |
264 | vpp_display_mode_t Tv_GetDisplayMode ( tv_source_input_type_t source_type ); |
265 | int Tv_SaveDisplayMode ( vpp_display_mode_t mode, tv_source_input_type_t source_type ); |
266 | int Tv_SetNoiseReductionMode ( vpp_noise_reduction_mode_t mode, tv_source_input_type_t source_type, int is_save ); |
267 | vpp_noise_reduction_mode_t Tv_GetNoiseReductionMode ( tv_source_input_type_t source_type ); |
268 | int Tv_SaveNoiseReductionMode ( vpp_noise_reduction_mode_t mode, tv_source_input_type_t source_type ); |
269 | int Tv_SetRGBOGO_PostOffset(int type, int offset); |
270 | int Tv_SetRGBOGO_Gain(int type, int gain); |
271 | int Tv_GetRGBOGO_PostOffset ( int type ); |
272 | int Tv_GetRGBOGO_Gain ( int type ); |
273 | // |
274 | int Tv_FactorySetPQMode_Brightness ( int source_type, int pq_mode, int brightness ); |
275 | int Tv_FactoryGetPQMode_Brightness ( int source_type, int pq_mode ); |
276 | int Tv_FactorySetPQMode_Contrast ( int source_type, int pq_mode, int contrast ); |
277 | int Tv_FactoryGetPQMode_Contrast ( int source_type, int pq_mode ); |
278 | int Tv_FactorySetPQMode_Saturation ( int source_type, int pq_mode, int saturation ); |
279 | int Tv_FactoryGetPQMode_Saturation ( int source_type, int pq_mode ); |
280 | int Tv_FactorySetPQMode_Hue ( int source_type, int pq_mode, int hue ); |
281 | int Tv_FactoryGetPQMode_Hue ( int source_type, int pq_mode ); |
282 | int Tv_FactorySetPQMode_Sharpness ( int source_type, int pq_mode, int sharpness ); |
283 | int Tv_FactoryGetPQMode_Sharpness ( int source_type, int pq_mode ); |
284 | int Tv_FactorySetColorTemp_Rgain ( int source_type, int colortemp_mode, int rgain ); |
285 | int Tv_FactorySaveColorTemp_Rgain ( int source_type, int colortemp_mode, int rgain ); |
286 | int Tv_FactoryGetColorTemp_Rgain ( int source_type, int colortemp_mode ); |
287 | int Tv_FactorySetColorTemp_Ggain ( int source_type, int colortemp_mode, int ggain ); |
288 | int Tv_FactorySaveColorTemp_Ggain ( int source_type, int colortemp_mode, int ggain ); |
289 | int Tv_FactoryGetColorTemp_Ggain ( int source_type, int colortemp_mode ); |
290 | int Tv_FactorySetColorTemp_Bgain ( int source_type, int colortemp_mode, int bgain ); |
291 | int Tv_FactorySaveColorTemp_Bgain ( int source_type, int colortemp_mode, int bgain ); |
292 | int Tv_FactoryGetColorTemp_Bgain ( int source_type, int colortemp_mode ); |
293 | int Tv_FactorySetColorTemp_Roffset ( int source_type, int colortemp_mode, int roffset ); |
294 | int Tv_FactorySaveColorTemp_Roffset ( int source_type, int colortemp_mode, int roffset ); |
295 | int Tv_FactoryGetColorTemp_Roffset ( int source_type, int colortemp_mode ); |
296 | int Tv_FactorySetColorTemp_Goffset ( int source_type, int colortemp_mode, int goffset ); |
297 | int Tv_FactorySaveColorTemp_Goffset ( int source_type, int colortemp_mode, int goffset ); |
298 | int Tv_FactoryGetColorTemp_Goffset ( int source_type, int colortemp_mode ); |
299 | int Tv_FactorySetColorTemp_Boffset ( int source_type, int colortemp_mode, int boffset ); |
300 | int Tv_FactorySaveColorTemp_Boffset ( int source_type, int colortemp_mode, int boffset ); |
301 | int Tv_FactoryGetColorTemp_Boffset ( int source_type, int colortemp_mode ); |
302 | int GetColorTemperatureParams ( vpp_color_temperature_mode_t Tempmode, tcon_rgb_ogo_t *params ); |
303 | int Tv_FactorySetTestPattern ( int pattern ); |
304 | int Tv_FactoryGetTestPattern ( void ); |
305 | int Tv_FactoryResetPQMode ( void ); |
306 | int Tv_FactoryResetColorTemp ( void ); |
307 | int Tv_FactorySetParamsDefault ( void ); |
308 | int Tv_FactorySetDDRSSC ( int step ); |
309 | int Tv_FactoryGetDDRSSC ( void ); |
310 | int Tv_FactorySetLVDSSSC ( int step ); |
311 | int Tv_FactoryGetLVDSSSC ( void ); |
312 | int Tv_FactorySetNolineParams ( int noline_params_type, int source_type, noline_params_t noline_params ); |
313 | noline_params_t Tv_FactoryGetNolineParams ( int noline_params_type, int source_type ); |
314 | int Tv_FactorySetOverscan ( int source_type, int fmt, int status_3d, int trans_fmt, tvin_cutwin_t cutwin_t ); |
315 | tvin_cutwin_t Tv_FactoryGetOverscan ( int source_type, int fmt, int status_3d, int trans_fmt ); |
316 | //end PQ |
317 | |
318 | //TV TO FBC |
319 | int Tv_FactorySet_FBC_Brightness ( int value ); |
320 | int Tv_FactoryGet_FBC_Brightness ( void ); |
321 | int Tv_FactorySet_FBC_Contrast( int value ); |
322 | int Tv_FactoryGet_FBC_Contrast ( void ); |
323 | int Tv_FactorySet_FBC_Saturation( int value ); |
324 | int Tv_FactoryGet_FBC_Saturation ( void ); |
325 | int Tv_FactorySet_FBC_HueColorTint( int value ); |
326 | int Tv_FactoryGet_FBC_HueColorTint ( void ); |
327 | int Tv_FactorySet_FBC_Backlight ( int value ); |
328 | int Tv_FactoryGet_FBC_Backlight ( void ); |
329 | int Tv_FactorySet_FBC_Backlight_N360 ( int value ); |
330 | int Tv_FactoryGet_FBC_Backlight_N360 ( void ); |
331 | int Tv_FactorySet_FBC_ELEC_MODE( int value ); |
332 | int Tv_FactoryGet_FBC_ELEC_MODE( void ); |
333 | int Tv_FactorySet_FBC_Picture_Mode ( int mode ); |
334 | int Tv_FactoryGet_FBC_Picture_Mode ( void ); |
335 | int Tv_FactorySet_FBC_Set_Test_Pattern ( int mode ); |
336 | int Tv_FactoryGet_FBC_Get_Test_Pattern ( void ); |
337 | int Tv_FactorySet_FBC_Gain_Red( int value ); |
338 | int Tv_FactoryGet_FBC_Gain_Red ( void ); |
339 | int Tv_FactorySet_FBC_Gain_Green( int value ); |
340 | int Tv_FactoryGet_FBC_Gain_Green( void ); |
341 | int Tv_FactorySet_FBC_Gain_Blue( int value ); |
342 | int Tv_FactoryGet_FBC_Gain_Blue ( void ); |
343 | int Tv_FactorySet_FBC_Offset_Red( int value ); |
344 | int Tv_FactoryGet_FBC_Offset_Red ( void ); |
345 | int Tv_FactorySet_FBC_Offset_Green( int value ); |
346 | int Tv_FactoryGet_FBC_Offset_Green( void ); |
347 | int Tv_FactorySet_FBC_Offset_Blue( int value ); |
348 | int Tv_FactoryGet_FBC_Offset_Blue ( void ); |
349 | int Tv_FactoryGetWhiteBalanceRedGain(int source_type, int colortemp_mode); |
350 | int Tv_FactoryGetWhiteBalanceGreenGain(int source_type, int colortemp_mode); |
351 | int Tv_FactoryGetWhiteBalanceBlueGain(int source_type, int colortemp_mode); |
352 | int Tv_FactoryGetWhiteBalanceRedOffset(int source_type, int colortemp_mode); |
353 | int Tv_FactoryGetWhiteBalanceGreenOffset(int source_type, int colortemp_mode); |
354 | int Tv_FactoryGetWhiteBalanceBlueOffset(int source_type, int colortemp_mode); |
355 | int Tv_FactorySetWhiteBalanceRedGain(int source_type, int colortemp_mode, int value); |
356 | int Tv_FactorySetWhiteBalanceGreenGain(int source_type, int colortemp_mode, int value); |
357 | int Tv_FactorySetWhiteBalanceBlueGain(int source_type, int colortemp_mode, int value); |
358 | int Tv_FactorySetWhiteBalanceRedOffset(int source_type, int colortemp_mode, int value); |
359 | int Tv_FactorySetWhiteBalanceGreenOffset(int source_type, int colortemp_mode, int value); |
360 | int Tv_FactorySetWhiteBalanceBlueOffset(int source_type, int colortemp_mode, int value); |
361 | int Tv_FactorySetWhiteBalanceColorTempMode(int source_type, int colortemp_mode, int is_save); |
362 | int Tv_FactoryGetWhiteBalanceColorTempMode(int source_type ); |
363 | int Tv_FactoryWhiteBalanceFormatInputFbcGainParams(int value); |
364 | int Tv_FactoryWhiteBalanceFormatInputFbcOffsetParams(int value); |
365 | int Tv_FactoryWhiteBalanceFormatOutputFbcOffsetParams(int value); |
366 | int Tv_FactoryWhiteBalanceFormatOutputFbcGainParams(int value); |
367 | int Tv_FactorySaveWhiteBalancePramas(int source_type, int tempmode, int r_gain, int g_gain, int b_gain, int r_offset, int g_offset, int b_offset); |
368 | int Tv_FactoryCloseWhiteBalanceGrayPattern(); |
369 | int Tv_FactoryOpenWhiteBalanceGrayPattern(); |
370 | int Tv_FactorySetWhiteBalanceGrayPattern(int value); |
371 | int Tv_FactoryGetWhiteBalanceGrayPattern(); |
372 | int Tv_FactoryWhiteBalanceColorTempMappingG92Fbc(int Tempmode); |
373 | int Tv_FactoryWhiteBalanceColorTempMappingFbc2G9(int Tempmode); |
374 | int Tv_FactoryWhiteBalanceGetAllParams(int Tempmode, tcon_rgb_ogo_t *params); |
375 | int Tv_FactorySet_FBC_GrayPattern(int value); |
376 | int Tv_FactoryOpen_FBC_GrayPattern(); |
377 | int Tv_FactoryClose_FBC_GrayPattern(); |
378 | int Tv_FactorySet_FBC_ColorTemp_Mode( int mode ); |
379 | int Tv_FactoryGet_FBC_ColorTemp_Mode ( void ); |
380 | int Tv_FactorySet_FBC_ColorTemp_Mode_N360( int mode ); |
381 | int Tv_FactoryGet_FBC_ColorTemp_Mode_N360 ( void ); |
382 | int Tv_FactorySet_FBC_WB_Initial( int status ); |
383 | int Tv_FactoryGet_FBC_WB_Initial ( void ); |
384 | int Tv_FactorySet_FBC_ColorTemp_Batch(vpp_color_temperature_mode_t Tempmode, tcon_rgb_ogo_t params); |
385 | int Tv_FactoryGet_FBC_ColorTemp_Batch ( vpp_color_temperature_mode_t Tempmode, tcon_rgb_ogo_t *params ); |
386 | int Tv_FactorySet_WB_G9_To_FBC( vpp_color_temperature_mode_t Tempmode, tcon_rgb_ogo_t params ); |
387 | int Tv_FactoryGet_WB_G9_To_FBC ( vpp_color_temperature_mode_t Tempmode, tcon_rgb_ogo_t *params ); |
388 | int Tv_FactoryGetItemFromBatch(vpp_color_temperature_mode_t colortemp_mode, int item); |
389 | int Tv_FactorySet_FBC_CM_OnOff( unsigned char status ); |
390 | int Tv_FactoryGet_FBC_CM_OnOff (void); |
391 | int Tv_FactorySet_FBC_DNLP_OnOff( unsigned char status ); |
392 | int Tv_FactoryGet_FBC_DNLP_OnOff (void); |
393 | int Tv_FactorySet_FBC_Gamma_OnOff( unsigned char status ); |
394 | int Tv_FactoryGet_FBC_Gamma_OnOff (void); |
395 | int Tv_FactorySet_FBC_WhiteBalance_OnOff( unsigned char status ); |
396 | int Tv_FactoryGet_FBC_WhiteBalance_OnOff (void); |
397 | int Tv_FactorySet_FBC_Thermal_State( int value ); |
398 | int Tv_FactorySet_FBC_backlight_onoff(int value); |
399 | int Tv_FactoryGet_FBC_backlight_onoff ( void ); |
400 | int Tv_FactorySet_FBC_LVDS_SSG_Set( int value ); |
401 | int Tv_FactorySet_FBC_LightSensor_Status_N310 ( int value ); |
402 | int Tv_FactoryGet_FBC_LightSensor_Status_N310 ( void ); |
403 | int Tv_FactorySet_FBC_Dream_Panel_Status_N310 ( int value ); |
404 | int Tv_FactoryGet_FBC_Dream_Panel_Status_N310 ( void ); |
405 | int Tv_FactorySet_FBC_MULT_PQ_Status_N310 ( int value ); |
406 | int Tv_FactoryGet_FBC_MULT_PQ_Status_N310 ( void ); |
407 | int Tv_FactorySet_FBC_MEMC_Status_N310 ( int value ); |
408 | int Tv_FactoryGet_FBC_MEMC_Status_N310 ( void ); |
409 | //end TV TO FBC |
410 | |
411 | //audio |
412 | int SetAudioMuteForSystem(int muteOrUnmute); |
413 | int GetAudioMuteForSystem(); |
414 | int SetAudioAVOutMute(int muteStatus); |
415 | int GetAudioAVOutMute(); |
416 | int SetAudioSPDIFMute(int muteStatus); |
417 | int GetAudioSPDIFMute(); |
418 | int SetAudioMasterVolume(int tmp_vol); |
419 | int GetAudioMasterVolume(); |
420 | int SaveCurAudioMasterVolume(int tmp_vol); |
421 | int GetCurAudioMasterVolume(); |
422 | int SetAudioBalance(int tmp_val); |
423 | int GetAudioBalance(); |
424 | int SaveCurAudioBalance(int tmp_val); |
425 | int GetCurAudioBalance(); |
426 | int SetAudioSupperBassVolume(int tmp_vol); |
427 | int GetAudioSupperBassVolume(); |
428 | int SaveCurAudioSupperBassVolume(int tmp_vol); |
429 | int GetCurAudioSupperBassVolume(); |
430 | int SetAudioSupperBassSwitch(int tmp_val); |
431 | int GetAudioSupperBassSwitch(); |
432 | int SaveCurAudioSupperBassSwitch(int tmp_val); |
433 | int GetCurAudioSupperBassSwitch(); |
434 | int SetAudioSRSSurround(int tmp_val); |
435 | int GetAudioSRSSurround(); |
436 | int SaveCurAudioSrsSurround(int tmp_val); |
437 | int GetCurAudioSRSSurround(); |
438 | int SetAudioSrsDialogClarity(int tmp_val); |
439 | int GetAudioSrsDialogClarity(); |
440 | int SaveCurAudioSrsDialogClarity(int tmp_val); |
441 | int GetCurAudioSrsDialogClarity(); |
442 | int SetAudioSrsTruBass(int tmp_val); |
443 | int GetAudioSrsTruBass(); |
444 | int SaveCurAudioSrsTruBass(int tmp_val); |
445 | int GetCurAudioSrsTruBass(); |
446 | int SetAudioBassVolume(int tmp_vol); |
447 | int GetAudioBassVolume(); |
448 | int SaveCurAudioBassVolume(int tmp_vol); |
449 | int GetCurAudioBassVolume(); |
450 | int SetAudioTrebleVolume(int tmp_vol); |
451 | int GetAudioTrebleVolume(); |
452 | int SaveCurAudioTrebleVolume(int tmp_vol); |
453 | int GetCurAudioTrebleVolume(); |
454 | int SetAudioSoundMode(int tmp_val); |
455 | int GetAudioSoundMode(); |
456 | int SaveCurAudioSoundMode(int tmp_val); |
457 | int GetCurAudioSoundMode(); |
458 | int SetAudioWallEffect(int tmp_val); |
459 | int GetAudioWallEffect(); |
460 | int SaveCurAudioWallEffect(int tmp_val); |
461 | int GetCurAudioWallEffect(); |
462 | int SetAudioEQMode(int tmp_val); |
463 | int GetAudioEQMode(); |
464 | int SaveCurAudioEQMode(int tmp_val); |
465 | int GetCurAudioEQMode(); |
466 | int GetAudioEQRange(int range_buf[]); |
467 | int SetAudioEQGain(int gain_buf[]); |
468 | int GetAudioEQGain(int gain_buf[]); |
469 | int SaveCurAudioEQGain(int gain_buf[]); |
470 | int GetCurAudioEQGain(int gain_buf[]); |
471 | int GetAudioEQBandCount(); |
472 | int SetAudioEQSwitch(int switch_val); |
473 | int SetAudioSPDIFSwitch(int tmp_val); |
474 | int amAudioSetDoubleOutputSwitch(int en_val); |
475 | int UsbAudioOuputModuleSwitch(int sw); |
476 | int GetAmAudioSetDoubleOutputSwitch(); |
477 | int GetCurUsbAudioOuputModuleSwitch(); |
478 | int SaveCurAudioSPDIFSwitch(int tmp_val); |
479 | int GetCurAudioSPDIFSwitch(); |
480 | int SetAudioSPDIFMode(int tmp_val); |
481 | int SaveCurAudioSPDIFMode(int tmp_val); |
482 | int GetCurAudioSPDIFMode(); |
483 | int OpenAmAudio(unsigned int sr, int output_device); |
484 | int CloseAmAudio(void); |
485 | int SetAmAudioInputSr(unsigned int sr, int output_device); |
486 | int SetAmAudioOutputMode(int mode); |
487 | int SetAmAudioMusicGain(int gain); |
488 | int SetAmAudioLeftGain(int gain); |
489 | int SetAmAudioRightGain(int gain); |
490 | int AudioLineInSelectChannel(int audio_channel); |
491 | int SetKalaokIO(int level); |
492 | int AudioSetAudioInSource(int audio_src_in_type); |
493 | int AudioSetLineInCaptureVolume(int l_vol, int r_vol); |
494 | int AudioHandleHeadsetPlugIn(); |
495 | int AudioHandleHeadsetPullOut(); |
496 | //end audio |
497 | |
498 | protected: |
499 | class CTvMsgQueue: public CMsgQueueThread, public CAv::IObserver, public CTvScanner::IObserver , public CTvEpg::IObserver, public CFrontEnd::IObserver |
500 | { |
501 | public: |
502 | static const int TV_MSG_COMMON = 0; |
503 | static const int TV_MSG_STOP_ANALYZE_TS = 1; |
504 | static const int TV_MSG_START_ANALYZE_TS = 2; |
505 | static const int TV_MSG_CHECK_FE_DELAY = 3; |
506 | static const int TV_MSG_AV_EVENT = 4; |
507 | static const int TV_MSG_FE_EVENT = 5; |
508 | static const int TV_MSG_SCAN_EVENT = 6; |
509 | static const int TV_MSG_EPG_EVENT = 7; |
510 | |
511 | CTvMsgQueue(CTv *tv); |
512 | ~CTvMsgQueue(); |
513 | //scan observer |
514 | void onEvent ( const CTvScanner::ScannerEvent &ev ); |
515 | //epg observer |
516 | void onEvent ( const CTvEpg::EpgEvent &ev ); |
517 | //FE observer |
518 | void onEvent ( const CFrontEnd::FEEvent &ev ); |
519 | //AV |
520 | void onEvent(const CAv::AVEvent &ev); |
521 | private: |
522 | virtual void handleMessage ( CMessage &msg ); |
523 | CTv *mpTv; |
524 | }; |
525 | |
526 | |
527 | int resetDmxAndAvSource(); |
528 | int stopScan(); |
529 | int stopPlaying(); |
530 | void sendTvEvent ( const CTvEv &ev ); |
531 | int startPlayTv ( int source, int vid, int aid, int vfat, int afat ); |
532 | //scan observer |
533 | void onEvent ( const CTvScanner::ScannerEvent &ev ); |
534 | //epg observer |
535 | void onEvent ( const CTvEpg::EpgEvent &ev ); |
536 | //FE observer |
537 | void onEvent ( const CFrontEnd::FEEvent &ev ); |
538 | //AV |
539 | void onEvent(const CAv::AVEvent &ev); |
540 | bool Tv_Start_Analyze_Ts ( int channelID ); |
541 | bool Tv_Stop_Analyze_Ts(); |
542 | int Tvin_Stop ( void ); |
543 | int SetBypassModulesFor3D ( VIDEO_3D_MODE_E ); |
544 | int Vpp_SetDisplayMode ( vpp_display_mode_t display_mode, tv_source_input_type_t source_type, tvin_sig_fmt_t sig_fmt ); |
545 | int Tvin_GetTvinConfig(); |
546 | int Tv_init_audio(); |
547 | int Tv_MiscSetBySource ( tv_source_input_t ); |
548 | void print_version_info ( void ); |
549 | int dtvCleanProgramByFreq ( int freq ); |
550 | /*********************** Audio start **********************/ |
551 | int SetAudioMainVolLutBufName(); |
552 | int SetAudioSupperBassVolLutBufName(); |
553 | int SetAudioVolDigitLUTBuf ( tv_source_input_t source_input ); |
554 | int Tv_SetAudioInSource (tv_source_input_t source_input); |
555 | void Tv_SetAudioOutputSwap_Type (tv_source_input_t source_input); |
556 | /*********************** Audio end **********************/ |
557 | |
558 | // |
559 | virtual void onSigToStable(); |
560 | virtual void onSigStableToUnstable(); |
561 | virtual void onSigStableToUnSupport(); |
562 | virtual void onSigStableToNoSig(); |
563 | virtual void onSigUnStableToUnSupport(); |
564 | virtual void onSigUnStableToNoSig(); |
565 | virtual void onSigNullToNoSig(); |
566 | virtual void onSigNoSigToUnstable(); |
567 | virtual void onSigStillStable(); |
568 | virtual void onSigStillUnstable(); |
569 | virtual void onSigStillNosig(); |
570 | virtual void onSigStillNoSupport(); |
571 | virtual void onSigStillNull(); |
572 | virtual void onStableSigFmtChange(); |
573 | virtual void onStableTransFmtChange(); |
574 | virtual void onSigDetectEnter(); |
575 | virtual void onLoop(); |
576 | |
577 | virtual void onSourceConnect(int source_type, int connect_status); |
578 | virtual void onHDMIRxCECMessage(int msg_len, unsigned char msg_buf[]); |
579 | virtual void onUpgradeStatus(int status, int progress); |
580 | virtual void onSerialCommunication(int dev_id, int rd_len, unsigned char data_buf[]); |
581 | virtual void onThermalDetect(int state); |
582 | |
583 | CTvEpg mTvEpg; |
584 | CTvScanner mTvScanner; |
585 | mutable Mutex mLock; |
586 | CTvTime mTvTime; |
587 | CVpp mVpp; |
588 | CTvin mTvin; |
589 | CTvRecord mTvRec; |
590 | CFrontEnd mFrontDev; |
591 | CTvDimension mTvVchip; |
592 | CTvSubtitle mTvSub; |
593 | CTvAudio mTvAudio; |
594 | CAv mAv; |
595 | CTvDmx mTvDmx; |
596 | CTvMsgQueue mTvMsgQueue; |
597 | AutoBackLight mAutoBackLight; |
598 | // |
599 | volatile int mTvAction; |
600 | volatile TvRunStatus_t mTvStatus; |
601 | volatile tv_source_input_t m_source_input; |
602 | volatile tv_source_input_t m_last_source_input; |
603 | /* for tvin window mode and pos*/ |
604 | tvin_window_pos_t m_win_pos; |
605 | tv_window_mode_t m_win_mode; |
606 | int m_blackout_enable;//1 enable 0 disable |
607 | int m_cur_playing_prog_id; |
608 | tvin_sig_fmt_t m_cur_set_info_fmt; |
609 | bool mIsFbc; |
610 | |
611 | |
612 | bool mlastlockstatus; |
613 | String8 mlastdm; |
614 | String8 mlastabbrev; |
615 | String8 mlastabbtext; |
616 | pthread_t vchipthread; |
617 | int mvchip_running; |
618 | friend class CTvMsgQueue; |
619 | int mCurAnalyzeTsChannelID; |
620 | int audio_sr; |
621 | TvIObserver *mpObserver; |
622 | tv_dtv_scan_running_status_t mDtvScanRunningStatus; |
623 | volatile tv_config_t gTvinConfig; |
624 | int dtv_auto_3d_flag; |
625 | bool m_autoset_displayfreq; |
626 | int m_sig_stable_nums; |
627 | bool m_is_set_hdmi_edid; |
628 | /** for L/R or B/T 3d mode overscan **/ |
629 | /** for 3D **/ |
630 | VIDEO_3D_MODE_T m_mode_3d; |
631 | /** for HDMI-in sampling detection. **/ |
632 | volatile bool m_is_hdmi_sr_detect_start; |
633 | int m_hdmi_sampling_rate; |
634 | }; |
635 | |
636 | #endif //_CDTV_H |
637 |