… | |
… | |
10 | |
10 | |
11 | This module provides an interface to the Linux DVB API. It is a straightforward |
11 | This module provides an interface to the Linux DVB API. It is a straightforward |
12 | translation of the C API. You should read the Linux DVB API description to make |
12 | translation of the C API. You should read the Linux DVB API description to make |
13 | any sense of this module. It can be found here: |
13 | any sense of this module. It can be found here: |
14 | |
14 | |
15 | http://www.linuxtv.org/developer/dvbapi.xml |
15 | http://www.linuxtv.org/docs/dvbapi/dvbapi.html |
16 | |
16 | |
17 | All constants from F<frontend.h> and F<demux.h> are exported by their C |
17 | All constants from F<frontend.h> and F<demux.h> are exported by their C |
18 | name and by default. |
18 | name and by default. |
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 |
… | |
… | |
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.1'; |
35 | $VERSION = '0.2'; |
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 | |
… | |
… | |
111 | sub ber { _read_ber ($_[0]{fd}) } |
111 | sub ber { _read_ber ($_[0]{fd}) } |
112 | sub snr { _snr ($_[0]{fd}) } |
112 | sub snr { _snr ($_[0]{fd}) } |
113 | sub signal_strength { _signal_strength ($_[0]{fd}) } |
113 | sub signal_strength { _signal_strength ($_[0]{fd}) } |
114 | sub uncorrected { _uncorrected ($_[0]{fd}) } |
114 | sub uncorrected { _uncorrected ($_[0]{fd}) } |
115 | |
115 | |
116 | #sub set { _set ($_[0]{fd}, $_[0]{type}) } |
116 | =item $fe->set (parameter => value, ...) |
|
|
117 | |
|
|
118 | Sets frontend parameters. All values are stuffed into the |
|
|
119 | C<dvb_frontend_parameters> structure without conversion and passed to |
|
|
120 | FE_SET_FRONTEND. |
|
|
121 | |
|
|
122 | Returns true on success. |
|
|
123 | |
|
|
124 | All modes: |
|
|
125 | |
|
|
126 | frequency => |
|
|
127 | inversion => |
|
|
128 | |
|
|
129 | QPSK frontends: |
|
|
130 | |
|
|
131 | symbol_rate => |
|
|
132 | fec_inner => |
|
|
133 | |
|
|
134 | QAM frontends: |
|
|
135 | |
|
|
136 | symbol_rate => |
|
|
137 | fec_inner => |
|
|
138 | modulation => |
|
|
139 | |
|
|
140 | QFDM frontends: |
|
|
141 | |
|
|
142 | bandwidth => |
|
|
143 | code_rate_HP => |
|
|
144 | code_rate_LP => |
|
|
145 | constellation => |
|
|
146 | transmission_mode => |
|
|
147 | |
|
|
148 | =cut |
|
|
149 | |
|
|
150 | sub set { |
|
|
151 | my ($self) = shift; |
|
|
152 | _set $self->{fd}, { @_ }, $self->{type} |
|
|
153 | } |
|
|
154 | |
|
|
155 | =item $fe->parameters |
|
|
156 | |
|
|
157 | Calls FE_GET_FRONTEND and returns a hash reference that contains the same keys |
|
|
158 | as given to the C<set> method. |
|
|
159 | |
|
|
160 | Example: |
|
|
161 | |
|
|
162 | Data::Dumper::Dumper $fe->get |
|
|
163 | |
|
|
164 | { |
|
|
165 | frequency => 426000000, # 426 Mhz |
|
|
166 | inversion => 0, # INVERSION_OFF |
|
|
167 | symbol_rate => 6900000, # 6.9 MB/s |
|
|
168 | fec_inner => 0, # FEC_NONE |
|
|
169 | modulation => 3, # QAM_64 |
|
|
170 | } |
|
|
171 | |
|
|
172 | =cut |
|
|
173 | |
117 | sub parameters { _get ($_[0]{fd}, $_[0]{type}) } |
174 | sub parameters { _get ($_[0]{fd}, $_[0]{type}) } |
|
|
175 | sub get { _get ($_[0]{fd}, $_[0]{type}) } # unannounced alias |
118 | sub event { _event ($_[0]{fd}, $_[0]{type}) } |
176 | sub event { _event ($_[0]{fd}, $_[0]{type}) } |
119 | |
177 | |
120 | package Linux::DVB::Demux; |
178 | package Linux::DVB::Demux; |
121 | |
179 | |
122 | @ISA = qw(Linux::DVB); |
180 | @ISA = qw(Linux::DVB); |
… | |
… | |
152 | |
210 | |
153 | sub sct_filter { _filter ($_[0]{fd}, @_[1, 2, 3, 4, 5]) } |
211 | sub sct_filter { _filter ($_[0]{fd}, @_[1, 2, 3, 4, 5]) } |
154 | sub pes_filter { _pes_filter ($_[0]{fd}, @_[1, 2, 3, 4, 5]) } |
212 | sub pes_filter { _pes_filter ($_[0]{fd}, @_[1, 2, 3, 4, 5]) } |
155 | sub buffer { _buffer ($_[0]{fd}, $_[1]) } |
213 | sub buffer { _buffer ($_[0]{fd}, $_[1]) } |
156 | |
214 | |
|
|
215 | package Linux::DVB::Decode; |
|
|
216 | |
|
|
217 | use Encode; |
|
|
218 | |
|
|
219 | sub text($) { |
|
|
220 | for ($_[0]) { |
|
|
221 | s/^([\x01-\x0b])// and $_ = decode sprintf ("iso-8859-%d", 4 + ord $1), $_; |
|
|
222 | # 10 - pardon you??? |
|
|
223 | s/^\x11// and $_ = decode "utf16-be", $_; |
|
|
224 | # 12 ksc5601, DB |
|
|
225 | # 13 db2312, DB |
|
|
226 | # 14 big5(?), DB |
|
|
227 | s/\x8a/\n/g; |
|
|
228 | #s/([\x00-\x09\x0b-\x1f\x80-\x9f])/sprintf "{%02x}", ord $1/ge; |
|
|
229 | s/([\x00-\x09\x0b-\x1f\x80-\x9f])//ge; |
|
|
230 | } |
|
|
231 | } |
|
|
232 | |
157 | 1; |
233 | 1; |
158 | |
234 | |
159 | =head1 AUTHOR |
235 | =head1 AUTHOR |
160 | |
236 | |
161 | Marc Lehmann <pcg@goof.com> |
237 | Marc Lehmann <schmorp@schmorp.de> |
162 | http://www.goof.com/pcg/marc/ |
238 | http://home.schmorp.de/ |
163 | |
239 | |
164 | =cut |
240 | =cut |
165 | |
241 | |