DVB(3pm)
π« DVB β Linux::DVB π«
okay bestie, sit down, hydrate, and let me tell you about Linux::DVB β it's the perl manual page for the DVB(3pm) module, and yeah it's a whole vibe. It's the interface to (some parts of) the Linux DVB API, and she's giving very much "I read the C headers so you don't have to." π¦
β¨ NAME β¨
Linux::DVB β interface to (some parts of) the Linux DVB API. π
π SYNOPSIS π
use Linux::DVB;
that's it. that's the whole vibe. load her up and go. π
πΈ DESCRIPTION πΈ
So this module gives you an interface to the Linux DVB API. It is a straightforward translation of the C API β like, no glow-up, no reinterpretation, just the C API but wearing perl. Which means: you should read the Linux DVB API description to make any sense of this module, fr fr. You can find it here:
http://www.linuxtv.org/docs/dvbapi/dvbapi.html
All constants from frontend.h and demux.h are exported by their C name and by default. so like, they just show up. no use list, no asking. iconic behaviour honestly.
Noteworthy differences to the C API (the little plot twists π): unions and sub-structs are usually translated into flat perl hashes, i.e.
struct.u.qam.symbol_rate
becomes
$struct->{symbol_rate}
nesting? never heard of her. flat hashes only. π
Noteworthy limitations of this module (the not-so-slay parts π): No interface to the video, audio and net devices. If you need this functionality, bug the author. That's the official documented remedy, bestie β bug the author. π«Ά
π Linux::DVB::Frontend CLASS π
π¦ SYNOPSIS π¦
my $fe = new Linux::DVB::Frontend $path, $writable;
my $fe = new Linux::DVB::Frontend
"/dev/dvb/adapter0/frontend0", 1;
$fe->fh; # filehandle
$fe->fd; # fileno
$fe->blocking (0); # or 1
$fe->{name}
$fe->{type}
$fe->frontend_info->{name}
$fe->status & FE_HAS_LOCK
print $fe->ber, $fe->snr, $fe->signal_strength, $fe->uncorrected;
my $tune = $fe->parameters;
$tune->{frequency};
$tune->{symbol_rate};
π $fe->set (parameter => value, ...) π
Sets frontend parameters. All values are stuffed into the dvb_frontend_parameters structure without conversion and passed to FE_SET_FRONTEND. no vibes-based interpretation, no guessing β what you give is what gets shoved in. π
Returns true on success.
All modes:
frequency =>
inversion =>
QPSK frontends:
symbol_rate =>
fec_inner =>
QAM frontends:
symbol_rate =>
modulation =>
QFDM frontends:
bandwidth =>
code_rate_HP =>
code_rate_LP =>
constellation =>
transmission_mode =>
π $fe->parameters π
Calls FE_GET_FRONTEND and returns a hash reference that contains the same keys as given to the set method. mirror selfie energy. πΈ
Example:
Data::Dumper::Dumper $fe->get
{
frequency => 426000000, # 426 Mhz
inversion => 0, # INVERSION_OFF
symbol_rate => 6900000, # 6.9 MB/s
modulation => 3, # QAM_64
}
π
$ok = $fe->diseqc_reset_overload π
If the bus has been automatically powered off due to power overload, this call restores the power to the bus. The call requires read/write access to the device. This call has no effect if the device is manually powered off. Not all DVB adapters support this call. π
β $ok = $fe->diseqc_voltage (13|18) β
Set the DiSEqC voltage to either 13 or 18 volts. pick a lane, bestie. β‘
π $ok = $fe->diseqc_tone (1|0) π
Enables (1) or disables (0) the DiSEqC continuous 22khz tone generation. on/off, that's the whole arc. πΈ
π¦ $ok = $fe->diseqc_send_burst (0|1) π¦
Sends a 22KHz tone burst of type SEC_MINI_A (0) or SEC_MINI_B (1). two options, both iconic. β¨
π $ok = $fe->diseqc_cmd ($command) π
Sends a DiSEqC command. $command is 3 to 6 bytes of binary data. no more, no less, we don't make the rules. π
π $reply = $fe->diseqc_reply ($timeout) π
Receives a reply to a DiSEqC 2.0 command and returns it as a binary octet string 0..4 bytes in length β or undef in the error case. π the undef jumpscare is real.
π Linux::DVB::Demux CLASS π
π§ SYNOPSIS π§
my $dmx = new Linux::DVB::Demux
"/dev/dvb/adapter0/demux0";
$fe->fh; # filehandle
$fe->fd; # fileno
$fe->blocking (1); # non-blocking is default
$dmx->buffer (16384);
$dmx->sct_filter ($pid, "filter", "mask", $timeout=0, $flags=DMX_CHECK_CRC);
$dmx->pes_filter ($pid, $input, $output, $type, $flags=0);
$dmx->start;
$dmx->stop;
lowkey important: $fe->blocking (1) is you turning blocking ON β non-blocking is default. don't get it twisted. π
π Linux::DVB::Decode CLASS π
π SYNOPSIS π
$si_decoded_hashref = Linux::DVB::Decode::si $section_data;
πΈ $hashref = Linux::DVB::Decode::si $section_data πΈ
Tries to parse the string inside $section_data as an SI table and return it as a hash reference. Only the first SI table will be returned as hash reference, and the $section_data will be modified in-place by removing the table data. yes bestie, she eats your buffer. that's the deal. π
The way to use this function is to append new data to your $section_data and then call Linux::DVB::Decode::si in a loop until it returns undef. Please note, however, that the Linux DVB API will return only one table at a time from sysread, so you can safely assume that every sysread will return exactly one (or zero in case of errors) SI table. π€
Here is an example of what to expect:
{
'segment_last_section_number' => 112,
'table_id' => 81,
'service_id' => 28129,
'original_network_id' => 1,
'section_syntax_indicator' => 1,
'current_next_indicator' => 1,
'events' => [
{
'running_status' => 0,
'start_time_hms' => 2097152,
'event_id' => 39505,
'free_CA_mode' => 0,
'start_time_mjd' => 53470,
'descriptors' => [
{
'event_name' => 'Nachrichten',
'text' => '',
'ISO_639_language_code' => 'deu',
'type' => 77
},
{
'programme_identification_label' => 337280,
'type' => 105
},
{
'raw_data' => '22:0010.04#00',
'type' => 130
}
],
'duration' => 1280
},
{
'running_status' => 0,
'start_time_hms' => 2098432,
'event_id' => 39506,
'free_CA_mode' => 0,
'start_time_mjd' => 53470,
'descriptors' => [
{
'event_name' => 'SR 1 - Nachtwerk',
'text' => '',
'ISO_639_language_code' => 'deu',
'type' => 77
},
{
'programme_identification_label' => 337285,
'type' => 105
},
{
'raw_data' => '22:0510.04#00',
'type' => 130
}
],
'duration' => 87296
}
],
'last_table_id' => 81,
'section_number' => 112,
'last_section_number' => 176,
'version_number' => 31,
'transport_stream_id' => 1101
}
π¦ $text = Linux::DVB::Decode::text $data π¦
Converts text found in DVB si tables into perl text. Only iso-8859-1..-11 and UTF-16 is supported, other encodings (big5 etc.) is not. Bug me if you need this. π (yes, "bug me" is literally in the docs, and honestly? respect.)
β %Linux::DVB::Decode::nibble_to_genre β
A two-level hash mapping genre nibbles to genres, e.g.
$Linux::DVB::Decode::nibble_to_genre{7}{6}
=> 'film/cinema'
nibble in, genre out. the duality of perl. π¬
π time / date / datetime / time_linear / datetime_linear π
($sec,$min,$hour) = Linux::DVB::Decode::time $hms
($mday,$mon,$year) = Linux::DVB::Decode::date $mjd
($sec,$min,$hour,$mday,$mon,$year) = Linux::DVB::Decode::datetime $mjd,
$hms
$sec = Linux::DVB::Decode::time_linear $hms
$sec = Linux::DVB::Decode::datetime_linear $mjd, $hms
Break down a DVB time (modified julian date + bcd encoded seconds) into it's components (non-_linear) or into a seconds count (_linear variants) since the epoch (datetime_linear) or the start of the day (time_linear). β¨
π¨ the format of the returns value of the date and datetime functions is NOT compatible withTime::Local. Use the_linearfunctions instead. no cap, do not rawdog it withTime::Local. π
Example:
my $time = Linux::DVB::Decode::datetime_linear $mjd, $hms
printf "Starts at %s\n",
POSIX::strftime "%Y-%m-%d %H:%M:%S",
localtime $time;
π AUTHORS π
Marc Lehmann <schmorp@schmorp.de>, http://home.schmorp.de/
Magnus Schmidt, eMail at http://www.27b-6.de/email.php
and that's the whole page, bestie!! π«Ά this was perl v5.40.1, dated 2025-04-13 β documented on 2025-04-13 with perl v5.40.1, DVB(3pm) flavour. go forth and tune those frontends. periodt. π
β¨π
π¦ where this page comes from
- debian trixie: liblinux-dvb-perl 1.03-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liblinux-dvb-perl 1.03-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms