DtvKit_ATSC3.0
Loading...
Searching...
No Matches
atsc_mw_frontend_control.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3 *
4 * This file is part of a DTVKit Software Component
5 * You are permitted to copy, modify or distribute this file subject to the terms
6 * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
7 *
8 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
9 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
10 * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * If you or your organisation is not a member of DTVKit then you have access
13 * to this source code outside of the terms of the licence agreement
14 * and you are expected to delete this and any associated files immediately.
15 * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
16 *******************************************************************************/
17
18#pragma once
19
20#include <stdio.h>
21#include <thread>
22#include <queue>
23#include <sys/time.h>
24#include <functional>
25
26#include "atsc_types.h"
28
36#define MAX_CHANNELS 80
37
39static const unsigned iFreqTable[eRegionMax][MAX_CHANNELS] =
40{
41 { //0 1 2 3 4 5 6 7 8 9
42 0, 0, 57, 63, 69, 79, 85, 177, 183, 189, // 0~ 9
43 195, 201, 207, 213, 473, 479, 485, 491, 497, 503, // 10~ 19
44 509, 515, 521, 527, 533, 539, 545, 551, 557, 563, // 20~ 29
45 569, 575, 581, 587, 593, 599, 605, 611, 617, 623, // 30~ 39
46 629, 635, 641, 647, 653, 659, 665, 671, 677, 683, // 40~ 49
47 689, 695, 701, 707, 713, 719, 725, 731, 737, 743, // 50~ 59
48 749, 755, 761, 767, 773, 779, 785, 791, 797, 803, // 60~ 69
49 809, 815, 0, 0, 0, 0, 0, 0, 0, 0 // 70~ 79
50 },
51 { //0 1 2 3 4 5 6 7 8 9
52 0, 0, 57, 63, 69, 79, 85, 177, 183, 189, // 0~ 9
53 195, 201, 207, 213, 473, 479, 485, 491, 497, 503, // 10~ 19
54 509, 515, 521, 527, 533, 539, 545, 551, 557, 563, // 20~ 29
55 569, 575, 581, 587, 593, 599, 605, 611, 617, 623, // 30~ 39
56 629, 635, 641, 647, 653, 659, 665, 671, 677, 683, // 40~ 49
57 689, 695, 701, 707, 756, 762, 768, 0, 0, 0, // 50~ 59
58 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0, 0, // 60~ 69
59 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0, 0 // 70~ 79
60 },
61 {// 0 1 2 3 4 5 6 7 8 9
62 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0~ 9
63 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10~ 19
64 0, 474, 482, 490, 498, 506, 514, 522, 530, 538, // 20~ 29
65 546, 554, 562, 570, 578, 586, 594, 602, 610, 618, // 30~ 39
66 626, 634, 642, 650, 658, 666, 674, 682, 690, 698, // 40~ 49
67 706, 714, 722, 730, 738, 746, 754, 762, 770, 778, // 50~ 59
68 786, 794, 802, 810, 818, 826, 834, 842, 850, 0 , // 60~ 69
69 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0, 0 // 70~ 79
70 }
71};
72
76typedef struct{
77 int32_t iPlp;
78 int32_t iDemod;
79 int32_t iTunerId;
80 uint32_t iCh;
81 uint8_t *pData;
82 uint32_t iLength;
83 void *pParent;
85
86
90typedef std::function<void(sFeData_t*)> FeDataCbFunc;
91
95typedef std::function<void(sFeStatus_t)> FeStatusCbFunc;
96
100typedef std::function<void(sFeParams_t)> FeParamsCbFunc;
101
105typedef std::function<void(sFeParams_t)> SystemTime;
106
112{
113public:
120 CFeCtrl(int32_t iId);
121
128 CFeCtrl(int32_t iId, int32_t iDemodId, int32_t iCh, int32_t iPlpId,int32_t iRegionId);
129
137
138 FeDataCbFunc mFrontendDataCb;
139 FeStatusCbFunc mFrontendStatusCb;
140 FeParamsCbFunc mFrontendParamsCb;
148 int32_t Open( void);
149
156 int32_t Stop(void);
157
164 int32_t GetId(void);
165
172 int32_t GetCh(void);
173
180 int32_t Start(void);
181
188 void Join(void);
189
197
204 int32_t GetProperties(sFeProp_t * pProp);
205
212 int32_t GetStatus(sFeStatus_t* pStatus);
213
220 int32_t GetFrontendInfo(sFeStatus_t *pStatus);
221
228 int32_t TuneToChannel(int32_t iChNum,int32_t iDemodId, int32_t iPlp);
229
236 int32_t ChangeProperties(int32_t iDemodId, int32_t iChNum, int32_t iPlpId,int32_t iRegionId);
237
244 void SetCallback(void* ctx, void* pInfo_func, void* pRecv_func, void *pNotify_func);
245
252 void SetHandler(FeDataCbFunc data,
253 FeStatusCbFunc status,
254 FeParamsCbFunc notify);
255
262 FLOAT_64 TimeDiff(timespec start);
263
270 void PutBitrate(int32_t iBitrate){
271 m_Bitrate += iBitrate;
272 }
273
280 int32_t GetFreq(void){
281 return m_Prop.iFreq;
282 }
283
290 int32_t GetDemodType(void){
291 return m_Prop.iDemod;
292 }
293
300 int32_t GetDemod(void);
301
308 int32_t GetFeLock(void);
309
316 int32_t GetPlpId(void);
317
318 void *mCtx;
321 timespec m_DataSkipTime;
324private:
325 int32_t m_Id;
326 int32_t m_Bitrate;
327 int32_t m_AvgBitrate;
328 std::thread* mThread;
329 CFeHwCtrl * m_pFeHw;
331 sFeProp_t m_Prop;
332 sFeProp_t m_NewProp;
340 void FrontendThreadHandler(void);
347 int32_t GetFreqForChannel(int32_t iChNum,eRegion_t iRegionId);
348
355 int32_t GetChannelForFreq(int32_t iFreq, eRegion_t iRegionId);
356
357};
#define MAX_CHANNELS
Definition atsc_mw_frontend_control.h:36
eRegion_t
Definition atsc_types.h:227
@ eRegionMax
Definition atsc_types.h:231
Definition atsc_mw_frontend_control.h:112
void SetCallback(void *ctx, void *pInfo_func, void *pRecv_func, void *pNotify_func)
SetCallback of CFeCtrl.
void * mCtx
Definition atsc_mw_frontend_control.h:318
int32_t GetDemod(void)
To get demod type.
int32_t GetFeLock(void)
To get FE lock status.
int32_t GetFrontendInfo(sFeStatus_t *pStatus)
GetFrontendInfo of CFeCtrl.
FeDataCbFunc mFrontendDataCb
Definition atsc_mw_frontend_control.h:138
int32_t GetPlpId(void)
To get Plp ID.
bool m_Running
Definition atsc_mw_frontend_control.h:319
int32_t TuneToChannel(int32_t iChNum, int32_t iDemodId, int32_t iPlp)
TuneToChannel of CFeCtrl.
int32_t GetFreq(void)
Get frequency.
Definition atsc_mw_frontend_control.h:280
void Join(void)
Join into CFeCtrl and start.
int32_t GetStatus(sFeStatus_t *pStatus)
GetStatus of CFeCtrl.
int32_t GetCh(void)
GetCh device for CFeCtrl.
FeParamsCbFunc mFrontendParamsCb
Definition atsc_mw_frontend_control.h:140
~CFeCtrl()
Destructor for CFeCtrl.
int32_t Start(void)
Start device for CFeCtrl.
int32_t GetId(void)
GetId device for CFeCtrl.
sFeProp_t GetProperties(void)
GetProperties of CFeCtrl.
int32_t Open(void)
Open device for CFeCtrl.
FeStatusCbFunc mFrontendStatusCb
Definition atsc_mw_frontend_control.h:139
timespec m_DataSkipTime
Definition atsc_mw_frontend_control.h:321
int32_t Stop(void)
Stop device for CFeCtrl.
int32_t ChangeProperties(int32_t iDemodId, int32_t iChNum, int32_t iPlpId, int32_t iRegionId)
TuneToChannel of CFeCtrl.
void PutBitrate(int32_t iBitrate)
put bitrate
Definition atsc_mw_frontend_control.h:270
void SetHandler(FeDataCbFunc data, FeStatusCbFunc status, FeParamsCbFunc notify)
SetHandler of CFeCtrl.
FLOAT_64 TimeDiff(timespec start)
Difference TimeDiff.
bool m_DataSkip
Definition atsc_mw_frontend_control.h:320
int32_t GetDemodType(void)
Get demod type.
Definition atsc_mw_frontend_control.h:290
Definition atsc_plf_frontend_hwcontrol.h:49
Definition atsc_mw_frontend_control.h:76
uint32_t iCh
Definition atsc_mw_frontend_control.h:80
int32_t iPlp
Definition atsc_mw_frontend_control.h:77
uint8_t * pData
Definition atsc_mw_frontend_control.h:81
int32_t iTunerId
Definition atsc_mw_frontend_control.h:79
uint32_t iLength
Definition atsc_mw_frontend_control.h:82
int32_t iDemod
Definition atsc_mw_frontend_control.h:78
void * pParent
Definition atsc_mw_frontend_control.h:83
Definition atsc_types.h:325
Definition atsc_types.h:338
eDemod_t iDemod
Definition atsc_types.h:351
int32_t iFreq
Definition atsc_types.h:345
Definition atsc_types.h:302