summaryrefslogtreecommitdiff
path: root/tvapi/libtv/tv/CTvScanner.h (plain)
blob: 5272162c5cd14723a67bef8fd90b6607953632c4
1//
2//
3// amlogic 2013
4//
5// @ Project : tv
6// @ File Name :
7// @ Date : 2013-11
8// @ Author :
9//
10//
11#include <am_scan.h>
12#include <am_epg.h>
13#include <am_mem.h>
14#include "CTvChannel.h"
15#include "CTvLog.h"
16#include "CTvEv.h"
17#include "tvin/CTvin.h"
18
19#if !defined(_CTVSCANNER_H)
20#define _CTVSCANNER_H
21class CTvScanner {
22public:
23 /** ATSC Attenna type */
24 static const int AM_ATSC_ATTENNA_TYPE_AIR = 1;
25 static const int AM_ATSC_ATTENNA_TYPE_CABLE_STD = 2;
26 static const int AM_ATSC_ATTENNA_TYPE_CABLE_IRC = 3;
27 static const int AM_ATSC_ATTENNA_TYPE_CABLE_HRC = 4;
28 CTvScanner(CTvin *pTvin);
29 ~CTvScanner();
30 void setGlobalScanerObject(CTvScanner *);
31 int startScan();
32 int stopScan();
33 int ATVManualScan(int min_freq, int max_freq, int std, int store_Type = 0, int channel_num = 0);
34 int autoAtvScan(int min_freq, int max_freq, int std, int search_type);
35 int autoDtmbScan();
36 int manualDtmbScan(int beginFreq, int endFreq, int modulation = -1);
37 int autoAtscScan(int attennaType, int std);
38 int manualDtmbScan(int freq);
39 int manualAtscScan(int freq, int attennaType, int std);
40 int autoTvScan();
41 int unsubscribeEvent();
42
43 class ScannerEvent: public CTvEv {
44 public:
45 static const int EVENT_SCAN_PROGRESS = 0;
46 static const int EVENT_STORE_BEGIN = 1;
47 static const int EVENT_STORE_END = 2;
48 static const int EVENT_SCAN_END = 3;
49 static const int EVENT_BLINDSCAN_PROGRESS = 4;
50 static const int EVENT_BLINDSCAN_NEWCHANNEL = 5;
51 static const int EVENT_BLINDSCAN_END = 6;
52 static const int EVENT_ATV_PROG_DATA = 7;
53
54 ScannerEvent(): CTvEv(CTvEv::TV_EVENT_SCANNER)
55 {
56 }
57 ~ScannerEvent()
58 {
59 }
60 int mType;
61 int mPercent;
62 int mTotalChannelCount;
63 int mLockedStatus;
64 int mChannelNumber;
65 //CTvChannel mChannel;
66 int mMode;
67 int mFrequency;
68 int mSymbolRate;
69 int mModulation;
70 int mBandwidth;
71 int mOfdm_mode;
72 int mAudio;
73 int mStandard;
74 int mSat_polarisation;
75 //
76 int mStrength;
77 int mSnr;
78 char mProgramName[1024];
79 int mprogramType;
80 char mMSG[128];
81 //for atv
82 int mVideoStd;
83 int mAudioStd;
84 int mIsAutoStd;//1 is true
85 int mAfcData;
86 // ScannerEvent(int type){
87 // this->mType = type;
88 // }
89 };
90
91 class IObserver {
92 public:
93 IObserver() {};
94 virtual ~IObserver() {};
95 virtual void onEvent(const ScannerEvent &ev) = 0;
96 };
97 //1 VS n
98 //int addObserver(IObserver* ob);
99 //int removeObserver(IObserver* ob);
100
101 //1 VS 1
102 int setObserver(IObserver *ob)
103 {
104 mpObserver = ob;
105 return 0;
106 }
107private:
108 static AM_Bool_t s_atv_cvbs_lock_check(void *);
109 AM_Bool_t atv_cvbs_lock_check(v4l2_std_id *colorStd);
110 static void tv_scan_evt_callback(long dev_no, int event_type, void *param, void *data);
111 static void am_scan_atv_store(AM_SCAN_Result_t *result);
112 void tv_scan_reconnect_dmx_to_fend(int dmx_no, int fend_no);
113 int getAtscChannelPara(int attennaType, Vector<sp<CTvChannel> > &vcp);
114 //
115 AM_SCAN_Handle_t mScanHandle;
116 volatile bool mbScanStart;
117
118 //scan para info
119 /** General TV Scan Mode */
120 static const int TV_MODE_ATV = 0; // Only search ATV
121 static const int TV_MODE_DTV = 1; // Only search DTV
122 static const int TV_MODE_ADTV = 2; // A/DTV will share a same frequency list, like ATSC
123 /** DTV scan mode */
124 static const int DTV_MODE_AUTO = 1;
125 static const int DTV_MODE_MANUAL = 2;
126 static const int DTV_MODE_ALLBAND = 3;
127 static const int DTV_MODE_BLIND = 4;
128
129 /** DTV scan options, DONOT channge */
130 static const int DTV_OPTION_UNICABLE = 0x10; //Satellite unicable mode
131 static const int DTV_OPTION_FTA = 0x20; //Only store free programs
132 static const int DTV_OPTION_NO_TV = 0x40; //Only store tv programs
133 static const int DTV_OPTION_NO_RADIO = 0x80; //Only store radio programs
134
135 /** ATV scan mode */
136 static const int ATV_MODE_AUTO = 1;
137 static const int ATV_MODE_MANUAL = 2;
138
139 //
140private:
141
142 //
143 IObserver *mpObserver;
144 //
145 CTvin *mpTvin;
146 int mMode;
147 int mFendID;
148 /** DTV parameters */
149 int mTvMode;
150 int mTvOptions;
151 int mSat_id;
152 int mSource;
153 //showboz
154 //TVSatelliteParams tv_satparams;
155 int mTsSourceID;
156 CTvChannel mStartChannel;
157 Vector<CTvChannel> mvChooseListChannels;
158 /** ATV parameters */
159 int mAtvMode;
160 int mStartFreq;
161 int mDirection;
162 int mChannelID;
163
164
165
166 //extern for scanner
167 //int channelID; //can be used for manual scan
168 /** Atv set */
169 int mMinFreq;
170 int mMaxFreq;
171 long long mCurScanStartFreq;
172 long long mCurScanEndFreq;
173 int tunerStd;
174 /** Tv set */
175 int demuxID;//default 0
176 String8 defaultTextLang;
177 String8 orderedTextLangs;
178 //showboz
179 //Vector<CTvChannel> ChannelList;//VS mvChooseListChannels
180
181 /** Dtv-Sx set Unicable settings*/
182 int user_band;
183 int ub_freq;//!< kHz
184
185 ScannerEvent mCurEv;
186 static CTvScanner *m_s_Scanner;
187};
188#endif //CTVSCANNER_H
189