The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Linux::DVB::DVBT::Config - DVBT configuration functions

SYNOPSIS

        use Linux::DVB::DVBT::Config ;
  

DESCRIPTION

Module provides a set of configuration routines used by the DVBT module. It is unlikely that you will need to access these functions directly, but you can if you wish.

Functions

find_tsid($frequency, $tuning_href)

Given a frequency, find the matching TSID.

$tuning_href is the HASH returned by Linux::DVB::DVBT::get_tuning_info().

tsid_params($tsid, $tuning_href)

Given a tsid, return the frontend params (or undef). The frontend params HASH contain the information used to tune the frontend i.e. this is the transponder (TSID) information. It corresponds to the matching 'ts' entry in the tuning info HASH.

$tuning_href is the HASH returned by Linux::DVB::DVBT::get_tuning_info().

chan_from_pid($tsid, $pid, $tuning_href)

Given a tsid and pid, find the matching channel information and returns the program HASH ref if found. This corresponds to the matching 'pr' entry in the tuning info HASH.

$tuning_href is the HASH returned by Linux::DVB::DVBT::get_tuning_info().

pid_info($pid, $tuning_href)

Given a pid, find the matching channel & TSID information

Returns an array of HASH entries, each HASH containing the stream type (video, audio, subtitle, or teletext), along with a copy of the associated program information (i.e. the matching 'pr' entry from the tuning info HASH):

        @pid_info = [
                {
                          'pidtype' => video, audio, subtitle, teletext
                     pnr => 4171,
                     tsid => 4107,
                     tuned_freq => 57800000,
                          ...
                },
                ...
        ]

$tuning_href is the HASH returned by Linux::DVB::DVBT::get_tuning_info().

find_channel($channel_name, $tuning_href)

Given a channel name, do a "fuzzy" search and return an array containing params:

        ($frontend_params_href, $demux_params_href)

$demux_params_href HASH ref are of the form:

                {
                  pnr => 4171,
                  tsid => 4107,
                  tuned_freq => 57800000,
                  ...
                },
                

(i.e. $tuning_href->{'pr'}{$channel_name})

$frontend_params_href HASH ref are of the form:

                { 
                  tsid => 4107,   
                          frequency => 57800000,            
                  ...
                },
        

(i.e. $tuning_href->{'ts'}{$tsid} where $tsid is TSID for the channel)

$tuning_href is the HASH returned by Linux::DVB::DVBT::get_tuning_info().

audio_pids($demux_params_href, $language_spec, $pids_aref)

Process the demux parameters and a language specifier to return the list of audio streams required.

demux_params are of the form:

                {
                  pnr => 4171,
                  tsid => 4107,
                  tuned_freq => 57800000,
                  ...
                },

(i.e. $tuning_href->{'pr'}{$channel_name})

Language specifier string is in the format:

a)

Empty string : just return the default audio stream pid

b)

Comma/space seperated list of one or more language names : returns the audio stream pids for all that match (does not necessarily include default stream)

If the list in (b) contains a '+' character (normally at the start) then the default audio stream is automatically included in teh list, and the extra streams are added to it.

For example, if a channel has the following audio details: eng:100 eng:101 fra:102 deu:103 Then the following specifications result in the lists as shown:

  • "" => (100)

  • "eng deu" => (100, 103)

  • "+eng fra" => (100, 101, 102)

Note that the language names are not case sensitive

subtitle_pids($demux_params_href, $language_spec, $pids_aref) #copy/paste from audio_pid by rainbowcrypt

Process the demux parameters and a language specifier to return the list of audio streams required.

demux_params are of the form:

                {
                  pnr => 4171,
                  tsid => 4107,
                  tuned_freq => 57800000,
                  ...
                },

(i.e. $tuning_href->{'pr'}{$channel_name})

Language specifier string is in the format:

a)

Empty string : just return the default audio stream pid

b)

Comma/space seperated list of one or more language names : returns the audio stream pids for all that match (does not necessarily include default stream)

If the list in (b) contains a '+' character (normally at the start) then the default audio stream is automatically included in teh list, and the extra streams are added to it.

For example, if a channel has the following audio details: eng:100 eng:101 fra:102 deu:103 Then the following specifications result in the lists as shown:

  • "" => (100)

  • "eng deu" => (100, 103)

  • "+eng fra" => (100, 101, 102)

Note that the language names are not case sensitive

out_pids($demux_params_href, $out_spec, $language_spec, $subtitle_language_spec, $pids_aref) #modified by rainbowcrypt

Process the demux parameters and an output specifier to return the list of all stream pids required.

Output specifier string is in the format such that it just needs to contain the following characters:

   a = audio
   v = video
   s = subtitle

Returns an array of HASHes of the form:

         {'pid' => $pid, 'pidtype' => $type, 'pmt' => $pmt} 
audio_list($demux_params_href)

