Video Program System (VPS) Decoder
Low Level Decoding

Functions to decode and encode VPS packets (EN 300 231, EN 300 468). More...

## Functions

vbi_bool | vbi_decode_vps_cni (unsigned int *cni, const uint8_t buffer[13])
vbi_bool | vbi_encode_vps_cni (uint8_t buffer[13], unsigned int cni) _vbi_nonnull((1))
vbi_bool | vbi_decode_vps_pdc (vbi_program_id *pid, const uint8_t buffer[13])
vbi_bool | vbi_encode_vps_pdc (uint8_t buffer[13], const vbi_program_id *pid)
vbi_bool | vbi_decode_dvb_pdc_descriptor (vbi_program_id *pid, const uint8_t buffer[5])
vbi_bool | vbi_encode_dvb_pdc_descriptor (uint8_t buffer[5], const vbi_program_id *pid)

## Detailed Description

Functions to decode and encode VPS packets (EN 300 231, EN 300 468).

## Function Documentation

## vbi_decode_vps_cni()

vbi_bool vbi_decode_vps_cni | ( | unsigned int * | cni,
|  | const uint8_t | buffer[13] )

extern

Parameters

  cni | CNI of type VBI_CNI_TYPE_VPS will be stored here.
  buffer | VPS packet as defined for `VBI_SLICED_VPS`, i.e. 13 bytes without clock run-in and start code.

Decodes a VPS packet according to EN 300 231, returning the contained 12 bit Country and Network Identifier in *cni.

The code 0xDC3 is translated according to TR 101 231: "As this code is used for a time in two networks a distinction for automatic tuning systems is given in data line 16 [VPS]: bit 3 of byte 5 = 1 for the ARD network / = 0 for the ZDF network."

Returns
  Always `TRUE`, no error checking possible. It may be prudent to wait for a second transmission of the received CNI to ensure correct reception.

Since
  0.2.20

Referenced by vbi_decode_vps_pdc().

## vbi_encode_vps_cni()

vbi_bool vbi_encode_vps_cni | ( | uint8_t | buffer[13],
|  | unsigned int | cni )

extern

Parameters

  buffer | VPS packet as defined for `VBI_SLICED_VPS`, i.e. 13 bytes without clock run-in and start code.
  cni | CNI of type VBI_CNI_TYPE_VPS.

Stores the 12 bit Country and Network Identifier cni in a VPS packet according to EN 300 231.

Returns
  `FALSE` if cni is invalid. In this case buffer remains unmodified.

Since
  0.2.20

Referenced by vbi_encode_vps_pdc().

## vbi_decode_vps_pdc()

vbi_bool vbi_decode_vps_pdc | ( | vbi_program_id * | pid,
|  | const uint8_t | buffer[13] )

extern

Parameters

  pid | PDC program ID will be stored here.
  buffer | VPS packet as defined for `VBI_SLICED_VPS`, i.e. 13 bytes without clock run-in and start code.

Decodes a VPS datagram according to EN 300 231, storing PDC recording-control data in pid.

Returns
  `FALSE` if the buffer contains incorrect data. In this case pid remains unmodified.

Since
  0.2.34

References vbi_program_id::channel, vbi_program_id::cni, vbi_program_id::cni_type, vbi_program_id::mi, vbi_program_id::pcs_audio, vbi_program_id::pil, vbi_program_id::pty, vbi_decode_vps_cni(), and VBI_PID_CHANNEL_VPS.

## vbi_encode_vps_pdc()

vbi_bool vbi_encode_vps_pdc | ( | uint8_t | buffer[13],
|  | const vbi_program_id * | pid )

extern

Parameters

  buffer | VPS packet as defined for `VBI_SLICED_VPS`, i.e. 13 bytes without clock run-in and start code.
  pid | PDC data to encode.

Stores PDC recording-control data (CNI, PIL, PCS audio, PTY) in a VPS datagram according to EN 300 231.

Returns
  `FALSE` if any of the parameters to encode are invalid. In this case buffer remains unmodified.

Since
  0.2.34

References vbi_program_id::cni, vbi_program_id::pcs_audio, vbi_program_id::pil, vbi_program_id::pty, and vbi_encode_vps_cni().

## vbi_decode_dvb_pdc_descriptor()

vbi_bool vbi_decode_dvb_pdc_descriptor | ( | vbi_program_id * | pid,
|  | const uint8_t | buffer[5] )

Parameters

  pid | PDC program ID will be stored here.
  buffer | A DVB PDC descriptor as defined in EN 300 468, including the descriptor_tag and descriptor_length bytes.

Decodes a DVB PDC descriptor as defined in EN 300 468 and EN 300 231, storing PDC recording-control data in pid.

Returns
  `FALSE` if the buffer contains an incorrect descriptor_tag, descriptor_length or PIL. In this case pid remains unmodified.

Since
  0.2.34

References vbi_program_id::channel, vbi_program_id::mi, vbi_program_id::pil, and VBI_PID_CHANNEL_PDC_DESCRIPTOR.

## vbi_encode_dvb_pdc_descriptor()

vbi_bool vbi_encode_dvb_pdc_descriptor | ( | uint8_t | buffer[5],
|  | const vbi_program_id * | pid )

Parameters

  buffer | A DVB PDC descriptor as defined in EN 300 468, including the descriptor_tag and descriptor_length bytes.
  pid | PDC data to encode.

Stores PDC recording-control data (PIL only) in a DVB PDC descriptor as defined in EN 300 468 and EN 300 231.

Returns
  `FALSE` if any of the parameters to encode are invalid. In this case buffer remains unmodified.

Since
  0.2.34

References vbi_program_id::pil.