ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Linux-DVB/DVB.pm
(Generate patch)

Comparing Linux-DVB/DVB.pm (file contents):
Revision 1.1 by root, Mon Sep 6 06:25:12 2004 UTC vs.
Revision 1.5 by root, Sun Apr 3 02:16:05 2005 UTC

10 10
11This module provides an interface to the Linux DVB API. It is a straightforward 11This module provides an interface to the Linux DVB API. It is a straightforward
12translation of the C API. You should read the Linux DVB API description to make 12translation of the C API. You should read the Linux DVB API description to make
13any sense of this module. It can be found here: 13any 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
17All constants from F<frontend.h> and F<demux.h> are exported by their C 17All constants from F<frontend.h> and F<demux.h> are exported by their C
18name and by default. 18name and by default.
19 19
20Noteworthy differences to the C API: unions and sub-structs are usually 20Noteworthy differences to the C API: unions and sub-structs are usually
30package Linux::DVB; 30package Linux::DVB;
31 31
32use Fcntl (); 32use Fcntl ();
33 33
34BEGIN { 34BEGIN {
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
111sub ber { _read_ber ($_[0]{fd}) } 111sub ber { _read_ber ($_[0]{fd}) }
112sub snr { _snr ($_[0]{fd}) } 112sub snr { _snr ($_[0]{fd}) }
113sub signal_strength { _signal_strength ($_[0]{fd}) } 113sub signal_strength { _signal_strength ($_[0]{fd}) }
114sub uncorrected { _uncorrected ($_[0]{fd}) } 114sub uncorrected { _uncorrected ($_[0]{fd}) }
115 115
116#sub set { _set ($_[0]{fd}, $_[0]{type}) } 116=item $fe->set (parameter => value, ...)
117
118Sets frontend parameters. All values are stuffed into the
119C<dvb_frontend_parameters> structure without conversion and passed to
120FE_SET_FRONTEND.
121
122Returns true on success.
123
124All modes:
125
126 frequency =>
127 inversion =>
128
129QPSK frontends:
130
131 symbol_rate =>
132 fec_inner =>
133
134QAM frontends:
135
136 symbol_rate =>
137 fec_inner =>
138 modulation =>
139
140QFDM frontends:
141
142 bandwidth =>
143 code_rate_HP =>
144 code_rate_LP =>
145 constellation =>
146 transmission_mode =>
147
148=cut
149
150sub set {
151 my ($self) = shift;
152 _set $self->{fd}, { @_ }, $self->{type}
153}
154
155=item $fe->parameters
156
157Calls FE_GET_FRONTEND and returns a hash reference that contains the same keys
158as given to the C<set> method.
159
160Example:
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
117sub parameters { _get ($_[0]{fd}, $_[0]{type}) } 174sub parameters { _get ($_[0]{fd}, $_[0]{type}) }
175sub get { _get ($_[0]{fd}, $_[0]{type}) } # unannounced alias
118sub event { _event ($_[0]{fd}, $_[0]{type}) } 176sub event { _event ($_[0]{fd}, $_[0]{type}) }
119 177
120package Linux::DVB::Demux; 178package Linux::DVB::Demux;
121 179
122@ISA = qw(Linux::DVB); 180@ISA = qw(Linux::DVB);
152 210
153sub sct_filter { _filter ($_[0]{fd}, @_[1, 2, 3, 4, 5]) } 211sub sct_filter { _filter ($_[0]{fd}, @_[1, 2, 3, 4, 5]) }
154sub pes_filter { _pes_filter ($_[0]{fd}, @_[1, 2, 3, 4, 5]) } 212sub pes_filter { _pes_filter ($_[0]{fd}, @_[1, 2, 3, 4, 5]) }
155sub buffer { _buffer ($_[0]{fd}, $_[1]) } 213sub buffer { _buffer ($_[0]{fd}, $_[1]) }
156 214
215package Linux::DVB::Decode;
216
217use Encode;
218
219sub 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
1571; 2331;
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines