libdvbv5  1.11.0
Library to work with Digital TV devices on Linux
Channel and transponder file read/write

Files

file  dvb-file.h
 Provides interfaces to deal with DVB channel and program files.
 

Data Structures

struct  dvb_elementary_pid
 associates an elementary stream type with its PID More...
 
struct  dvb_entry
 Represents one entry on a DTV file. More...
 
struct  dvb_parse_table
 Describes the fields to parse on a file. More...
 
struct  dvb_parse_struct
 Describes the format to parse an specific delivery system. More...
 

Enumerations

enum  dvb_file_formats {
  FILE_UNKNOWN, FILE_ZAP, FILE_CHANNEL, FILE_DVBV5,
  FILE_VDR
}
 Known file formats. More...
 

Functions

static void dvb_file_free (struct dvb_file *dvb_file)
 Deallocates memory associated with a struct dvb_file. More...
 
struct dvb_filedvb_read_file (const char *fname)
 Read a file at libdvbv5 format. More...
 
int dvb_write_file (const char *fname, struct dvb_file *dvb_file)
 Write a file at libdvbv5 format. More...
 
struct dvb_filedvb_read_file_format (const char *fname, uint32_t delsys, enum dvb_file_formats format)
 Read a file on any format natively supported by the library. More...
 
int dvb_write_file_format (const char *fname, struct dvb_file *dvb_file, uint32_t delsys, enum dvb_file_formats format)
 Write a file on any format natively supported by the library. More...
 
int dvb_store_entry_prop (struct dvb_entry *entry, uint32_t cmd, uint32_t value)
 Stores a key/value pair on a DVB file entry. More...
 
int dvb_retrieve_entry_prop (struct dvb_entry *entry, uint32_t cmd, uint32_t *value)
 Retrieves the value associated witha key on a DVB file entry. More...
 
int dvb_store_channel (struct dvb_file **dvb_file, struct dvb_v5_fe_parms *parms, struct dvb_v5_descriptors *dvb_desc, int get_detected, int get_nit)
 stored a new scanned channel into a dvb_file struct More...
 
int dvb_parse_delsys (const char *name)
 Ancillary function that seeks for a delivery system. More...
 
enum dvb_file_formats dvb_parse_format (const char *name)
 Ancillary function that parses the name of a file format. More...
 
struct dvb_filedvb_parse_format_oneline (const char *fname, uint32_t delsys, const struct dvb_parse_file *parse_file)
 Read and parses a one line file format. More...
 
int dvb_write_format_oneline (const char *fname, struct dvb_file *dvb_file, uint32_t delsys, const struct dvb_parse_file *parse_file)
 Writes a file into an one line file format. More...
 
int dvb_write_format_vdr (const char *fname, struct dvb_file *dvb_file)
 Writes a file into vdr format (compatible up to version 2.1) More...
 

Variables

const struct dvb_parse_file channel_file_format
 File format definitions for dvb-apps channel format. More...
 
const struct dvb_parse_file channel_file_zap_format
 File format definitions for dvb-apps zap format. More...
 

Detailed Description

Enumeration Type Documentation

Known file formats.

Please notice that the channel format defined here has a few optional fields that aren't part of the dvb-apps format, for DVB-S2 and for DVB-T2. They're there to match the formats found at dtv-scan-tables package up to September, 5 2014.

Enumerator
FILE_UNKNOWN 

File format is unknown.

FILE_ZAP 

File is at the dvb-apps "dvbzap" format.

FILE_CHANNEL 

File is at the dvb-apps output format for dvb-zap.

FILE_DVBV5 

File is at libdvbv5 format.

FILE_VDR 

File is at DVR format (as supported on version 2.1.6).

Note: this is only supported as an output format.

Definition at line 228 of file dvb-file.h.

Function Documentation

static void dvb_file_free ( struct dvb_file dvb_file)
inlinestatic

Deallocates memory associated with a struct dvb_file.

