… | |
… | |
30 | package Linux::DVB; |
30 | package Linux::DVB; |
31 | |
31 | |
32 | use Fcntl (); |
32 | use Fcntl (); |
33 | |
33 | |
34 | BEGIN { |
34 | BEGIN { |
35 | $VERSION = '0.3'; |
35 | $VERSION = '0.4'; |
36 | @ISA = qw(Exporter); |
36 | @ISA = qw(Exporter); |
37 | |
37 | |
38 | require XSLoader; |
38 | require XSLoader; |
39 | XSLoader::load __PACKAGE__, $VERSION; |
39 | XSLoader::load __PACKAGE__, $VERSION; |
40 | |
40 | |
… | |
… | |
134 | fec_inner => |
134 | fec_inner => |
135 | |
135 | |
136 | QAM frontends: |
136 | QAM frontends: |
137 | |
137 | |
138 | symbol_rate => |
138 | symbol_rate => |
139 | fec_inner => |
|
|
140 | modulation => |
139 | modulation => |
141 | |
140 | |
142 | QFDM frontends: |
141 | QFDM frontends: |
143 | |
142 | |
144 | bandwidth => |
143 | bandwidth => |
… | |
… | |
165 | |
164 | |
166 | { |
165 | { |
167 | frequency => 426000000, # 426 Mhz |
166 | frequency => 426000000, # 426 Mhz |
168 | inversion => 0, # INVERSION_OFF |
167 | inversion => 0, # INVERSION_OFF |
169 | symbol_rate => 6900000, # 6.9 MB/s |
168 | symbol_rate => 6900000, # 6.9 MB/s |
170 | fec_inner => 0, # FEC_NONE |
|
|
171 | modulation => 3, # QAM_64 |
169 | modulation => 3, # QAM_64 |
172 | } |
170 | } |
173 | |
171 | |
174 | =cut |
172 | =cut |
175 | |
173 | |
… | |
… | |
346 | |
344 | |
347 | =cut |
345 | =cut |
348 | |
346 | |
349 | our %nibble_to_genre = ( |
347 | our %nibble_to_genre = ( |
350 | 0x1 => { |
348 | 0x1 => { |
351 | 0x0 => 'Movie / Drama', |
349 | 0x0 => 'Movie/Drama (general)', |
352 | 0x1 => 'Movie - detective/thriller', |
350 | 0x1 => 'Movie - detective/thriller', |
353 | 0x2 => 'Movie - adventure/western/war', |
351 | 0x2 => 'Movie - adventure/western/war', |
354 | 0x3 => 'Movie - science fiction/fantasy/horror', |
352 | 0x3 => 'Movie - science fiction/fantasy/horror', |
355 | 0x4 => 'Movie - comedy', |
353 | 0x4 => 'Movie - comedy', |
356 | 0x5 => 'Movie - soap/melodrama/folkloric', |
354 | 0x5 => 'Movie - soap/melodrama/folkloric', |
357 | 0x6 => 'Movie - romance', |
355 | 0x6 => 'Movie - romance', |
358 | 0x7 => 'Movie - serious/classical/religious/historical movie/drama', |
356 | 0x7 => 'Movie - serious/classical/religious/historical movie/drama', |
359 | 0x8 => 'Movie - adult movie/drama', |
357 | 0x8 => 'Movie - adult movie/drama', |
360 | }, |
358 | }, |
361 | 0x2 => { |
359 | 0x2 => { |
362 | 0x0 => 'News / Current Affairs', |
360 | 0x0 => 'News/Current Affairs (general)', |
363 | 0x1 => 'news/weather report', |
361 | 0x1 => 'news/weather report', |
364 | 0x2 => 'news magazine', |
362 | 0x2 => 'news magazine', |
365 | 0x3 => 'documentary', |
363 | 0x3 => 'documentary', |
366 | 0x4 => 'discussion/interview/debate', |
364 | 0x4 => 'discussion/interview/debate', |
367 | }, |
365 | }, |
368 | 0x3 => { |
366 | 0x3 => { |
369 | 0x0 => 'Show / Game Show', |
367 | 0x0 => 'Show/Game Show (general)', |
370 | 0x1 => 'game show/quiz/contest', |
368 | 0x1 => 'game show/quiz/contest', |
371 | 0x2 => 'variety show', |
369 | 0x2 => 'variety show', |
372 | 0x3 => 'talk show', |
370 | 0x3 => 'talk show', |
373 | }, |
371 | }, |
374 | 0x4 => { |
372 | 0x4 => { |
375 | 0x0 => 'Sports', |
373 | 0x0 => 'Sports (general)', |
376 | 0x1 => 'special events (Olympic Games, World Cup etc.)', |
374 | 0x1 => 'special events (Olympic Games, World Cup etc.)', |
377 | 0x2 => 'sports magazines', |
375 | 0x2 => 'sports magazines', |
378 | 0x3 => 'football/soccer', |
376 | 0x3 => 'football/soccer', |
379 | 0x4 => 'tennis/squash', |
377 | 0x4 => 'tennis/squash', |
380 | 0x5 => 'team sports (excluding football)', |
378 | 0x5 => 'team sports (excluding football)', |
… | |
… | |
384 | 0x9 => 'winter sports', |
382 | 0x9 => 'winter sports', |
385 | 0xA => 'equestrian', |
383 | 0xA => 'equestrian', |
386 | 0xB => 'martial sports', |
384 | 0xB => 'martial sports', |
387 | }, |
385 | }, |
388 | 0x5 => { |
386 | 0x5 => { |
389 | 0x0 => 'Childrens / Youth', |
387 | 0x0 => 'Childrens/Youth (general)', |
390 | 0x1 => "pre-school children's programmes", |
388 | 0x1 => "pre-school children's programmes", |
391 | 0x2 => 'entertainment programmes for 6 to 14', |
389 | 0x2 => 'entertainment programmes for 6 to 14', |
392 | 0x3 => 'entertainment programmes for 10 to 16', |
390 | 0x3 => 'entertainment programmes for 10 to 16', |
393 | 0x4 => 'informational/educational/school programmes', |
391 | 0x4 => 'informational/educational/school programmes', |
394 | 0x5 => 'cartoons/puppets', |
392 | 0x5 => 'cartoons/puppets', |
395 | }, |
393 | }, |
396 | 0x6 => { |
394 | 0x6 => { |
397 | 0x0 => 'Music / Ballet / Dance', |
395 | 0x0 => 'Music/Ballet/Dance (general)', |
398 | 0x1 => 'rock/pop', |
396 | 0x1 => 'rock/pop', |
399 | 0x2 => 'serious music/classical music', |
397 | 0x2 => 'serious music or classical music', |
400 | 0x3 => 'folk/traditional music', |
398 | 0x3 => 'folk/traditional music', |
401 | 0x4 => 'jazz', |
399 | 0x4 => 'jazz', |
402 | 0x5 => 'musical/opera', |
400 | 0x5 => 'musical/opera', |
403 | 0x6 => 'ballet', |
401 | 0x6 => 'ballet', |
404 | }, |
402 | }, |
405 | 0x7 => { |
403 | 0x7 => { |
406 | 0x0 => 'Arts / Culture', |
404 | 0x0 => 'Arts/Culture (without music, general)', |
407 | 0x1 => 'performing arts', |
405 | 0x1 => 'performing arts', |
408 | 0x2 => 'fine arts', |
406 | 0x2 => 'fine arts', |
409 | 0x3 => 'religion', |
407 | 0x3 => 'religion', |
410 | 0x4 => 'popular culture/traditional arts', |
408 | 0x4 => 'popular culture/traditional arts', |
411 | 0x5 => 'literature', |
409 | 0x5 => 'literature', |
… | |
… | |
415 | 0x9 => 'new media', |
413 | 0x9 => 'new media', |
416 | 0xA => 'arts/culture magazines', |
414 | 0xA => 'arts/culture magazines', |
417 | 0xB => 'fashion', |
415 | 0xB => 'fashion', |
418 | }, |
416 | }, |
419 | 0x8 => { |
417 | 0x8 => { |
420 | 0x0 => 'Social / Policical / Economics', |
418 | 0x0 => 'Social/Policical/Economics (general)', |
421 | 0x1 => 'magazines/reports/documentary', |
419 | 0x1 => 'magazines/reports/documentary', |
422 | 0x2 => 'economics/social advisory', |
420 | 0x2 => 'economics/social advisory', |
423 | 0x3 => 'remarkable people', |
421 | 0x3 => 'remarkable people', |
424 | }, |
422 | }, |
425 | 0x9 => { |
423 | 0x9 => { |
426 | 0x0 => 'Education / Science / Factual', |
424 | 0x0 => 'Education/Science/Factual (general)', |
427 | 0x1 => 'nature/animals/environment', |
425 | 0x1 => 'nature/animals/environment', |
428 | 0x2 => 'technology/natural sciences', |
426 | 0x2 => 'technology/natural sciences', |
429 | 0x3 => 'medicine/physiology/psychology', |
427 | 0x3 => 'medicine/physiology/psychology', |
430 | 0x4 => 'foreign countries/expeditions', |
428 | 0x4 => 'foreign countries/expeditions', |
431 | 0x5 => 'social/spiritual sciences', |
429 | 0x5 => 'social/spiritual sciences', |
432 | 0x6 => 'further education', |
430 | 0x6 => 'further education', |
433 | 0x7 => 'languages', |
431 | 0x7 => 'languages', |
434 | }, |
432 | }, |
435 | 0xA => { |
433 | 0xA => { |
436 | 0x0 => 'Leisure / Hobbies', |
434 | 0x0 => 'Leisure/Hobbies (general)', |
437 | 0x1 => 'tourism/travel', |
435 | 0x1 => 'tourism/travel', |
438 | 0x2 => 'handicraft', |
436 | 0x2 => 'handicraft', |
439 | 0x3 => 'motoring', |
437 | 0x3 => 'motoring', |
440 | 0x4 => 'fitness & health', |
438 | 0x4 => 'fitness & health', |
441 | 0x5 => 'cooking', |
439 | 0x5 => 'cooking', |
442 | 0x6 => 'advertizement/shopping', |
440 | 0x6 => 'advertizement/shopping', |
443 | 0x7 => 'gardening', |
441 | 0x7 => 'gardening', |
444 | }, |
442 | }, |
445 | 0xB => { |
443 | 0xB => { |
446 | 0x0 => 'Original Language', |
444 | 0x0 => '(original language)', |
447 | 0x1 => 'black & white', |
445 | 0x1 => '(black & white)', |
448 | 0x2 => 'unpublished', |
446 | 0x2 => '(unpublished)', |
449 | 0x3 => 'live broadcast', |
447 | 0x3 => '(live broadcast)', |
450 | }, |
448 | }, |
451 | ); |
449 | ); |
452 | |
450 | |
453 | =item ($sec,$min,$hour) = Linux::DVB::Decode::time $hms |
451 | =item ($sec,$min,$hour) = Linux::DVB::Decode::time $hms |
454 | |
452 | |
… | |
… | |
463 | Break down a "DVB time" (modified julian date + bcd encoded seconds) into |
461 | Break down a "DVB time" (modified julian date + bcd encoded seconds) into |
464 | it's components (non-C<_linear>) or into a seconds count (C<_linear> |
462 | it's components (non-C<_linear>) or into a seconds count (C<_linear> |
465 | variants) since the epoch (C<datetime_linear>) or the start of the day |
463 | variants) since the epoch (C<datetime_linear>) or the start of the day |
466 | (C<time_linear>). |
464 | (C<time_linear>). |
467 | |
465 | |
|
|
466 | The format of the returns value of the date and datetime functions is |
|
|
467 | I<not> compatible with C<Time::Local>. Use the C<_linear> functions |
|
|
468 | instead. |
|
|
469 | |
468 | Example: |
470 | Example: |
469 | |
471 | |
470 | my $time = Linux::DVB::Decode::datetime_linear $mjd, $hms |
472 | my $time = Linux::DVB::Decode::datetime_linear $mjd, $hms |
471 | printf "Starts at %s\n", |
473 | printf "Starts at %s\n", |
472 | POSIX::strftime "%Y-%m-%d %H:%M:%S", |
474 | POSIX::strftime "%Y-%m-%d %H:%M:%S", |
… | |
… | |
488 | sub date($) { |
490 | sub date($) { |
489 | my ($mjd) = @_; |
491 | my ($mjd) = @_; |
490 | |
492 | |
491 | # Date is given in Modified Julian Date |
493 | # Date is given in Modified Julian Date |
492 | # Decoding routines taken from ANNEX C, ETSI EN 300 468 (DVB SI) |
494 | # Decoding routines taken from ANNEX C, ETSI EN 300 468 (DVB SI) |
493 | my $y_ = int ($mjd - 15078.2) / 365.25; |
495 | my $y_ = int (($mjd - 15078.2) / 365.25); |
494 | my $m_ = int (($mjd - 14956.1 - int ($y_ * 365.25)) / 30.6001); |
496 | my $m_ = int (($mjd - 14956.1 - int ($y_ * 365.25)) / 30.6001); |
495 | my $day = $mjd - 14956 - int ($y_ * 365.25) - int ($m_ * 30.6001); |
497 | my $day = $mjd - 14956 - int ($y_ * 365.25) - int ($m_ * 30.6001); |
496 | my $k = $m_ == 14 or $m_ == 15 ? 1 : 0; |
498 | my $k = $m_ == 14 or $m_ == 15 ? 1 : 0; |
497 | my $year = $y_ + $k + 1900; |
499 | my $year = $y_ + $k + 1900; |
498 | my $month = $m_ - 1 - $k * 12; |
500 | my $month = $m_ - 1 - $k * 12; |
… | |
… | |
509 | |
511 | |
510 | (($h * 60) + $m * 60) + $s |
512 | (($h * 60) + $m * 60) + $s |
511 | } |
513 | } |
512 | |
514 | |
513 | sub datetime_linear($$) { |
515 | sub datetime_linear($$) { |
|
|
516 | my ($sec, $min, $hour, $mday, $mon, $year) = |
|
|
517 | Linux::DVB::Decode::datetime $_[0], $_[1]; |
|
|
518 | |
514 | require Time::Local; |
519 | require Time::Local; |
515 | Time::Local::timegm (Linux::DVB::Decode::datetime $_[0], $_[1]) |
520 | Time::Local::timegm ($sec, $min, $hour, $mday, $mon - 1, $year) |
516 | } |
521 | } |
517 | |
522 | |
518 | =back |
523 | =back |
519 | |
524 | |
520 | =head1 AUTHORS |
525 | =head1 AUTHORS |