DVB::Epg - Generate MPEG-2 transport stream chunk containing DVB Event Information table.
This module allows generating of DVB EPG service by building EIT p/f and schedule tables. First some event information must be added to the system. A sqlite database for storage is used. Based on this event information the library builds the standardized EIT, which can then be export as a MPEG-2 Transport Stream/chunk for playout. The result of the whole process is an EIT inside a MTS.
use DVB::Epg; my $myEpg = DVB::Epg->new( 'eitfile'); # create empty database $myEpg->initdb(); # add program to EIT for which to generate EPG $myEpg->addEit( 18, 9019, 1024, 15, 8, 1); # add dummy event data to database my $event = {}; $event->{start} = time; $event->{stop} = time+100; $event->{uid} = 15; $myEpg->addEvent( $event); # generate EPG tables to database $myEpg->updateEit( 18); # export EIT as MTS from database my $mts = $myEpg->getEit( 18);
The Library can handle multiple services and multiple tables.
Epg
Class initialization with sqlite3 database filename. Open existing or create new sqlite database.
Return database handle for direct control.
Initialize database with some basic table structure;
Add an $event to event table. $event must be reference to hash containing at least fields: $event->{start}, $event->{stop}, $event->{uid}
start, stop MUST be in EPOCH
Optional fields are: $event->{id}, $event->{running_status}, $event->{free_CA_mode} and $event->{descriptors}
Return event_key of inserted row.
List events with $uid in cronological order.
$event_id, $start, $stop, $touch are optional parameters. $event_id is used as selection filter. $start, $stop are used as interval specification. If $touch is defined only elements with timestamp newer than $touch are returned.
Return array of events.
Delete events with $uid.
$event_id, $stop_min, $stop_max, $start_min and $start_max are optional parameters. $uid and $event_id are used as selection filter.
Delete events that have start in between $start_min, $start_max and stop in between $stop_min, $stop_max. Use only defined markers.
Return number of deleted events.
Add eit generator rule. Maxsegments defines how far in the future the tables should be generated - each segment defines 3 hour period. All parameters must be defined.
Return 1 on success.
List eit generator rules.
Return reference to an array of arrays of rules.
List all destination pid defined in eit generator rules.
Return array of pids.
Delete eit generator rule. Parameters are optional.
Return number of deleted rules.
Use eit rules for updateing Eit sections of given $pid in database.
Return 1 on success. Return 0 if sections are already uptodate. Return undef on error;
Update eit sections for given $rule. $rule is reference to hash containing keys: pid, service_id, original_network_id, transport_stream_id, service_id, maxsegments, actual
Update sections only if there are changes in event table of schedule since last update or the $forced flag is set to 1.
Return undef if failed. Return 0 if sections are already uptodate. Return 1 after updating sections.
Update eit playout packet for given $rule. $rule is reference to hash containing keys: pid, service_id, original_network_id, transport_stream_id, service_id, maxsegments, actual
Build final EIT from all sections in table for given $pid and $timeFrame.
Return the complete TS chunk to be played within the timeframe. Default timeframe should be 60s. Return undef on error.
Make lookup by $table_id and $section_number and return how often this section has to be repeated in the given interval. Default interval ($timeFrame) is 60 seconds.
Return last db operation error.
Generate MPEG transport stream for defined $pid and $section in database. Continuity counter starts at 0; Return MTS.
$event is a reference to hash containing elements of a row in event table. Thaw the info field and update all other keys from field values.
Return reference to updated info hash.
EventInformationTable
EIT subtable initialization with information taken from $rule.
Add $event to segment with number $segment_number. $event is reference to hash containin event data.
Return 1 on success. Return undef on error.
Add $event to section with number $section_number. $event is reference to hash containin event data.
Return binary $size of all events in section (always < 4078) or negativ if section is full, undef on error.
Return reference to hash of sections with section_number as key and section as value.
Return binary representation of $descriptor.
Convert $string containing only byte characters. This is for avoiding any problems with UTF8. Those string must be converted before entering data into database.
Return converted string.
Return 1 or many Extended Event Descriptors
Convert integer $time in seconds into 24 bit time BCD format (hour:minute:seconds).
Convert time in 24 bit BCD format (hour:minute:seconds) in seconds from midnight;
Convert epoch $time into 40 bit Modified Julian Date and time BCD format.
Convert 40 bit Modified Julian Date and time BCD format into epoch.
Bojan Ramsak, <BojanR@gmx.net>
<BojanR@gmx.net>
Please report any bugs or feature requests to bug-dvb-epg at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DVB-Epg. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-dvb-epg at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc DVB::Epg
You can also look for information at:
Copyright 2012 Bojan Ramsak.
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0
See http://www.opensource.org/licenses/Artistic-2.0 for more information.
To install DVB::Epg, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DVB::Epg
CPAN shell
perl -MCPAN -e shell install DVB::Epg
For more information on module installation, please visit the detailed CPAN module installation guide.