1 #include "drmtransmitter.h"
2 #include "configparams.h"
3 #include "drm.h"
4
5
6 // timing table;
7
8
9 int partTable[BWs][MODES][PROTECTIONS][QAMS]=
10 {
11 {
12 {{96,160,240},{67,140,201}},
13 {{49,103,149},{96,160,240}},
14 {{67,112,168},{49,83,124}}
15 },
16 {
17 {{104,174,261},{78,163,235}},
18 {{54,113,163},{104,174,261}},
19 {{78,130,196},{54,90,135}}
20 }
21 };
22
23
drmTransmitter()24 drmTransmitter::drmTransmitter()
25 {
26 DRMTransmitter=NULL;
27 }
28
~drmTransmitter()29 drmTransmitter::~drmTransmitter()
30 {
31
32 }
33
34
init(QByteArray * ba,QString name,QString format,drmTxParams params)35 void drmTransmitter::init(QByteArray *ba, QString name, QString format, drmTxParams params)
36 {
37 if(DRMTransmitter) delete DRMTransmitter;
38 dataLength=ba->count();
39 DRMTransmitter=new CDRMTransmitter;
40 // int picSize;
41 ERobMode RobMod;
42 ESpecOcc BW ;
43 CParameter::ESymIntMod eNewDepth;
44 ECodScheme eNewScheme;
45 CMSCProtLev eNewMSCPre;
46 CService Service;
47 DRMTransmitter->init_base();
48 // DRMTransmitter.GetSoundOutInterface()->SetDev(nr_devout);
49 DRMTransmitter->GetAudSrcEnc()->ClearPicFileNames();
50 TransmParam = DRMTransmitter->GetParameters();
51 // picSize=ba->size();
52 DRMTransmitter->GetAudSrcEnc()->SetPicFileName(ba,name,format);
53 switch (params.robMode)
54 {
55 case 0 :
56 RobMod = RM_ROBUSTNESS_MODE_A;
57 break;
58 case 1 :
59 RobMod = RM_ROBUSTNESS_MODE_B ;
60 break ;
61 default:
62 RobMod = RM_ROBUSTNESS_MODE_E ;
63 break;
64 }
65 switch (params.bandwith)
66 {
67 case 0 :
68 BW = SO_0;
69 break;
70 default :
71 BW = SO_1 ;
72 break ;
73 }
74 TransmParam->InitCellMapTable(RobMod , BW);
75
76 switch (params.interleaver)
77 {
78 case 0 :
79 eNewDepth = CParameter::SI_LONG;
80 break ;
81 default :
82 eNewDepth = CParameter::SI_SHORT;
83 break;
84 }
85 TransmParam->SetInterleaverDepth(eNewDepth);
86 switch (params.qam)
87 {
88 case 0 :
89 eNewScheme = CS_1_SM ; //4Bit QAM
90 break;
91 case 1 :
92 eNewScheme = CS_2_SM ; //16Bit QAM
93 break ;
94 default :
95 eNewScheme = CS_3_SM; // 64Bit QAM
96 break;
97 }
98 TransmParam->SetMSCCodingScheme(eNewScheme);
99 switch (params.protection)
100 {
101 case 1 :
102 eNewMSCPre.iPartB = 1; //Norm
103 break;
104 default:
105 eNewMSCPre.iPartB = 0 ; //High
106 break ;
107 }
108 TransmParam->SetMSCProtLev(eNewMSCPre, false);
109 Service.iServiceDescr=0;
110 Service.iServiceID=0;
111 Service.iLanguage=5;
112 Service.strLabel=params.callsign.toLatin1().data();
113 TransmParam->SetServiceParameters(0,Service);
114 DRMTransmitter->Init();
115 // calculate transmision time
116 duration=(double)(numTxFrames)*0.4*1.005; // 1.005 ->some extra time for buffers
117 }
118
start(bool startTx)119 void drmTransmitter::start(bool startTx)
120 {
121
122 if(startTx)
123 {
124 stopDRM=false;
125 DRMTransmitter->Start();
126 }
127 else
128 {
129 stopDRM=true;
130 }
131 }
132
133
134
135
136
137