… | |
… | |
19 | |
19 | |
20 | Noteworthy differences to the C API: unions and sub-structs are usually |
20 | Noteworthy differences to the C API: unions and sub-structs are usually |
21 | translated into flat perl hashes, i.e C<struct.u.qam.symbol_rate> |
21 | translated into flat perl hashes, i.e C<struct.u.qam.symbol_rate> |
22 | becomes C<< $struct->{symbol_rate} >>. |
22 | becomes C<< $struct->{symbol_rate} >>. |
23 | |
23 | |
24 | Noteworthy limitations of this module include: no way to set the |
24 | Noteworthy limitations of this module include: No interface to the video, |
25 | frequency or diseqc. No interface to the video, audio and net devices. |
|
|
26 | If you need this functionality bug the author. |
25 | audio and net devices. If you need this functionality bug the author. |
27 | |
26 | |
28 | =cut |
27 | =cut |
29 | |
28 | |
30 | package Linux::DVB; |
29 | package Linux::DVB; |
31 | |
30 | |
32 | use Fcntl (); |
31 | use Fcntl (); |
33 | |
32 | |
34 | BEGIN { |
33 | BEGIN { |
35 | $VERSION = '0.4'; |
34 | $VERSION = '1.01'; |
36 | @ISA = qw(Exporter); |
35 | @ISA = qw(Exporter); |
37 | |
36 | |
38 | require XSLoader; |
37 | require XSLoader; |
39 | XSLoader::load __PACKAGE__, $VERSION; |
38 | XSLoader::load __PACKAGE__, $VERSION; |
40 | |
39 | |
… | |
… | |
106 | %$self = ( %$self, %{ $self->frontend_info } ); |
105 | %$self = ( %$self, %{ $self->frontend_info } ); |
107 | |
106 | |
108 | $self; |
107 | $self; |
109 | } |
108 | } |
110 | |
109 | |
111 | sub frontend_info { _frontend_info ($_[0]{fd}) } |
|
|
112 | sub status { _read_status ($_[0]{fd}) } |
|
|
113 | sub ber { _read_ber ($_[0]{fd}) } |
|
|
114 | sub snr { _snr ($_[0]{fd}) } |
|
|
115 | sub signal_strength { _signal_strength ($_[0]{fd}) } |
|
|
116 | sub uncorrected { _uncorrected ($_[0]{fd}) } |
|
|
117 | |
|
|
118 | =item $fe->set (parameter => value, ...) |
110 | =item $fe->set (parameter => value, ...) |
119 | |
111 | |
120 | Sets frontend parameters. All values are stuffed into the |
112 | Sets frontend parameters. All values are stuffed into the |
121 | C<dvb_frontend_parameters> structure without conversion and passed to |
113 | C<dvb_frontend_parameters> structure without conversion and passed to |
122 | FE_SET_FRONTEND. |
114 | FE_SET_FRONTEND. |
… | |
… | |
134 | fec_inner => |
126 | fec_inner => |
135 | |
127 | |
136 | QAM frontends: |
128 | QAM frontends: |
137 | |
129 | |
138 | symbol_rate => |
130 | symbol_rate => |
139 | fec_inner => |
|
|
140 | modulation => |
131 | modulation => |
141 | |
132 | |
142 | QFDM frontends: |
133 | QFDM frontends: |
143 | |
134 | |
144 | bandwidth => |
135 | bandwidth => |
… | |
… | |
165 | |
156 | |
166 | { |
157 | { |
167 | frequency => 426000000, # 426 Mhz |
158 | frequency => 426000000, # 426 Mhz |
168 | inversion => 0, # INVERSION_OFF |
159 | inversion => 0, # INVERSION_OFF |
169 | symbol_rate => 6900000, # 6.9 MB/s |
160 | symbol_rate => 6900000, # 6.9 MB/s |
170 | fec_inner => 0, # FEC_NONE |
|
|
171 | modulation => 3, # QAM_64 |
161 | modulation => 3, # QAM_64 |
172 | } |
162 | } |
173 | |
163 | |
174 | =cut |
164 | =cut |
175 | |
165 | |
176 | sub parameters { _get ($_[0]{fd}, $_[0]{type}) } |
166 | sub parameters { _get ($_[0]{fd}, $_[0]{type}) } |
177 | sub get { _get ($_[0]{fd}, $_[0]{type}) } # unannounced alias |
167 | sub get { _get ($_[0]{fd}, $_[0]{type}) } # unannounced alias |
178 | sub event { _event ($_[0]{fd}, $_[0]{type}) } |
168 | sub event { _event ($_[0]{fd}, $_[0]{type}) } |
|
|
169 | |
|
|
170 | =item $ok = $fe->diseqc_reset_overload |
|
|
171 | |
|
|
172 | If the bus has been automatically powered off due to power overload, this |
|
|
173 | call restores the power to the bus. The call requires read/write access |
|
|
174 | to the device. This call has no effect if the device is manually powered |
|
|
175 | off. Not all DVB adapters support this call. |
|
|
176 | |
|
|
177 | =item $ok = $fe->diseqc_voltage (13|18) |
|
|
178 | |
|
|
179 | Set the DiSEqC voltage to either 13 or 18 volts. |
|
|
180 | |
|
|
181 | =item $ok = $fe->diseqc_tone (1|0) |
|
|
182 | |
|
|
183 | Enables (1) or disables (0) the DiSEqC continuous 22khz tone generation. |
|
|
184 | |
|
|
185 | =item $ok = $fe->diseqc_send_burst (0|1) |
|
|
186 | |
|
|
187 | Sends a 22KHz tone burst of type SEC_MINI_A (0) or SEC_MINI_B (1). |
|
|
188 | |
|
|
189 | =item $ok = $fe->diseqc_cmd ($command) |
|
|
190 | |
|
|
191 | Sends a DiSEqC command ($command is 3 to 6 bytes of binary data). |
|
|
192 | |
|
|
193 | =item $reply = $fe->diseqc_reply ($timeout) |
|
|
194 | |
|
|
195 | Receives a reply to a DiSEqC 2.0 command and returns it as a binary octet |
|
|
196 | string 0..4 bytes in length (or C<undef> in the error case). |
|
|
197 | |
|
|
198 | =cut |
179 | |
199 | |
180 | package Linux::DVB::Demux; |
200 | package Linux::DVB::Demux; |
181 | |
201 | |
182 | @ISA = qw(Linux::DVB); |
202 | @ISA = qw(Linux::DVB); |
183 | |
203 | |
… | |
… | |
346 | |
366 | |
347 | =cut |
367 | =cut |
348 | |
368 | |
349 | our %nibble_to_genre = ( |
369 | our %nibble_to_genre = ( |
350 | 0x1 => { |
370 | 0x1 => { |
351 | 0x0 => 'Movie / Drama', |
371 | 0x0 => 'Movie/Drama (general)', |
352 | 0x1 => 'Movie - detective/thriller', |
372 | 0x1 => 'Movie - detective/thriller', |
353 | 0x2 => 'Movie - adventure/western/war', |
373 | 0x2 => 'Movie - adventure/western/war', |
354 | 0x3 => 'Movie - science fiction/fantasy/horror', |
374 | 0x3 => 'Movie - science fiction/fantasy/horror', |
355 | 0x4 => 'Movie - comedy', |
375 | 0x4 => 'Movie - comedy', |
356 | 0x5 => 'Movie - soap/melodrama/folkloric', |
376 | 0x5 => 'Movie - soap/melodrama/folkloric', |
357 | 0x6 => 'Movie - romance', |
377 | 0x6 => 'Movie - romance', |
358 | 0x7 => 'Movie - serious/classical/religious/historical movie/drama', |
378 | 0x7 => 'Movie - serious/classical/religious/historical movie/drama', |
359 | 0x8 => 'Movie - adult movie/drama', |
379 | 0x8 => 'Movie - adult movie/drama', |
360 | }, |
380 | }, |
361 | 0x2 => { |
381 | 0x2 => { |
362 | 0x0 => 'News / Current Affairs', |
382 | 0x0 => 'News/Current Affairs (general)', |
363 | 0x1 => 'news/weather report', |
383 | 0x1 => 'news/weather report', |
364 | 0x2 => 'news magazine', |
384 | 0x2 => 'news magazine', |
365 | 0x3 => 'documentary', |
385 | 0x3 => 'documentary', |
366 | 0x4 => 'discussion/interview/debate', |
386 | 0x4 => 'discussion/interview/debate', |
367 | }, |
387 | }, |
368 | 0x3 => { |
388 | 0x3 => { |
369 | 0x0 => 'Show / Game Show', |
389 | 0x0 => 'Show/Game Show (general)', |
370 | 0x1 => 'game show/quiz/contest', |
390 | 0x1 => 'game show/quiz/contest', |
371 | 0x2 => 'variety show', |
391 | 0x2 => 'variety show', |
372 | 0x3 => 'talk show', |
392 | 0x3 => 'talk show', |
373 | }, |
393 | }, |
374 | 0x4 => { |
394 | 0x4 => { |
375 | 0x0 => 'Sports', |
395 | 0x0 => 'Sports (general)', |
376 | 0x1 => 'special events (Olympic Games, World Cup etc.)', |
396 | 0x1 => 'special events (Olympic Games, World Cup etc.)', |
377 | 0x2 => 'sports magazines', |
397 | 0x2 => 'sports magazines', |
378 | 0x3 => 'football/soccer', |
398 | 0x3 => 'football/soccer', |
379 | 0x4 => 'tennis/squash', |
399 | 0x4 => 'tennis/squash', |
380 | 0x5 => 'team sports (excluding football)', |
400 | 0x5 => 'team sports (excluding football)', |
… | |
… | |
384 | 0x9 => 'winter sports', |
404 | 0x9 => 'winter sports', |
385 | 0xA => 'equestrian', |
405 | 0xA => 'equestrian', |
386 | 0xB => 'martial sports', |
406 | 0xB => 'martial sports', |
387 | }, |
407 | }, |
388 | 0x5 => { |
408 | 0x5 => { |
389 | 0x0 => 'Childrens / Youth', |
409 | 0x0 => 'Childrens/Youth (general)', |
390 | 0x1 => "pre-school children's programmes", |
410 | 0x1 => "pre-school children's programmes", |
391 | 0x2 => 'entertainment programmes for 6 to 14', |
411 | 0x2 => 'entertainment programmes for 6 to 14', |
392 | 0x3 => 'entertainment programmes for 10 to 16', |
412 | 0x3 => 'entertainment programmes for 10 to 16', |
393 | 0x4 => 'informational/educational/school programmes', |
413 | 0x4 => 'informational/educational/school programmes', |
394 | 0x5 => 'cartoons/puppets', |
414 | 0x5 => 'cartoons/puppets', |
395 | }, |
415 | }, |
396 | 0x6 => { |
416 | 0x6 => { |
397 | 0x0 => 'Music / Ballet / Dance', |
417 | 0x0 => 'Music/Ballet/Dance (general)', |
398 | 0x1 => 'rock/pop', |
418 | 0x1 => 'rock/pop', |
399 | 0x2 => 'serious music/classical music', |
419 | 0x2 => 'serious music or classical music', |
400 | 0x3 => 'folk/traditional music', |
420 | 0x3 => 'folk/traditional music', |
401 | 0x4 => 'jazz', |
421 | 0x4 => 'jazz', |
402 | 0x5 => 'musical/opera', |
422 | 0x5 => 'musical/opera', |
403 | 0x6 => 'ballet', |
423 | 0x6 => 'ballet', |
404 | }, |
424 | }, |
405 | 0x7 => { |
425 | 0x7 => { |
406 | 0x0 => 'Arts / Culture', |
426 | 0x0 => 'Arts/Culture (without music, general)', |
407 | 0x1 => 'performing arts', |
427 | 0x1 => 'performing arts', |
408 | 0x2 => 'fine arts', |
428 | 0x2 => 'fine arts', |
409 | 0x3 => 'religion', |
429 | 0x3 => 'religion', |
410 | 0x4 => 'popular culture/traditional arts', |
430 | 0x4 => 'popular culture/traditional arts', |
411 | 0x5 => 'literature', |
431 | 0x5 => 'literature', |
… | |
… | |
415 | 0x9 => 'new media', |
435 | 0x9 => 'new media', |
416 | 0xA => 'arts/culture magazines', |
436 | 0xA => 'arts/culture magazines', |
417 | 0xB => 'fashion', |
437 | 0xB => 'fashion', |
418 | }, |
438 | }, |
419 | 0x8 => { |
439 | 0x8 => { |
420 | 0x0 => 'Social / Policical / Economics', |
440 | 0x0 => 'Social/Policical/Economics (general)', |
421 | 0x1 => 'magazines/reports/documentary', |
441 | 0x1 => 'magazines/reports/documentary', |
422 | 0x2 => 'economics/social advisory', |
442 | 0x2 => 'economics/social advisory', |
423 | 0x3 => 'remarkable people', |
443 | 0x3 => 'remarkable people', |
424 | }, |
444 | }, |
425 | 0x9 => { |
445 | 0x9 => { |
426 | 0x0 => 'Education / Science / Factual', |
446 | 0x0 => 'Education/Science/Factual (general)', |
427 | 0x1 => 'nature/animals/environment', |
447 | 0x1 => 'nature/animals/environment', |
428 | 0x2 => 'technology/natural sciences', |
448 | 0x2 => 'technology/natural sciences', |
429 | 0x3 => 'medicine/physiology/psychology', |
449 | 0x3 => 'medicine/physiology/psychology', |
430 | 0x4 => 'foreign countries/expeditions', |
450 | 0x4 => 'foreign countries/expeditions', |
431 | 0x5 => 'social/spiritual sciences', |
451 | 0x5 => 'social/spiritual sciences', |
432 | 0x6 => 'further education', |
452 | 0x6 => 'further education', |
433 | 0x7 => 'languages', |
453 | 0x7 => 'languages', |
434 | }, |
454 | }, |
435 | 0xA => { |
455 | 0xA => { |
436 | 0x0 => 'Leisure / Hobbies', |
456 | 0x0 => 'Leisure/Hobbies (general)', |
437 | 0x1 => 'tourism/travel', |
457 | 0x1 => 'tourism/travel', |
438 | 0x2 => 'handicraft', |
458 | 0x2 => 'handicraft', |
439 | 0x3 => 'motoring', |
459 | 0x3 => 'motoring', |
440 | 0x4 => 'fitness & health', |
460 | 0x4 => 'fitness & health', |
441 | 0x5 => 'cooking', |
461 | 0x5 => 'cooking', |
442 | 0x6 => 'advertizement/shopping', |
462 | 0x6 => 'advertizement/shopping', |
443 | 0x7 => 'gardening', |
463 | 0x7 => 'gardening', |
444 | }, |
464 | }, |
445 | 0xB => { |
465 | 0xB => { |
446 | 0x0 => 'Original Language', |
466 | 0x0 => '(original language)', |
447 | 0x1 => 'black & white', |
467 | 0x1 => '(black & white)', |
448 | 0x2 => 'unpublished', |
468 | 0x2 => '(unpublished)', |
449 | 0x3 => 'live broadcast', |
469 | 0x3 => '(live broadcast)', |
450 | }, |
470 | }, |
451 | ); |
471 | ); |
452 | |
472 | |
453 | =item ($sec,$min,$hour) = Linux::DVB::Decode::time $hms |
473 | =item ($sec,$min,$hour) = Linux::DVB::Decode::time $hms |
454 | |
474 | |