libdvbv5: Ancillary functions and macros

libdvbv5 1.26.0 Library to work with Digital TV devices on Linux

Files | Macros | Functions
Ancillary functions and macros

## Files
file | dvb-log.h
| Provides interfaces to handle libdvbv5 log messages.
file | crc32.h
| Provides ancillary code to calculate DVB crc32 checksum.
file | countries.h
| Provides ancillary code to convert ISO 3166-1 country codes.

## Macros
#define | ARRAY_SIZE(x)
| Calculates the number of elements of an array.

## Functions
void | dvb_default_log (int level, const char *fmt,...)
| This is the prototype of the internal log function that it is used, if the library client doesn't desire to override with something else.
void | atsc_time (const uint32_t start_time, struct tm *tm)
| Converts an ATSC EIT formatted timestamp into struct tm.
uint32_t | dvb_crc32 (uint8_t *data, size_t datalen, uint32_t crc)
| Calculates the crc-32 as defined at the MPEG-TS specs.
enum dvb_country_t | dvb_country_a2_to_id (const char *name)
| Converts an Unix-like 2-letter Country code into enum dvb_country_t.
enum dvb_country_t | dvb_country_a3_to_id (const char *name)
| Converts a 3-letter Country code as used by MPEG-TS tables into enum dvb_country_t.
const char * | dvb_country_to_2letters (int id)
| Converts an enum dvb_country_t into Unix-like 2-letter Country code.
const char * | dvb_country_to_3letters (int id)
| Converts an enum dvb_country_t into a 3-letter Country code as used by MPEG-TS tables.
const char * | dvb_country_to_name (int id)
| Converts an enum dvb_country_t into a Country name as used by MPEG-TS tables.
enum dvb_country_t | dvb_guess_user_country (void)
| Guess the country code from the Unix environment variables.

## Detailed Description

## Macro Definition Documentation

## ◆ ARRAY_SIZE

#define ARRAY_SIZE | ( |  | x | ) |

Calculates the number of elements of an array.

Examples
  dvb-fe-tool.c.

Definition at line 64 of file dvb-fe.h.

## Function Documentation

## ◆ atsc_time()

void atsc_time | ( | const uint32_t | start_time,
|  | struct tm * | tm
| ) |  |

Converts an ATSC EIT formatted timestamp into struct tm.

Parameters

  start_time | event on ATSC EIT time format
  tm | pointer to struct tm where the converted timestamp will be stored.

## ◆ dvb_country_a2_to_id()

enum dvb_country_t dvb_country_a2_to_id | ( | const char * | name | ) |

Converts an Unix-like 2-letter Country code into enum dvb_country_t.

Parameters

  name | two-letter Country code.

Returns
  It returns the corresponding enum dvb_country_t ID. If not found, returns COUNTRY_UNKNOWN.

## ◆ dvb_country_a3_to_id()

enum dvb_country_t dvb_country_a3_to_id | ( | const char * | name | ) |

Converts a 3-letter Country code as used by MPEG-TS tables into enum dvb_country_t.

Parameters

  name | three-letter Country code.

Returns
  It returns the corresponding enum dvb_country_t ID. If not found, returns COUNTRY_UNKNOWN.

## ◆ dvb_country_to_2letters()

const char * dvb_country_to_2letters | ( | int | id | ) |

Converts an enum dvb_country_t into Unix-like 2-letter Country code.

Parameters

  id | enum dvb_country_t ID.

Returns
  It returns the 2-letter country code string that corresponts to the Country. If not found, returns NULL.

## ◆ dvb_country_to_3letters()

const char * dvb_country_to_3letters | ( | int | id | ) |

Converts an enum dvb_country_t into a 3-letter Country code as used by MPEG-TS tables.

Parameters

  id | enum dvb_country_t ID.

Returns
  It returns the 3-letter country code string that corresponts to the Country. If not found, returns NULL.

## ◆ dvb_country_to_name()

const char * dvb_country_to_name | ( | int | id | ) |

Converts an enum dvb_country_t into a Country name as used by MPEG-TS tables.

Parameters

  id | enum dvb_country_t ID.

Returns
  It returns a string with the Country name that corresponts to the country. If not found, returns NULL.

## ◆ dvb_crc32()

uint32_t dvb_crc32 | ( | uint8_t * | data,
|  | size_t | datalen,
|  | uint32_t | crc
| ) |  |

Calculates the crc-32 as defined at the MPEG-TS specs.

Parameters

  data | Pointer to the buffer to be checked
  datalen | Length of the buffer
  crc | Initial value for the crc checksum. To calculate the checksum of the entire packet at once, use 0xFFFFFFFF

## ◆ dvb_default_log()

void dvb_default_log | ( | int | level,
|  | const char * | fmt,
|  |  | ...
| ) |  |

This is the prototype of the internal log function that it is used, if the library client doesn't desire to override with something else.

Parameters

  level | level of the message, as defined at syslog.h
  fmt | format string (same as format string on sprintf)

## ◆ dvb_guess_user_country()

enum dvb_country_t dvb_guess_user_country | ( | void |  | ) |

Guess the country code from the Unix environment variables.

Returns
  It returns the corresponding enum dvb_country_t ID. If not found, returns COUNTRY_UNKNOWN.