Process the demux parameters and return a list of additional audio streams (or an empty list if none available).

For example:

                { 
                  audio => 601,                   
                  audio_details => eng:601 eng:602,       
                                ...
                },

would return the list: ( 602 )

sub_list($demux_params_href) by rainbowcrypt

Process the demux parameters and return a list of additional subtitle streams (or an empty list if none available).

For example:

                { 
                  subtitle => 601,                   
                  subtitle_details => DVD_malentendant:601 DVB-francais:602,       
                                ...
                },

would return the list: ( 602 )

read($search_path)

Read tuning information from config files. Look in search path and return first set of readable file information in a tuning HASH ref.

Returns a HASH ref of tuning information - i.e. it contains the complete information on all transponders (under the 'ts' field), and all programs (under the 'pr' field). [see Linux::DVB::DVBT::scan() method for format].

write($search_path, $tuning_href)

Write tuning information into the first writeable area in the search path.

read_filename($filetype, [$search_path] )

Returns the readable filename for the specified file type, which can be one of: 'pr'=program, 'ts'=transponder.

Optionally specify the search path (otherwise the default search path is used)

Returns undef if invalid file type is specified, or unable to find a readable area.

write_filename($filetype, [$search_path] )

Returns the writeable filename for the specified file type, which can be one of: 'pr'=program, 'ts'=transponder.

Optionally specify the search path (otherwise the default search path is used)

Returns undef if invalid file type is specified, or unable to find a writeable area.

tsid_sort($tsid_a, $tsid_b)

Sorts TSIDs. As I now allow duplicate TSIDs in scans, and the duplicates are suffixed with a letter to make it obvious, numeric sorting is not possible.

This function can be used to correctly sort the TSIDs into order. Returns the usual -1, 0, 1 depending on if a is <, ==, or > b

tsid_str($tsid)

Format the tsid number/name into a string. As I now allow duplicate TSIDs in scans, and the duplicates are suffixed with a letter to make it obvious which are duplicates. This routine formats the numeric part and always adds a suffix character (or space if none present).

tsid_delete($tsid, $tuning_href)

Remove the specified TSID from the tuning information. Also removes any channels that are under that TSID.

merge($new_href, $old_href)

Merge tuning information - overwrites previous with new - into $old_href and return the HASH ref.

merge_scan_freqs($new_href, $old_href, $verbose)

Merge tuning information - checks to ensure new program info has the best strength, and that new program has all of it's settings

        'pr' => {
              BBC ONE => 
                {
                  pnr => 4171,
                  tsid => 4107,
                  lcn => 1,
                  ...
                },
             $chan => ...
        },
        'lcn' => { 
              4107 => {
                4171 => {
                          service_type => 2,   
                                  visible => 1,            
                          lcn => 46,               
                          ...
                        },
                },
                
             $tsid => {
                $pnr => ...
             }
        },
        'ts' => {
              4107 =>
                { 
                  tsid => 4107,   
                          frequency => 57800000,            
                  strength => 46829,               
                  ...
                },
             $tsid => ..
        },
        'freqs' => {
              57800000 =>
                { 
                  strength => 46829,               
                  snr => bbb,               
                  ber => ccc,               
                  ...
                },
              $freq => ...
        },
read_dir($search_path)

Find directory to read from - first readable directory in search path

write_dir($search_path)

Find directory to write to - first writeable directory in search path

TSID config file (dvb-ts) read/write

read_dvb_ts($fname)

Read the transponder settings file of the form:

        [4107]
        name = Oxford/Bexley
        frequency = 578000000
        bandwidth = 8
        modulation = 16
        hierarchy = 0
        code_rate_high = 34
        code_rate_low = 34
        guard_interval = 32
        transmission = 2
        
read_dvb_ts_freqs($fname)

Read the transponder settings file comments section, if present, containing the frequency file information used during the scan. The values are in "VDR" format:

        # VDR freq      bw   fec_hi fec_lo mod   transmission-mode guard-interval hierarchy inversion

For example, the frequency file format:

        # T 578000000 8MHz 2/3    NONE   QAM64 2k                1/32           NONE
        

will be saved as:

        # VDR 578000000 8  23     0      64    2                 32             0                       0
write_dvb_ts($fname, $href)

Write transponder config information

Channels config file (dvb-pr) read/write

read_dvb_pr($fname)

Read dvb-pr - channel information - of the form:

        [4107-4171]
        video = 600
        audio = 601
        audio_details = eng:601 eng:602
        type = 1
        net = BBC
        name = BBC ONE
write_dvb_pr($fname, $href)

Write program config file.

Channel names aliases config file (dvb-aliases) read/write

read_dvb_aliases($fname)

Read dvb-aliases - channel names aliases - of the form:

        FIVE = Channel 5
write_dvb_aliases($fname, $href)

Write channel names aliases config file.