Debian Codegraph @

README

raw
1 NAME
2 Linux::DVB - interface to (some parts of) the Linux DVB API
3
4 SYNOPSIS
5 use Linux::DVB;
6
7 DESCRIPTION
8 This module provides an interface to the Linux DVB API. It is a
9 straightforward translation of the C API. You should read the Linux DVB
10 API description to make any sense of this module. It can be found here:
11
12 http://www.linuxtv.org/docs/dvbapi/dvbapi.html
13
14 All constants from frontend.h and demux.h are exported by their C name
15 and by default.
16
17 Noteworthy differences to the C API: unions and sub-structs are usually
18 translated into flat perl hashes, i.e "struct.u.qam.symbol_rate" becomes
19 "$struct->{symbol_rate}".
20
21 Noteworthy limitations of this module include: No interface to the
22 video, audio and net devices. If you need this functionality bug the
23 author.
24
25 Linux::DVB::Frontend CLASS
26 SYNOPSIS
27 my $fe = new Linux::DVB::Frontend $path, $writable;
28
29 my $fe = new Linux::DVB::Frontend
30 "/dev/dvb/adapter0/frontend0", 1;
31
32 $fe->fh; # filehandle
33 $fe->fd; # fileno
34 $fe->blocking (0); # or 1
35
36 $fe->{name}
37 $fe->{type}
38 $fe->frontend_info->{name}
39
40 $fe->status & FE_HAS_LOCK
41 print $fe->ber, $fe->snr, $fe->signal_strength, $fe->uncorrected;
42
43 my $tune = $fe->parameters;
44 $tune->{frequency};
45 $tune->{symbol_rate};
46
47 $fe->set (parameter => value, ...)
48 Sets frontend parameters. All values are stuffed into the
49 "dvb_frontend_parameters" structure without conversion and passed to
50 FE_SET_FRONTEND.
51
52 Returns true on success.
53
54 All modes:
55
56 frequency =>
57 inversion =>
58
59 QPSK frontends:
60
61 symbol_rate =>
62 fec_inner =>
63
64 QAM frontends:
65
66 symbol_rate =>
67 modulation =>
68
69 QFDM frontends:
70
71 bandwidth =>
72 code_rate_HP =>
73 code_rate_LP =>
74 constellation =>
75 transmission_mode =>
76
77 $fe->parameters
78 Calls FE_GET_FRONTEND and returns a hash reference that contains the
79 same keys as given to the "set" method.
80
81 Example:
82
83 Data::Dumper::Dumper $fe->get
84
85 {
86 frequency => 426000000, # 426 Mhz
87 inversion => 0, # INVERSION_OFF
88 symbol_rate => 6900000, # 6.9 MB/s
89 modulation => 3, # QAM_64
90 }
91
92 $ok = $fe->diseqc_reset_overload
93 If the bus has been automatically powered off due to power overload,
94 this call restores the power to the bus. The call requires
95 read/write access to the device. This call has no effect if the
96 device is manually powered off. Not all DVB adapters support this
97 call.
98
99 $ok = $fe->diseqc_voltage (13|18)
100 Set the DiSEqC voltage to either 13 or 18 volts.
101
102 $ok = $fe->diseqc_tone (1|0)
103 Enables (1) or disables (0) the DiSEqC continuous 22khz tone
104 generation.
105
106 $ok = $fe->diseqc_send_burst (0|1)
107 Sends a 22KHz tone burst of type SEC_MINI_A (0) or SEC_MINI_B (1).
108
109 $ok = $fe->diseqc_cmd ($command)
110 Sends a DiSEqC command ($command is 3 to 6 bytes of binary data).
111
112 $reply = $fe->diseqc_reply ($timeout)
113 Receives a reply to a DiSEqC 2.0 command and returns it as a binary
114 octet string 0..4 bytes in length (or "undef" in the error case).
115
116 Linux::DVB::Demux CLASS
117 SYNOPSIS
118 my $dmx = new Linux::DVB::Demux
119 "/dev/dvb/adapter0/demux0";
120
121 $fe->fh; # filehandle
122 $fe->fd; # fileno
123 $fe->blocking (1); # non-blocking is default
124
125 $dmx->buffer (16384);
126 $dmx->sct_filter ($pid, "filter", "mask", $timeout=0, $flags=DMX_CHECK_CRC);
127 $dmx->pes_filter ($pid, $input, $output, $type, $flags=0);
128 $dmx->start;
129 $dmx->stop;
130
131 Linux::DVB::Decode CLASS
132 SYNOPSIS
133 $si_decoded_hashref = Linux::DVB::Decode::si $section_data;
134
135 $hashref = Linux::DVB::Decode::si $section_data
136 Tries to parse the string inside $section_data as an SI table and
137 return it as a hash reference. Only the first SI table will be
138 returned as hash reference, and the $section_data will be modified
139 in-place by removing the table data.
140
141 The way to use this function is to append new data to your
142 $section_data and then call "Linux::DVB::Decode::si" in a loop until
143 it returns "undef". Please ntoe, however, that the Linux DVB API
144 will return only one table at a time from sysread, so you can safely
145 assume that every sysread will return exactly one (or zero in case
146 of errors) SI table.
147
148 Here is an example of what to expect:
149
150 {
151 'segment_last_section_number' => 112,
152 'table_id' => 81,
153 'service_id' => 28129,
154 'original_network_id' => 1,
155 'section_syntax_indicator' => 1,
156 'current_next_indicator' => 1,
157 'events' => [
158 {
159 'running_status' => 0,
160 'start_time_hms' => 2097152,
161 'event_id' => 39505,
162 'free_CA_mode' => 0,
163 'start_time_mjd' => 53470,
164 'descriptors' => [
165 {
166 'event_name' => 'Nachrichten',
167 'text' => '',
168 'ISO_639_language_code' => 'deu',
169 'type' => 77
170 },
171 {
172 'programme_identification_label' => 337280,
173 'type' => 105
174 },
175 {
176 'raw_data' => '22:0010.04#00',
177 'type' => 130
178 }
179 ],
180 'duration' => 1280
181 },
182 {
183 'running_status' => 0,
184 'start_time_hms' => 2098432,
185 'event_id' => 39506,
186 'free_CA_mode' => 0,
187 'start_time_mjd' => 53470,
188 'descriptors' => [
189 {
190 'event_name' => 'SR 1 - Nachtwerk',
191 'text' => '',
192 'ISO_639_language_code' => 'deu',
193 'type' => 77
194 },
195 {
196 'programme_identification_label' => 337285,
197 'type' => 105
198 },
199 {
200 'raw_data' => '22:0510.04#00',
201 'type' => 130
202 }
203 ],
204 'duration' => 87296
205 }
206 ],
207 'last_table_id' => 81,
208 'section_number' => 112,
209 'last_section_number' => 176,
210 'version_number' => 31,
211 'transport_stream_id' => 1101
212 }
213
214 $text = Linux::DVB::Decode::text $data
215 Converts text found in DVB si tables into perl text. Only
216 iso-8859-1..-11 and UTF-16 is supported, other encodings (big5 etc.
217 is not. Bug me if you need this).
218
219 %Linux::DVB::Decode::nibble_to_genre
220 A two-level hash mapping genre nibbles to genres, e.g.
221
222 $Linux::DVB::Decode::nibble_to_genre{7}{6}
223 => 'film/cinema'
224
225 ($sec,$min,$hour) = Linux::DVB::Decode::time $hms
226 ($mday,$mon,$year) = Linux::DVB::Decode::date $mjd
227 ($sec,$min,$hour,$mday,$mon,$year) = Linux::DVB::Decode::datetime $mjd,
228 $hms
229 $sec = Linux::DVB::Decode::time_linear $hms
230 $sec = Linux::DVB::Decode::datetime_linear $mjd, $hms
231 Break down a "DVB time" (modified julian date + bcd encoded seconds)
232 into it's components (non-"_linear") or into a seconds count
233 ("_linear" variants) since the epoch ("datetime_linear") or the
234 start of the day ("time_linear").
235
236 The format of the returns value of the date and datetime functions
237 is *not* compatible with "Time::Local". Use the "_linear" functions
238 instead.
239
240 Example:
241
242 my $time = Linux::DVB::Decode::datetime_linear $mjd, $hms
243 printf "Starts at %s\n",
244 POSIX::strftime "%Y-%m-%d %H:%M:%S",
245 localtime $time;
246
247 AUTHORS
248 Marc Lehmann <[email protected]>, http://home.schmorp.de/
249 Magnus Schmidt, eMail at http://www.27b-6.de/email.php
250