Teletext PFC packet demultiplexer
Low Level Decoding

Functions to decode data transmissions in Teletext Page Function Clear packets (EN 300 708 section 4). More...

## Data Structures

struct | vbi_pfc_block
| One block of data returned by vbi_pfc_demux_cb(). More...

## Typedefs

typedef struct _vbi_pfc_demux | vbi_pfc_demux
| PFC demultiplexer context.
typedef vbi_bool | vbi_pfc_demux_cb(vbi_pfc_demux *dx, void *user_data, const vbi_pfc_block *block)

## Functions

void | vbi_pfc_demux_reset (vbi_pfc_demux *dx) _vbi_nonnull((1))
vbi_bool | vbi_pfc_demux_feed (vbi_pfc_demux *dx, const uint8_t buffer[42])
vbi_bool | vbi_pfc_demux_feed_frame (vbi_pfc_demux *dx, const vbi_sliced *sliced, unsigned int n_lines)
void | vbi_pfc_demux_delete (vbi_pfc_demux *dx)
vbi_pfc_demux * | vbi_pfc_demux_new (vbi_pgno pgno, unsigned int stream, vbi_pfc_demux_cb *callback, void *user_data)

## Detailed Description

Functions to decode data transmissions in Teletext Page Function Clear packets (EN 300 708 section 4).

## Typedef Documentation

## vbi_pfc_demux

typedef struct _vbi_pfc_demux vbi_pfc_demux

PFC demultiplexer context.

The contents of this structure are private.

Call vbi_pfc_demux_new() to allocate a PFC demultiplexer context.

## vbi_pfc_demux_cb

typedef vbi_bool vbi_pfc_demux_cb(vbi_pfc_demux *dx, void *user_data, const vbi_pfc_block *block)

Parameters

  dx | PFC demultiplexer context returned by vbi_pfx_demux_new() and given to vbi_pfc_demux_feed().
  user_data | User pointer given to vbi_pfc_demux_new().
  block | Structure describing the received data block.

Function called by vbi_pfc_demux_feed() when a new data block is available.

Returns
  FALSE on error, will be returned by vbi_pfc_demux_feed().

Bug
  vbi_pfc_demux_feed() returns the user_data pointer as second parameter the block pointer as third parameter, but prior to version 0.2.26 this function incorrectly defined block as second and user_data as third parameter.

## Function Documentation

## vbi_pfc_demux_reset()

void vbi_pfc_demux_reset | ( | vbi_pfc_demux * | dx | ) |

extern

Parameters

  dx | PFC demultiplexer context allocated with vbi_pfc_demux_new().

Resets the PFC demux context, useful for example after a channel change.

References vbi_pfc_block::application_id, _vbi_pfc_demux::bi, _vbi_pfc_demux::ci, _vbi_pfc_demux::left, _vbi_pfc_demux::n_packets, and _vbi_pfc_demux::packet.

Referenced by vbi_pfc_demux_feed().

## vbi_pfc_demux_feed()

vbi_bool vbi_pfc_demux_feed | ( | vbi_pfc_demux * | dx,
|  | const uint8_t | buffer[42] )

extern

Parameters

  dx | PFC demultiplexer context allocated with vbi_pfc_demux_new().
  buffer | Teletext packet (last 42 bytes, i. e. without clock run-in and framing code), as in struct vbi_sliced.

This function takes a raw stream of Teletext packets, filters out the page and stream requested with vbi_pfc_demux_new() and assembles the data transmitted in this page in a buffer. When a data block is complete it calls the output function given to vbi_pfc_demux_new().

Returns
  FALSE if the packet contained uncorrectable errors.

References _vbi_pfc_demux::ci, _vbi_pfc_demux::n_packets, _vbi_pfc_demux::packet, vbi_pfc_block::pgno, vbi_pfc_block::stream, vbi_pfc_demux_reset(), and vbi_unham16p().

Referenced by vbi_pfc_demux_feed_frame().

## vbi_pfc_demux_feed_frame()

vbi_bool vbi_pfc_demux_feed_frame | ( | vbi_pfc_demux * | dx,
|  | const vbi_sliced * | sliced,
|  | unsigned int | n_lines )

extern

Parameters

  dx | PFC demultiplexer context allocated with vbi_pfc_demux_new().
  sliced | Sliced VBI data.
  n_lines | Number of lines in the sliced array.

This function works like vbi_pfc_demux_feed() but operates on sliced VBI data and filters out `VBI_SLICED_TELETEXT_B_625`.

Returns
  FALSE if any Teletext lines contained uncorrectable errors.

Since
  0.2.26

References vbi_sliced::data, vbi_sliced::id, and vbi_pfc_demux_feed().

## vbi_pfc_demux_delete()

void vbi_pfc_demux_delete | ( | vbi_pfc_demux * | dx | ) |

extern

Parameters

  dx | PFC demultiplexer context allocated with vbi_pfc_demux_new(), can be `NULL`.

Frees all resources associated with dx.

## vbi_pfc_demux_new()

vbi_pfc_demux * vbi_pfc_demux_new | ( | vbi_pgno | pgno,
|  | unsigned int | stream,
|  | vbi_pfc_demux_cb * | callback,
|  | void * | user_data )

extern

Parameters

  pgno | Page to take PFC data from.
  stream | PFC stream to be demultiplexed.
  callback | Function to be called by vbi_pfc_demux_feed() when a new data block is available.
  user_data | User pointer passed through to cb function.

Allocates a new Page Function Clear (ETS 300 708 section 4) demultiplexer.

Returns
  Pointer to newly allocated PFC demux context which must be freed with vbi_pfc_demux_delete() when done. `NULL` on failure (out of memory).