Parameters
dvb_filedvb_file struct to be deallocated

This function assumes that several functions were dynamically allocated by the library file functions.

Examples:
dvb-format-convert.c, dvbv5-scan.c, and dvbv5-zap.c.

Definition at line 251 of file dvb-file.h.

References dvb_entry::audio_pid, dvb_entry::channel, dvb_file::first_entry, dvb_entry::lnb, dvb_entry::location, dvb_entry::next, dvb_entry::other_el_pid, dvb_entry::vchannel, and dvb_entry::video_pid.

int dvb_parse_delsys ( const char *  name)

Ancillary function that seeks for a delivery system.

Parameters
namestring containing the name of the Delivery System to seek

If the name is found, this function returns the DVBv5 property that corresponds to the string given. The function is case-insensitive, and it can check for alternate ways to write the name of a Delivery System. Currently, it supports: DVB-C, DVB-H, DVB-S, DVB-S2, DVB-T, DVB-T2, ISDB-C, ISDB-S, ISDB-T, ATSC-MH, DVBC/ANNEX_A, DVBC/ANNEX_B, DVBT, DSS, DVBS, DVBS2, DVBH, ISDBT, ISDBS, ISDBC, ATSC, ATSCMH, DTMB, CMMB, DAB, DVBT2, TURBO, DVBC/ANNEX_C. Please notice that this doesn't mean that all those standards are properly supported by the library.

Returns
Returns the Delivery System property number if success, -1 if error.
Examples:
dvb-fe-tool.c, and dvb-format-convert.c.
enum dvb_file_formats dvb_parse_format ( const char *  name)

Ancillary function that parses the name of a file format.

Parameters
namestring containing the name of the format Current valid names are: ZAP, CHANNEL, VDR and DVBV5. The name is case-insensitive.
Returns
It returns FILE_ZAP, FILE_CHANNEL, FILE_VDR or FILE_DVBV5 if the name was translated. FILE_UNKNOWN otherwise.
Examples:
dvb-format-convert.c, dvbv5-scan.c, and dvbv5-zap.c.
struct dvb_file* dvb_parse_format_oneline ( const char *  fname,
uint32_t  delsys,
const struct dvb_parse_file parse_file 
)

Read and parses a one line file format.

Parameters
fnamefile name
delsysdelivery system
parse_filepointer struct dvb_parse_file
Returns
It a pointer to struct dvb_file on success, NULL otherwise.

This function is called internally by dvb_read_file_format.

struct dvb_file* dvb_read_file ( const char *  fname)

Read a file at libdvbv5 format.

Parameters
fnamefile name
Returns
It returns a pointer to struct dvb_file describing the entries that were read from the file. If it fails, NULL is returned.
struct dvb_file* dvb_read_file_format ( const char *  fname,
uint32_t  delsys,
enum dvb_file_formats  format 
)

Read a file on any format natively supported by the library.

Parameters
fnamefile name
delsysDelivery system, as specified by enum fe_delivery_system
formatName of the format to be read
Returns
It returns a pointer to struct dvb_file describing the entries that were read from the file. If it fails, NULL is returned.
Examples:
dvb-format-convert.c, dvbv5-scan.c, and dvbv5-zap.c.
int dvb_retrieve_entry_prop ( struct dvb_entry entry,
uint32_t  cmd,
uint32_t *  value 
)

Retrieves the value associated witha key on a DVB file entry.

Parameters
entryentry to be used
cmdkey for the property to be found. It be one of the DVBv5 properties, plus the libdvbv5 ones, as defined at dvb-v5-std.h
valuepointer to store the value associated with the property.

This function seeks for a property with the name specified by cmd and fills value with its contents.

Returns
Returns 0 if success, or, -1 if the entry doesn't exist.
Examples:
dvbv5-scan.c, and dvbv5-zap.c.
int dvb_store_channel ( struct dvb_file **  dvb_file,
struct dvb_v5_fe_parms parms,
struct dvb_v5_descriptors dvb_desc,
int  get_detected,
int  get_nit 
)

