Teletext Packet 8/30 Decoder
Low Level Decoding

Functions to decode Teletext packet 8/30 (ETS 300 706). More...

## Functions

vbi_bool | vbi_decode_teletext_8301_cni (unsigned int *cni, const uint8_t buffer[42])
vbi_bool | vbi_decode_teletext_8301_local_time (time_t *utc_time, int *seconds_east, const uint8_t buffer[42])
vbi_bool | vbi_decode_teletext_8302_cni (unsigned int *cni, const uint8_t buffer[42])
vbi_bool | vbi_decode_teletext_8302_pdc (vbi_program_id *pid, const uint8_t buffer[42])

## Detailed Description

Functions to decode Teletext packet 8/30 (ETS 300 706).

Teletext pages are transmitted in packets numbered 0 to 31. Packet 0 to 25 contain the text of the page, packet 26 to 29 additional information like Fastext links. Packet 30 and 31 are reserved for data transmissions unrelated to any page. Since each packet contains a magazine number 1 to 8 (the first digit of the Teletext page number) 16 logical channels can be distinguished. Packet 30 with magazine number 8 carries a Country and Network Identifier, and either a local time (format 1) or PDC label (format 2).

These are low level functions. See test/decode.c for a usage example.

The vbi_decoder module can decode a full Teletext signal and provide the information transmitted in packet 8/30 as `VBI_EVENT_NETWORK`, `VBI_EVENT_NETWORK_ID`, `VBI_EVENT_LOCAL_TIME` and `VBI_EVENT_PROG_ID`. See examples/network.c and examples/pdc1.c.

## Function Documentation

## vbi_decode_teletext_8301_cni()

vbi_bool vbi_decode_teletext_8301_cni | ( | unsigned int * | cni,
|  | const uint8_t | buffer[42] )

extern

Parameters

  cni | CNI of type VBI_CNI_TYPE_8301 will be stored here.
  buffer | Teletext packet as defined for `VBI_SLICED_TELETEXT_B`, i.e. 42 bytes without clock run-in and framing code.

Decodes a Teletext packet 8/30 format 1 according to ETS 300 706 section 9.8.1, returning the contained 16 bit Country and Network Identifier in *cni.

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.34

References vbi_rev16p().

## vbi_decode_teletext_8301_local_time()

vbi_bool vbi_decode_teletext_8301_local_time | ( | time_t * | time,
|  | int * | seconds_east,
|  | const uint8_t | buffer[42] )

extern

Parameters

  time | The current time in seconds since 1970-01-01 00:00 UTC will be stored here.
  seconds_east | The offset of the local time of the intended audience of the program in seconds east of UTC will be stored here, including a daylight-saving time offset if daylight-saving is currently in effect in that time zone. To get the local time of the intended audience add seconds_east to time.
  buffer | Teletext packet as defined for `VBI_SLICED_TELETEXT_B`, i.e. 42 bytes without clock run-in and framing code.

Decodes a Teletext packet 8/30 format 1 according to ETS 300 706 section 9.8.1, returning the current time in the UTC time zone and the time zone of the intended audience of the program.

Returns
  On error the function returns `FALSE:`
  - The buffer contains uncorrectable errors or
  - The time is not representable as a time_t. In these cases *time and *seconds_east remain unchanged.

Since
  0.2.34

References vbi_is_bcd().

## vbi_decode_teletext_8302_cni()

vbi_bool vbi_decode_teletext_8302_cni | ( | unsigned int * | cni,
|  | const uint8_t | buffer[42] )

extern

Parameters

  cni | CNI of type VBI_CNI_TYPE_8302 will be stored here.
  buffer | Teletext packet as defined for `VBI_SLICED_TELETEXT_B`, i.e. 42 bytes without clock run-in and framing code.

Decodes a Teletext packet 8/30 format 2 according to ETS 300 706 section 9.8.2, returning the contained 16 bit Country and Network Identifier in *cni.

Returns
  `FALSE` if the buffer contains uncorrectable errors. In this case *cni remains unchanged.

Since
  0.2.34

References vbi_rev8(), and vbi_unham16p().

## vbi_decode_teletext_8302_pdc()

vbi_bool vbi_decode_teletext_8302_pdc | ( | vbi_program_id * | pid,
|  | const uint8_t | buffer[42] )

extern

Parameters

  pid | PDC program ID will be stored here.
  buffer | Teletext packet as defined for `VBI_SLICED_TELETEXT_B`, i.e. 42 bytes without clock run-in and framing code.

Decodes a Teletext packet 8/30 format 2 according to ETS 300 231, and stores the contained PDC recording-control data in *pid.

Returns
  `FALSE` if the buffer contains uncorrectable errors or invalid data. In this case *pid remains unchanged.

Since
  0.2.34

References vbi_program_id::channel, vbi_program_id::cni, vbi_program_id::cni_type, vbi_program_id::luf, vbi_program_id::mi, vbi_program_id::pcs_audio, vbi_program_id::pil, vbi_program_id::prf, vbi_program_id::pty, VBI_PID_CHANNEL_LCI_0, vbi_rev8(), vbi_unham16p(), and vbi_unham8().