libdvbv5 1.24.1 Library to work with Digital TV devices on Linux

Files | Data Structures | Enumerations | Functions | Variables
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_file * | dvb_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_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. 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_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. 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

## ◆ dvb_file_formats

enum dvb_file_formats

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 232 of file dvb-file.h.

## Function Documentation

## ◆ dvb_file_free()

static void dvb_file_free | ( | struct dvb_file * | dvb_file | ) |
| inline static

Deallocates memory associated with a struct dvb_file.

Parameters

  dvb_file | dvb_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 255 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.

## ◆ dvb_parse_delsys()

int dvb_parse_delsys | ( | const char * | name | ) |

Ancillary function that seeks for a delivery system.

Parameters

  name | string 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.

## ◆ dvb_parse_format()

enum dvb_file_formats dvb_parse_format | ( | const char * | name | ) |

Ancillary function that parses the name of a file format.

Parameters

  name | string 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.

## ◆ dvb_parse_format_oneline()

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

  fname | file name
  delsys | delivery system
  parse_file | pointer 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.

## ◆ dvb_read_file()

struct dvb_file * dvb_read_file | ( | const char * | fname | ) |

Read a file at libdvbv5 format.

Parameters

  fname | file 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.

## ◆ dvb_read_file_format()

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

  fname | file name
  delsys | Delivery system, as specified by enum fe_delivery_system
  format | Name 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.

## ◆ dvb_retrieve_entry_prop()

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

  entry | entry to be used
  cmd | key for the property to be found. It be one of the DVBv5 properties, plus the libdvbv5 ones, as defined at dvb-v5-std.h
  value | pointer 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.

## ◆ dvb_store_channel()

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_file | file struct to be filled
  parms | struct dvb_v5_fe_parms used by libdvbv5 frontend
  dvb_desc | struct 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_detected | if different than zero, uses the frontend parameters obtained from the device driver (such as modulation, FEC, etc)
  get_nit | if 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.

## ◆ dvb_store_entry_prop()

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

  entry | entry to be filled
  cmd | key for the property to be used. It be one of the DVBv5 properties, plus the libdvbv5 ones, as defined at dvb-v5-std.h
  value | value 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.

## ◆ dvb_write_file()

int dvb_write_file | ( | const char * | fname,
|  | struct dvb_file * | dvb_file
| ) |  |

Write a file at libdvbv5 format.

Parameters

  fname | file name
  dvb_file | contents of the file to be written

Returns
  It returns zero if success, or a positive error number if it fails.

## ◆ dvb_write_file_format()

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

  fname | file name
  dvb_file | contents of the file to be written
  delsys | Delivery system, as specified by enum fe_delivery_system
  format | Name 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.

## ◆ dvb_write_format_oneline()

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

  fname | file name
  dvb_file | contents of the file to be written
  delsys | delivery system
  parse_file | pointer 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.

## ◆ dvb_write_format_vdr()

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

  fname | file name
  dvb_file | contents 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

## ◆ channel_file_format

const struct dvb_parse_file channel_file_format
| extern

File format definitions for dvb-apps channel format.

## ◆ channel_file_zap_format

const struct dvb_parse_file channel_file_zap_format
| extern

File format definitions for dvb-apps zap format.