stored a new scanned channel into a dvb_file struct

Parameters
dvb_filefile struct to be filled
parmsstruct dvb_v5_fe_parms used by libdvbv5 frontend
dvb_descstruct dvb_desc as described at descriptors.h, filled with the descriptors associated with a DVB channel. those descriptors can be filled by calling one of the scan functions defined at dvb-sat.h.
get_detectedif different than zero, uses the frontend parameters obtained from the device driver (such as modulation, FEC, etc)
get_nitif true, uses the parameters obtained from the MPEG-TS NIT table to add newly detected transponders.

This function should be used to store the services found on a scanned transponder. Initially, it copies the same parameters used to set the frontend, that came from a file where the Service ID and Elementary Stream PIDs are unknown. At tuning time, it is common to set the device to tune on auto-detection mode (e. g. using QAM/AUTO, for example, to autodetect the QAM modulation). The libdvbv5's logic will be to check the detected values. So, the modulation might, for example, have changed to QAM/256. In such case, if get_detected is 0, it will store QAM/AUTO at the struct. If get_detected is different than zero, it will store QAM/256. If get_nit is different than zero, and if the MPEG-TS has info about other physical channels/transponders, this function will add newer entries to dvb_file, for it to seek for new transponders. This is very useful especially for DVB-C, where all transponders belong to the same operator. Knowing one frequency is generally enough to get all DVB-C transponders.

Returns
Returns 0 if success, or, -1 if error.
Examples:
dvbv5-scan.c.
int dvb_store_entry_prop ( struct dvb_entry entry,
uint32_t  cmd,
uint32_t  value 
)

Stores a key/value pair on a DVB file entry.

Parameters
entryentry to be filled
cmdkey for the property to be used. It be one of the DVBv5 properties, plus the libdvbv5 ones, as defined at dvb-v5-std.h
valuevalue for the property.

This function seeks for a property with the name specified by cmd and fills it with value. If the entry doesn't exist, it creates a new key.

Returns
Returns 0 if success, or, if the entry has already DTV_MAX_COMMAND properties, it returns -1.
int dvb_write_file ( const char *  fname,
struct dvb_file dvb_file 
)

Write a file at libdvbv5 format.

Parameters
fnamefile name
dvb_filecontents of the file to be written
Returns
It returns zero if success, or a positive error number if it fails.
int dvb_write_file_format ( const char *  fname,
struct dvb_file dvb_file,
uint32_t  delsys,
enum dvb_file_formats  format 
)

Write a file on any format natively supported by the library.

Parameters
fnamefile name
dvb_filecontents of the file to be written
delsysDelivery system, as specified by enum fe_delivery_system
formatName of the format to be read
Returns
It a pointer to struct dvb_file on success, NULL otherwise.
Examples:
dvb-format-convert.c, and dvbv5-scan.c.
int dvb_write_format_oneline ( const char *  fname,
struct dvb_file dvb_file,
uint32_t  delsys,
const struct dvb_parse_file parse_file 
)

Writes a file into an one line file format.

Parameters
fnamefile name
dvb_filecontents of the file to be written
delsysdelivery system
parse_filepointer struct dvb_parse_file
Returns
It returns zero if success, or a positive error number if it fails.

This function is called internally by dvb_write_file_format.

int dvb_write_format_vdr ( const char *  fname,
struct dvb_file dvb_file 
)

Writes a file into vdr format (compatible up to version 2.1)

Parameters
fnamefile name
dvb_filecontents of the file to be written
Returns
It returns zero if success, or a positive error number if it fails.

This function is called internally by dvb_write_file_format.

Variable Documentation

const struct dvb_parse_file channel_file_format

File format definitions for dvb-apps channel format.

const struct dvb_parse_file channel_file_zap_format

File format definitions for dvb-apps zap format.