blib/lib/Linux/DVB/DVBT/Freq.pm

filter: Statementstmt 90.4% 66 / 73 Branchbran 65.0% 13 / 20 Conditioncond 54.5% 6 / 11 MC/DCmcdc 28.5% 2 / 7 Subroutinesub 85.7% 6 / 7 Podpod 100% 4 / 4 totaltotal 79.5% 97 / 122 CC 21 SCAR 17.7
CC
21
Cov
82%
country_list
12.0
chan_freq_list
7.0
country_supported
5.5
CRAP 5.9
« blib/lib/Linux/DVB/DVBT/Utils.pm ↑ Summary xs/DVBT-epg.c »
1 package Linux::DVB::DVBT::Freq ;
2  
3 =head1 NAME
4  
5 Linux::DVB::DVBT::Freq - DVBT frequency scanning
6  
7 =head1 SYNOPSIS
8  
9 use Linux::DVB::DVBT::Freq ;
10
11  
12 =head1 DESCRIPTION
13  
14 Module provides routines that create a list of frequencies to scan based on the country. The tables are based on the information in w_scan.
15  
16 =cut
17  
18  
19 10 ▶use strict ;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 10 our $VERSION = '1.01' ;
22 10 our $DEBUG = 0 ;
23  
24  
25 10 our %CHANNEL_TYPE = (
26 'NOT_USED' => 0,
27 'DVBT_AU' => 1,
28 'DVBT_DE' => 2,
29 'DVBT_FR' => 3,
30 'DVBT_GB' => 4,
31 ) ;
32  
33 10 our %COUNTRY_LIST = (
34 "AD" => [ "NOT_USED", "ANDORRA"],
35 "AE" => [ "NOT_USED", "UNITED ARAB EMIRATES"],
36 "AF" => [ "NOT_USED", "AFGHANISTAN"],
37 "AG" => [ "NOT_USED", "ANTIGUA AND BARBUDA"],
38 "AI" => [ "NOT_USED", "ANGUILLA"],
39 "AL" => [ "NOT_USED", "ALBANIA"],
40 "AM" => [ "NOT_USED", "ARMENIA"],
41 "AO" => [ "NOT_USED", "ANGOLA"],
42 "AQ" => [ "NOT_USED", "ANTARCTICA"],
43 "AR" => [ "NOT_USED", "ARGENTINA"],
44 "AS" => [ "NOT_USED", "AMERICAN SAMOA"],
45 "AT" => [ "DVBT_DE", "AUSTRIA"],
46 "AU" => [ "DVBT_AU", "AUSTRALIA"],
47 "AW" => [ "NOT_USED", "ARUBA"],
48 "AX" => [ "NOT_USED", "ÅLAND ISLANDS"],
49 "AZ" => [ "NOT_USED", "AZERBAIJAN"],
50 "BA" => [ "NOT_USED", "BOSNIA AND HERZEGOVINA"],
51 "BB" => [ "NOT_USED", "BARBADOS"],
52 "BD" => [ "NOT_USED", "BANGLADESH"],
53 "BE" => [ "DVBT_DE", "BELGIUM"],
54 "BF" => [ "NOT_USED", "BURKINA FASO"],
55 "BG" => [ "NOT_USED", "BULGARIA"],
56 "BH" => [ "NOT_USED", "BAHRAIN"],
57 "BI" => [ "NOT_USED", "BURUNDI"],
58 "BJ" => [ "NOT_USED", "BENIN"],
59 "BL" => [ "NOT_USED", "SAINT BARTHÉLEMY"],
60 "BM" => [ "NOT_USED", "BERMUDA"],
61 "BN" => [ "NOT_USED", "BRUNEI DARUSSALAM"],
62 "BO" => [ "NOT_USED", "BOLIVIA"],
63 "BQ" => [ "NOT_USED", "BONAIRE"],
64 "BR" => [ "NOT_USED", "BRAZIL"],
65 "BS" => [ "NOT_USED", "BAHAMAS"],
66 "BT" => [ "NOT_USED", "BHUTAN"],
67 "BV" => [ "NOT_USED", "BOUVET ISLAND"],
68 "BW" => [ "NOT_USED", "BOTSWANA"],
69 "BY" => [ "NOT_USED", "BELARUS"],
70 "BZ" => [ "NOT_USED", "BELIZE"],
71 "CA" => [ "NOT_USED", "CANADA"],
72 "CC" => [ "NOT_USED", "COCOS (KEELING) ISLANDS"],
73 "CD" => [ "NOT_USED", "CONGO, THE DEMOCRATIC REPUBLIC OF THE"],
74 "CF" => [ "NOT_USED", "CENTRAL AFRICAN REPUBLIC"],
75 "CG" => [ "NOT_USED", "CONGO"],
76 "CH" => [ "DVBT_DE", "SWITZERLAND"],
77 "CI" => [ "NOT_USED", "CÔTE D'IVOIRE"],
78 "CK" => [ "NOT_USED", "COOK ISLANDS"],
79 "CL" => [ "NOT_USED", "CHILE"],
80 "CM" => [ "NOT_USED", "CAMEROON"],
81 "CN" => [ "NOT_USED", "CHINA"],
82 "CO" => [ "NOT_USED", "COLOMBIA"],
83 "CR" => [ "NOT_USED", "COSTA RICA"],
84 "CU" => [ "NOT_USED", "CUBA"],
85 "CV" => [ "NOT_USED", "CAPE VERDE"],
86 "CW" => [ "NOT_USED", "CURAÇAO"],
87 "CX" => [ "NOT_USED", "CHRISTMAS ISLAND"],
88 "CY" => [ "NOT_USED", "CYPRUS"],
89 "CZ" => [ "DVBT_DE", "CZECH REPUBLIC"],
90 "DE" => [ "DVBT_DE", "GERMANY"],
91 "DJ" => [ "NOT_USED", "DJIBOUTI"],
92 "DK" => [ "DVBT_DE", "DENMARK"],
93 "DM" => [ "NOT_USED", "DOMINICA"],
94 "DO" => [ "NOT_USED", "DOMINICAN REPUBLIC"],
95 "DZ" => [ "NOT_USED", "ALGERIA"],
96 "EC" => [ "NOT_USED", "ECUADOR"],
97 "EE" => [ "NOT_USED", "ESTONIA"],
98 "EG" => [ "NOT_USED", "EGYPT"],
99 "EH" => [ "NOT_USED", "WESTERN SAHARA"],
100 "ER" => [ "NOT_USED", "ERITREA"],
101 "ES" => [ "DVBT_DE", "SPAIN"],
102 "ET" => [ "NOT_USED", "ETHIOPIA"],
103 "FI" => [ "DVBT_DE", "FINLAND"],
104 "FJ" => [ "NOT_USED", "FIJI"],
105 "FK" => [ "NOT_USED", "FALKLAND ISLANDS (MALVINAS)"],
106 "FM" => [ "NOT_USED", "MICRONESIA, FEDERATED STATES OF"],
107 "FO" => [ "NOT_USED", "FAROE ISLANDS"],
108 "FR" => [ "DVBT_FR", "FRANCE"],
109 "GA" => [ "NOT_USED", "GABON"],
110 "GB" => [ "DVBT_GB", "UNITED KINGDOM"],
111 "GD" => [ "NOT_USED", "GRENADA"],
112 "GE" => [ "NOT_USED", "GEORGIA"],
113 "GF" => [ "NOT_USED", "FRENCH GUIANA"],
114 "GG" => [ "NOT_USED", "GUERNSEY"],
115 "GH" => [ "NOT_USED", "GHANA"],
116 "GI" => [ "NOT_USED", "GIBRALTAR"],
117 "GL" => [ "NOT_USED", "GREENLAND"],
118 "GM" => [ "NOT_USED", "GAMBIA"],
119 "GN" => [ "NOT_USED", "GUINEA"],
120 "GP" => [ "NOT_USED", "GUADELOUPE"],
121 "GQ" => [ "NOT_USED", "EQUATORIAL GUINEA"],
122 "GR" => [ "DVBT_DE", "GREECE"],
123 "GS" => [ "NOT_USED", "SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS"],
124 "GT" => [ "NOT_USED", "GUATEMALA"],
125 "GU" => [ "NOT_USED", "GUAM"],
126 "GW" => [ "NOT_USED", "GUINEA-BISSAU"],
127 "GY" => [ "NOT_USED", "GUYANA"],
128 "HK" => [ "DVBT_DE", "HONG KONG"],
129 "HM" => [ "NOT_USED", "HEARD ISLAND AND MCDONALD ISLANDS"],
130 "HN" => [ "NOT_USED", "HONDURAS"],
131 "HR" => [ "DVBT_DE", "CROATIA"],
132 "HT" => [ "NOT_USED", "HAITI"],
133 "HU" => [ "NOT_USED", "HUNGARY"],
134 "ID" => [ "NOT_USED", "INDONESIA"],
135 "IE" => [ "NOT_USED", "IRELAND"],
136 "IL" => [ "NOT_USED", "ISRAEL"],
137 "IM" => [ "NOT_USED", "ISLE OF MAN"],
138 "IN" => [ "NOT_USED", "INDIA"],
139 "IO" => [ "NOT_USED", "BRITISH INDIAN OCEAN TERRITORY"],
140 "IQ" => [ "NOT_USED", "IRAQ"],
141 "IR" => [ "NOT_USED", "IRAN, ISLAMIC REPUBLIC OF"],
142 "IS" => [ "DVBT_DE", "ICELAND"],
143 "IT" => [ "DVBT_DE", "ITALY"],
144 "JE" => [ "NOT_USED", "JERSEY"],
145 "JM" => [ "NOT_USED", "JAMAICA"],
146 "JO" => [ "NOT_USED", "JORDAN"],
147 "JP" => [ "NOT_USED", "JAPAN"],
148 "KE" => [ "NOT_USED", "KENYA"],
149 "KG" => [ "NOT_USED", "KYRGYZSTAN"],
150 "KH" => [ "NOT_USED", "CAMBODIA"],
151 "KI" => [ "NOT_USED", "KIRIBATI"],
152 "KM" => [ "NOT_USED", "COMOROS"],
153 "KN" => [ "NOT_USED", "SAINT KITTS AND NEVIS"],
154 "KP" => [ "NOT_USED", "KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF"],
155 "KR" => [ "NOT_USED", "KOREA, REPUBLIC OF"],
156 "KW" => [ "NOT_USED", "KUWAIT"],
157 "KY" => [ "NOT_USED", "CAYMAN ISLANDS"],
158 "KZ" => [ "NOT_USED", "KAZAKHSTAN"],
159 "LA" => [ "NOT_USED", "LAO PEOPLE'S DEMOCRATIC REPUBLIC"],
160 "LB" => [ "NOT_USED", "LEBANON"],
161 "LC" => [ "NOT_USED", "SAINT LUCIA"],
162 "LI" => [ "NOT_USED", "LIECHTENSTEIN"],
163 "LK" => [ "NOT_USED", "SRI LANKA"],
164 "LR" => [ "NOT_USED", "LIBERIA"],
165 "LS" => [ "NOT_USED", "LESOTHO"],
166 "LT" => [ "NOT_USED", "LITHUANIA"],
167 "LU" => [ "DVBT_DE", "LUXEMBOURG"],
168 "LV" => [ "DVBT_DE", "LATVIA"],
169 "LY" => [ "NOT_USED", "LIBYAN ARAB JAMAHIRIYA"],
170 "MA" => [ "NOT_USED", "MOROCCO"],
171 "MC" => [ "NOT_USED", "MONACO"],
172 "MD" => [ "NOT_USED", "MOLDOVA"],
173 "ME" => [ "NOT_USED", "MONTENEGRO"],
174 "MF" => [ "NOT_USED", "SAINT MARTIN"],
175 "MG" => [ "NOT_USED", "MADAGASCAR"],
176 "MH" => [ "NOT_USED", "MARSHALL ISLANDS"],
177 "MK" => [ "NOT_USED", "MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF"],
178 "ML" => [ "NOT_USED", "MALI"],
179 "MM" => [ "NOT_USED", "MYANMAR"],
180 "MN" => [ "NOT_USED", "MONGOLIA"],
181 "MO" => [ "NOT_USED", "MACAO"],
182 "MP" => [ "NOT_USED", "NORTHERN MARIANA ISLANDS"],
183 "MQ" => [ "NOT_USED", "MARTINIQUE"],
184 "MR" => [ "NOT_USED", "MAURITANIA"],
185 "MS" => [ "NOT_USED", "MONTSERRAT"],
186 "MT" => [ "NOT_USED", "MALTA"],
187 "MU" => [ "NOT_USED", "MAURITIUS"],
188 "MV" => [ "NOT_USED", "MALDIVES"],
189 "MW" => [ "NOT_USED", "MALAWI"],
190 "MX" => [ "NOT_USED", "MEXICO"],
191 "MY" => [ "NOT_USED", "MALAYSIA"],
192 "MZ" => [ "NOT_USED", "MOZAMBIQUE"],
193 "NA" => [ "NOT_USED", "NAMIBIA"],
194 "NC" => [ "NOT_USED", "NEW CALEDONIA"],
195 "NE" => [ "NOT_USED", "NIGER"],
196 "NF" => [ "NOT_USED", "NORFOLK ISLAND"],
197 "NG" => [ "NOT_USED", "NIGERIA"],
198 "NI" => [ "NOT_USED", "NICARAGUA"],
199 "NL" => [ "DVBT_DE", "NETHERLANDS"],
200 "NO" => [ "DVBT_DE", "NORWAY"],
201 "NP" => [ "NOT_USED", "NEPAL"],
202 "NR" => [ "NOT_USED", "NAURU"],
203 "NU" => [ "NOT_USED", "NIUE"],
204 "NZ" => [ "DVBT_DE", "NEW ZEALAND"],
205 "OM" => [ "NOT_USED", "OMAN"],
206 "PA" => [ "NOT_USED", "PANAMA"],
207 "PE" => [ "NOT_USED", "PERU"],
208 "PF" => [ "NOT_USED", "FRENCH POLYNESIA"],
209 "PG" => [ "NOT_USED", "PAPUA NEW GUINEA"],
210 "PH" => [ "NOT_USED", "PHILIPPINES"],
211 "PK" => [ "NOT_USED", "PAKISTAN"],
212 "PL" => [ "DVBT_DE", "POLAND"],
213 "PM" => [ "NOT_USED", "SAINT PIERRE AND MIQUELON"],
214 "PN" => [ "NOT_USED", "PITCAIRN"],
215 "PR" => [ "NOT_USED", "PUERTO RICO"],
216 "PS" => [ "NOT_USED", "PALESTINIAN TERRITORY, OCCUPIED"],
217 "PT" => [ "NOT_USED", "PORTUGAL"],
218 "PW" => [ "NOT_USED", "PALAU"],
219 "PY" => [ "NOT_USED", "PARAGUAY"],
220 "QA" => [ "NOT_USED", "QATA"],
221 "RE" => [ "NOT_USED", "RÉUNION"],
222 "RO" => [ "NOT_USED", "ROMANIA"],
223 "RS" => [ "NOT_USED", "SERBIA"],
224 "RU" => [ "NOT_USED", "RUSSIAN FEDERATION"],
225 "RW" => [ "NOT_USED", "RWANDA"],
226 "SA" => [ "NOT_USED", "SAUDI ARABIA"],
227 "SB" => [ "NOT_USED", "SOLOMON ISLANDS"],
228 "SC" => [ "NOT_USED", "SEYCHELLES"],
229 "SD" => [ "NOT_USED", "SUDAN"],
230 "SE" => [ "DVBT_DE", "SWEDEN"],
231 "SG" => [ "NOT_USED", "SINGAPORE"],
232 "SH" => [ "NOT_USED", "SAINT HELENA"],
233 "SI" => [ "NOT_USED", "SLOVENIA"],
234 "SJ" => [ "NOT_USED", "SVALBARD AND JAN MAYEN"],
235 "SK" => [ "DVBT_DE", "SLOVAKIA"],
236 "SL" => [ "NOT_USED", "SIERRA LEONE"],
237 "SM" => [ "NOT_USED", "SAN MARINO"],
238 "SN" => [ "NOT_USED", "SENEGAL"],
239 "SO" => [ "NOT_USED", "SOMALIA"],
240 "SR" => [ "NOT_USED", "SURINAME"],
241 "ST" => [ "NOT_USED", "SAO TOME AND PRINCIPE"],
242 "SV" => [ "NOT_USED", "EL SALVADOR"],
243 "SX" => [ "NOT_USED", "SINT MAARTEN"],
244 "SY" => [ "NOT_USED", "SYRIAN ARAB REPUBLIC"],
245 "SZ" => [ "NOT_USED", "SWAZILAND"],
246 "TC" => [ "NOT_USED", "TURKS AND CAICOS ISLANDS"],
247 "TD" => [ "NOT_USED", "CHAD"],
248 "TF" => [ "NOT_USED", "FRENCH SOUTHERN TERRITORIES"],
249 "TG" => [ "NOT_USED", "TOGO"],
250 "TH" => [ "NOT_USED", "THAILAND"],
251 "TJ" => [ "NOT_USED", "TAJIKISTAN"],
252 "TK" => [ "NOT_USED", "TOKELAU"],
253 "TL" => [ "NOT_USED", "TIMOR-LESTE"],
254 "TM" => [ "NOT_USED", "TURKMENISTAN"],
255 "TN" => [ "NOT_USED", "TUNISIA"],
256 "TO" => [ "NOT_USED", "TONGA"],
257 "TR" => [ "NOT_USED", "TURKEY"],
258 "TT" => [ "NOT_USED", "TRINIDAD AND TOBAGO"],
259 "TV" => [ "NOT_USED", "TUVALU"],
260 "TW" => [ "NOT_USED", "TAIWAN"],
261 "TZ" => [ "NOT_USED", "TANZANIA, UNITED REPUBLIC OF"],
262 "UA" => [ "NOT_USED", "UKRAINE"],
263 "UG" => [ "NOT_USED", "UGANDA"],
264 "UM" => [ "NOT_USED", "UNITED STATES MINOR OUTLYING ISLANDS"],
265 "US" => [ "NOT_USED", "UNITED STATES"],
266 "UY" => [ "NOT_USED", "URUGUAY"],
267 "UZ" => [ "NOT_USED", "UZBEKISTAN"],
268 "VA" => [ "NOT_USED", "HOLY SEE (VATICAN CITY STATE)"],
269 "VC" => [ "NOT_USED", "SAINT VINCENT AND THE GRENADINES"],
270 "VE" => [ "NOT_USED", "VENEZUELA"],
271 "VG" => [ "NOT_USED", "VIRGIN ISLANDS, BRITISH"],
272 "VI" => [ "NOT_USED", "VIRGIN ISLANDS, U.S."],
273 "VN" => [ "NOT_USED", "VIET NAM"],
274 "VU" => [ "NOT_USED", "VANUATU"],
275 "WF" => [ "NOT_USED", "WALLIS AND FUTUNA"],
276 "WS" => [ "NOT_USED", "SAMOA"],
277 "YE" => [ "NOT_USED", "YEMEN"],
278 "YT" => [ "NOT_USED", "MAYOTTE"],
279 "ZA" => [ "NOT_USED", "SOUTH AFRICA"],
280 "ZM" => [ "NOT_USED", "ZAMBIA"],
281 "ZW" => [ "NOT_USED", "ZIMBABWE"],
282 ) ;
283  
284  
285 10 our %BASE_FREQ = (
286 'NOT_USED' => [],
287 'DVBT_AU' => [
288 {'min'=>5, 'max'=>12, 'freq'=> 142500000},
289 {'min'=>21, 'max'=>69, 'freq'=> 333500000},
290 ],
291 'DVBT_DE' => [
292 {'min'=>5, 'max'=>12, 'freq'=> 142500000},
293 {'min'=>21, 'max'=>69, 'freq'=> 306000000},
294 ],
295 'DVBT_FR' => [
296 {'min'=>5, 'max'=>12, 'freq'=> 142500000},
297 {'min'=>21, 'max'=>69, 'freq'=> 306000000},
298 ],
299 'DVBT_GB' => [
300 {'min'=>5, 'max'=>12, 'freq'=> 142500000},
301 {'min'=>21, 'max'=>69, 'freq'=> 306000000},
302 ],
303 ) ;
304  
305 10 our %FREQ_STEP = (
306 'NOT_USED' => [],
307 'DVBT_AU' => [
308 {'min'=>5, 'max'=>69, 'freq'=> 7000000, 'bw'=>7},
309 ],
310 'DVBT_DE' => [
311 {'min'=>5, 'max'=>12, 'freq'=> 7000000, 'bw'=>7},
312 {'min'=>21, 'max'=>69, 'freq'=> 8000000, 'bw'=>8},
313 ],
314 'DVBT_FR' => [
315 {'min'=>5, 'max'=>12, 'freq'=> 7000000, 'bw'=>7},
316 {'min'=>21, 'max'=>69, 'freq'=> 8000000, 'bw'=>8},
317 ],
318 'DVBT_GB' => [
319 {'min'=>5, 'max'=>12, 'freq'=> 7000000, 'bw'=>7},
320 {'min'=>21, 'max'=>69, 'freq'=> 8000000, 'bw'=>8},
321 ],
322 ) ;
323  
324  
325 10 our %FREQ_OFFSET = (
326 'NOT_USED' => [],
327 'DVBT_AU' => [
328 {'min'=>5, 'max'=>69, 'offset_min'=> 0, 'offset_max'=>125000},
329 ],
330 'DVBT_DE' => [
331 {'min'=>5, 'max'=>69, 'offset_min'=> 0, 'offset_max'=>0},
332 ],
333 'DVBT_FR' => [
334 {'min'=>5, 'max'=>12, 'offset_min'=> 0, 'offset_max'=>0},
335 {'min'=>21, 'max'=>69, 'offset_min'=> -167000, 'offset_max'=>167000},
336 ],
337 'DVBT_GB' => [
338 {'min'=>5, 'max'=>12, 'offset_min'=> 0, 'offset_max'=>0},
339 {'min'=>21, 'max'=>69, 'offset_min'=> -167000, 'offset_max'=>167000},
340 ],
341 ) ;
342  
343  
344  
345 #============================================================================================
346  
347 =head2 Functions
348  
349 =over 4
350  
351 =cut
352  
353  
354 #-----------------------------------------------------------------------------
355  
356 =item B<country_supported($iso3166)>
357  
358 Returns TRUE if the specified ISO 3166-1 country code is for a country that has DVB-T
359  
360 =cut
361  
362 sub country_supported
363 {
364 2 ▶ my ($iso3166) = @_ ;
Subroutine country_supported: called CC=5 SCAR=17.0
Pod documented
365 2 my $supported = 0 ;
366  
367 2 ▶ $iso3166 ||= "" ;
Condition50%1/2
$iso3166 ||= ""
l!l
20
MC/DC0%0/1
$iso3166 ||= ""
$iso3166
Truth table50%1/2
A
A= $iso3166
Aresult
11
00
368 2 $iso3166 = uc $iso3166 ;
369 2 ▶ if ($iso3166 && exists($COUNTRY_LIST{$iso3166}))
Branch: 1 branch
BranchTrueFalseTotal
if ($iso3166 and exists $Linux::DVB::DVBT::Freq::COUNTRY_LIST{$iso3166}) 2 0 2
Condition33%1/3
$iso3166 and exists $Linux::DVB::DVBT::Freq::COUNTRY_LIST{$iso3166}
!ll&&!rl&&r
002
MC/DC0%0/2
$iso3166 and exists $Linux::DVB::DVBT::Freq::COUNTRY_LIST{$iso3166}
$iso3166 exists $Linux::DVB::DVBT::Freq::COUNTRY_LIST{$iso3166}
Truth table33%1/3
A and B
A= $iso3166B= exists $Linux::DVB::DVBT::Freq::COUNTRY_LIST{$iso3166}
ABresult
0X0
100
111
370 {
371 2 my ($chan_type, $country) = @{$COUNTRY_LIST{$iso3166}} ;
372 2 ▶ if ($chan_type ne 'NOT_USED')
Branch: 1 branch
BranchTrueFalseTotal
if ($chan_type ne "NOT_USED") 2 0 2
373 {
374 2 $supported = 1 ;
375 }
376 }
377 2 return $supported ;
378 }
379  
380 #-----------------------------------------------------------------------------
381  
382 =item B<country_list()>
383  
384 Returns the array of countries which have DVB-T information. Each array entry consists of
385 an array containing 2 elements:
386  
387 [0] => iso3166-1 country code (e.g. 'GB')
388 [1] => country name (e.g. "UNITED KINGDOM")
389  
390 =cut
391  
392 sub country_list
393 {
394 0 ▶ my @list ;
Subroutine country_list: not called CC=3 SCAR=24.8
Pod documented
395 0 foreach my $code (sort keys %COUNTRY_LIST)
396 {
397 0 my ($chan_type, $country) = @{$COUNTRY_LIST{$code}} ;
398 0 ▶ if ($chan_type ne 'NOT_USED')
Branch: 1 branch
BranchTrueFalseTotal
if ($chan_type ne "NOT_USED") 0 0 0
399 {
400 0 push @list, [$code, $country] ;
401 }
402 }
403 0 return @list ;
404 }
405  
406  
407 #-----------------------------------------------------------------------------
408  
409 =item B<freq_list($iso3166)>
410  
411 Create a list of frequencies for the specified country code.
412  
413 Returns an array of frequencies (or an empty list).
414  
415 =cut
416  
417 sub freq_list
418 {
419 1 ▶ my ($iso3166) = @_ ;
Subroutine freq_list: called CC=2 SCAR=6.9
Pod documented
420
421 1 my @freqs ;
422 1 my @freq_list = chan_freq_list($iso3166) ;
423
424 1 foreach my $href (@freq_list)
425 {
426 106 push @freqs, $href->{'freq'} ;
427 }
428
429 1 return @freqs ;
430 }
431  
432 #-----------------------------------------------------------------------------
433  
434 =item B<chan_freq_list($iso3166)>
435  
436 Create a list of channel numbers and frequencies for the specified country code.
437  
438 Returns an array of HASHes, each hash containing:
439  
440 'chan' => channel number
441 'freq' => frequency in Hz
442  
443 =cut
444  
445 sub chan_freq_list
446 {
447 2 ▶ my ($iso3166) = @_ ;
Subroutine chan_freq_list: called CC=7 SCAR=19.5
Pod documented
448 2 my @freqs ;
449
450 2 ▶ if (country_supported($iso3166))
Branch: 1 branch
BranchTrueFalseTotal
if (country_supported($iso3166)) 2 0 2
451 {
452 2 $iso3166 = uc $iso3166 ;
453 2 my ($chan_type, $country) = @{$COUNTRY_LIST{$iso3166}} ;
454
455 2 my $base_freq_list = $BASE_FREQ{$chan_type} ;
456 2 my $freq_step_list = $FREQ_STEP{$chan_type} ;
457 2 my $freq_offset_list = $FREQ_OFFSET{$chan_type} ;
458
459 2 foreach my $freq_href (@$base_freq_list)
460 {
461 4 my $base_freq = $freq_href->{'freq'} ;
462 4 ▶ for (my $chan = $freq_href->{'min'}; $chan <= $freq_href->{'max'}; ++$chan)
Branch: 1 branch
BranchTrueFalseTotal
if ($chan <= $freq_href->{"max"}) 114 4 118
463 {
464 114 my ($freq_step, $bw) = _lookup_freq_step($chan, $freq_step_list) ;
465 114 my ($offset_min, $offset_max) = _lookup_freq_offset($chan, $freq_offset_list) ;
466
467 114 my @offsets = (0) ;
468 114 ▶ unshift(@offsets, $offset_min) if ($offset_min < 0) ;
Branch: 1 branch
BranchTrueFalseTotal
if $offset_min < 0 98 16 114
469 114 ▶ push(@offsets, $offset_max) if ($offset_max < 0) ;
Branch: 1 branch
BranchTrueFalseTotal
if $offset_max < 0 0 114 114
470
471 114 foreach my $offset (@offsets)
472 {
473 212 my $frequency = $base_freq + ($chan * $freq_step) + $offset ;
474 212 push @freqs, {
475 'chan' => $chan,
476 'freq' => $frequency,
477 'bw' => $bw,
478 } ;
479 }
480 }
481 }
482 }
483
484 2 return @freqs ;
485 }
486  
487 #-----------------------------------------------------------------------------
488 sub _lookup_freq_step
489 {
490 114 ▶ my ($chan, $freq_step_list) = @_ ;
Subroutine _lookup_freq_step: called CC=5 SCAR=16.2
491 114 my $freq_step = 8000000 ;
492 114 my $bw = 8 ;
493
494 114 foreach my $freq_href (@$freq_step_list)
495 {
496 212 ▶ if ( ($chan >= $freq_href->{'min'}) && ($chan <= $freq_href->{'max'}) )
Branch: 1 branch
BranchTrueFalseTotal
if ($chan >= $freq_href->{"min"} and $chan <= $freq_href->{"max"}) 114 98 212
Condition66%2/3
$chan >= $freq_href->{"min"} and $chan <= $freq_href->{"max"}
!ll&&!rl&&r
098114
MC/DC50%1/2
$chan >= $freq_href->{"min"} and $chan <= $freq_href->{"max"}
$chan >= $freq_href->{"min"} $chan <= $freq_href->{"max"}
Truth table66%2/3
A and B
A= $chan >= $freq_href->{"min"}B= $chan <= $freq_href->{"max"}
ABresult
0X0
100
111
497 {
498 114 $freq_step = $freq_href->{'freq'} ;
499 114 $bw = $freq_href->{'bw'} ;
500 114 last ;
501 }
502 }
503 114 ▶ return wantarray ? ($freq_step, $bw) : $freq_step ;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 114 0 114
504 }
505  
506 #-----------------------------------------------------------------------------
507 sub _lookup_freq_offset
508 {
509 114 ▶ my ($chan, $freq_offset_list) = @_ ;
Subroutine _lookup_freq_offset: called CC=4 SCAR=13.9
510 114 my $min = 0 ;
511 114 my $max = 0 ;
512
513 114 foreach my $freq_href (@$freq_offset_list)
514 {
515 212 ▶ if ( ($chan >= $freq_href->{'min'}) && ($chan <= $freq_href->{'max'}) )
Branch: 1 branch
BranchTrueFalseTotal
if ($chan >= $freq_href->{"min"} and $chan <= $freq_href->{"max"}) 114 98 212
Condition66%2/3
$chan >= $freq_href->{"min"} and $chan <= $freq_href->{"max"}
!ll&&!rl&&r
098114
MC/DC50%1/2
$chan >= $freq_href->{"min"} and $chan <= $freq_href->{"max"}
$chan >= $freq_href->{"min"} $chan <= $freq_href->{"max"}
Truth table66%2/3
A and B
A= $chan >= $freq_href->{"min"}B= $chan <= $freq_href->{"max"}
ABresult
0X0
100
111
516 {
517 114 $min = $freq_href->{'offset_min'} ;
518 114 $max = $freq_href->{'offset_max'} ;
519 114 last ;
520 }
521 }
522 114 return ($min, $max) ;
523 }
524  
525  
526 # ============================================================================================
527 # END OF PACKAGE
528  
529 =back
530  
531 =cut
532  
533 10 1;
534  
« blib/lib/Linux/DVB/DVBT/Utils.pm ↑ Summary xs/DVBT-epg.c »