VBI capture device interface
Raw VBI

Platform independent interface to VBI capture device drivers. More...

## Functions

void | vbi_capture_sim_add_noise (vbi_capture *cap, unsigned int min_freq, unsigned int max_freq, unsigned int amplitude)
vbi_bool | vbi_capture_sim_load_caption (vbi_capture *cap, const char *stream, vbi_bool append)
void | vbi_capture_sim_decode_raw (vbi_capture *cap, vbi_bool enable)
vbi_capture * | vbi_capture_sim_new (int scanning, unsigned int *services, vbi_bool interlaced, vbi_bool synchronous)
vbi_capture * | vbi_capture_proxy_new (struct vbi_proxy_client *p_proxy_client, int buffers, int scanning, unsigned int *p_services, int strict, char **pp_errorstr)

## Detailed Description

Platform independent interface to VBI capture device drivers.

## Function Documentation

## vbi_capture_sim_add_noise()

void vbi_capture_sim_add_noise | ( | vbi_capture * | cap,
|  | unsigned int | min_freq,
|  | unsigned int | max_freq,
|  | unsigned int | amplitude )

extern

Parameters

  cap | Initialized vbi_capture context opened with vbi_capture_sim_new().
  min_freq | Minimum frequency of the noise in Hz.
  max_freq | Maximum frequency of the noise in Hz. min_freq and max_freq define the cut off frequency at the half power points (gain -3 dB).
  amplitude | Maximum amplitude of the noise, should lie in range 0 to 256.

This function shapes the white noise to be added to simulated raw VBI data. By default no noise is added. To disable the noise set amplitude to zero.

To produce realistic noise min_freq = 0, max_freq = 5e6 and amplitude = 20 to 50 seems appropriate.

Since
  0.2.26

## vbi_capture_sim_decode_raw()

void vbi_capture_sim_decode_raw | ( | vbi_capture * | cap,
|  | vbi_bool | enable )

extern

Parameters

  cap | Initialized vbi_capture context opened with vbi_capture_sim_new().
  enable | `TRUE` to enable decoding of the simulated raw VBI data.

By default this module generates sliced VBI data and converts it to raw VBI data, returning both through the read functions. With this function you can enable decoding of the raw VBI data back to sliced VBI data, which is mainly interesting to test the libzvbi bit slicer and raw VBI decoder.

Since
  0.2.22

## vbi_capture_sim_new()

vbi_capture * vbi_capture_sim_new | ( | int | scanning,
|  | unsigned int * | services,
|  | vbi_bool | interlaced,
|  | vbi_bool | synchronous )

extern

Parameters

  scanning | Whether to simulate a device receiving PAL/SECAM (value 625) or NTSC (525) video.
  services | This parameter must point to a set of VBI_SLICED_ symbols describing the data services to be simulated. On return the services actually simulated will be stored here. Currently Teletext System B, VPS, PAL WSS and PAL/NTSC Closed Caption are supported.
  interlaced | If `TRUE` the simulated raw VBI images will be interlaced like video images. Otherwise they will contain fields in sequential order, the first field at the top. Usually real devices provide sequential images.
  synchronous | If `FALSE` raw VBI images will be delayed by one field (putting a bottom field first in raw VBI images), simulating defective hardware. The interlaced and synchronous parameters correspond to fields in struct vbi_raw_decoder.

This function opens a simulated VBI device providing raw and sliced VBI data. It can be used to test applications in absence of a real device.

The VBI data is valid but limited. Just one Teletext page and one line of roll-up caption. The WSS and VPS data is set to defaults, the VPS contains no CNI.

Note
  The simulation does not run in real time. Reading from the simulated device will return data immediately.

Returns
  Initialized vbi_capture context, `NULL` on failure (out of memory).

Since
  0.2.22

## vbi_capture_proxy_new()

vbi_capture * vbi_capture_proxy_new | ( | struct vbi_proxy_client * | p_proxy_client,
|  | int | buffers,
|  | int | scanning,
|  | unsigned int * | p_services,
|  | int | strict,
|  | char ** | pp_errorstr )

Parameters

  p_proxy_client | Reference to an initialized proxy client context.
  buffers | Number of intermediate buffers on server side of the proxy socket connection. (Note this is not related to the device buffer count parameter of v4l2_new et.al.)
  scanning | This indicates the current norm: 625 for PAL and 525 for NTSC; set to 0 if you don't know (you should not attempt to query the device for the norm, as this parameter is only required for v4l1 drivers which don't support video standard query ioctls)

  p_services

  This must point to a set of VBI_SLICED_ symbols describing the data services to be decoded. On return the services actually decodable will be stored here. See vbi_raw_decoder_add() for details. If you want to capture raw data only, set to `VBI_SLICED_VBI_525`, `VBI_SLICED_VBI_625` or both. If this parameter is `NULL`, no services will be installed. You can do so later with vbi_capture_update_services(); note the reset parameter must be set to `TRUE` in this case.

  strict | Will be passed to vbi_raw_decoder_add().
  pp_errorstr | If not `NULL` this function stores a pointer to an error description here. You must free() this string when no longer needed.

Open a new connection to a VBI proxy to open a VBI device for the given services. On side of the proxy daemon, one of the regular capture context creation functions (e.g. v4l2_new) is invoked. If the creation succeeds, and any of the requested services are available, capturing is started and all captured data is forwarded transparently to the client.

Whenever possible the proxy should be used instead of opening the device directly, since it allows the user to start multiple VBI clients in parallel. When this function fails (usually because the user hasn't started the proxy daemon) applications should automatically fall back to opening the device directly.

Returns
  Initialized vbi_capture context, `NULL` on failure.

Since
  0.2.9