ZVBI Library  0.2.33
Typedefs | Functions
DVB VBI demultiplexer
Low Level Decoding

Extracting VBI data from a DVB PES or TS stream. More...

Typedefs

typedef struct _vbi_dvb_demux vbi_dvb_demux
 DVB VBI demultiplexer.
typedef vbi_bool vbi_dvb_demux_cb (vbi_dvb_demux *dx, void *user_data, const vbi_sliced *sliced, unsigned int sliced_lines, int64_t pts)

Functions

void vbi_dvb_demux_reset (vbi_dvb_demux *dx)
 Resets DVB VBI demux.
unsigned int vbi_dvb_demux_cor (vbi_dvb_demux *dx, vbi_sliced *sliced, unsigned int sliced_lines, int64_t *pts, const uint8_t **buffer, unsigned int *buffer_left)
 DVB VBI demux coroutine.
vbi_bool vbi_dvb_demux_feed (vbi_dvb_demux *dx, const uint8_t *buffer, unsigned int buffer_size)
 Feeds DVB VBI demux with data.
void vbi_dvb_demux_set_log_fn (vbi_dvb_demux *dx, vbi_log_mask mask, vbi_log_fn *log_fn, void *user_data)
void vbi_dvb_demux_delete (vbi_dvb_demux *dx)
 Deletes DVB VBI demux.
vbi_dvb_demuxvbi_dvb_pes_demux_new (vbi_dvb_demux_cb *callback, void *user_data)
 Allocates DVB VBI demux.

Detailed Description

Extracting VBI data from a DVB PES or TS stream.

These functions extract raw and/or sliced VBI data from a DVB Packetized Elementary Stream or Transport Stream as defined in EN 300 472 "Digital Video Broadcasting (DVB); Specification for conveying ITU-R System B Teletext in DVB bitstreams" and EN 301 775 "Digital Video Broadcasting (DVB); Specification for the carriage of Vertical Blanking Information (VBI) data in DVB bitstreams".

Note EN 300 468 "Specification for Service Information (SI) in DVB systems" defines another method to transmit VPS data in DVB streams. Libzvbi does not provide functions to decode SI tables but the vbi_decode_dvb_pdc_descriptor() function is available to convert a PDC descriptor to a VPS PIL.


Typedef Documentation

typedef struct _vbi_dvb_demux vbi_dvb_demux

DVB VBI demultiplexer.

The contents of this structure are private. Call vbi_dvb_pes_demux_new() to allocate a DVB demultiplexer.

typedef vbi_bool vbi_dvb_demux_cb(vbi_dvb_demux *dx, void *user_data, const vbi_sliced *sliced, unsigned int sliced_lines, int64_t pts)
Parameters:
dxDVB demultiplexer context allocated with vbi_dvb_pes_demux_new().
user_dataUser data pointer given to vbi_dvb_pes_demux_new().
slicedPointer to demultiplexed sliced data.
sliced_linesNumber of lines in the sliced array.
ptsPresentation Time Stamp associated with the first sliced line.

The vbi_dvb_demux_feed() function calls a function of this type when a new frame of sliced data is complete.


Function Documentation

void vbi_dvb_demux_reset ( vbi_dvb_demux dx)

Resets DVB VBI demux.

Parameters:
dxDVB demultiplexer context allocated with vbi_dvb_pes_demux_new().

Resets the DVB demux to the initial state as after vbi_dvb_pes_demux_new(), useful for example after a channel change.

Since:
0.2.10
unsigned int vbi_dvb_demux_cor ( vbi_dvb_demux dx,
vbi_sliced sliced,
unsigned int  max_lines,
int64_t *  pts,
const uint8_t **  buffer,
unsigned int *  buffer_left 
)

DVB VBI demux coroutine.

Parameters:
dxDVB demultiplexer context allocated with vbi_dvb_pes_demux_new().
slicedDemultiplexed sliced data will be stored here.
max_linesAt most this number of sliced lines will be stored at sliced.
ptsIf not NULL the Presentation Time Stamp associated with the first line of the demultiplexed frame will be stored here.
buffer*buffer points to DVB PES data, will be incremented by the number of bytes read from the buffer. This pointer need not align with packet boundaries.
buffer_left*buffer_left is the number of bytes left in buffer, will be decremented by the number of bytes read. *buffer_left need not align with packet size. The packet filter works faster with larger buffers. When you read from an MPEG file, mapping the file into memory and passing pointers to the mapped data will be fastest.

This function consumes an arbitrary number of bytes from a DVB Packetized Elementary Stream (PES), filters out PRIVATE_STREAM_1 PES packets, filters out valid VBI data units, converts them to vbi_sliced format and stores the sliced data at sliced.

You must not call this function when you passed a callback function to vbi_dvb_pes_demux_new(). Call vbi_dvb_demux_feed() instead.

Returns:
When a frame is complete, the function returns the number of elements stored in the sliced array. When more data is needed (*buffer_left is zero) or an error occurred it returns the value zero.
Bug:
Demultiplexing of raw VBI data is not supported yet, raw data will be discarded.
Since:
0.2.10
vbi_bool vbi_dvb_demux_feed ( vbi_dvb_demux dx,
const uint8_t *  buffer,
unsigned int  buffer_size 
)

Feeds DVB VBI demux with data.

Parameters:
dxDVB demultiplexer context allocated with vbi_dvb_pes_demux_new().
bufferDVB PES data, need not align with packet boundaries.
buffer_sizeNumber of bytes in buffer, need not align with packet size. The packet filter works faster with larger buffers.

This function consumes and arbitrary number of bytes from a DVB Packetized Elementary Stream (PES), filters out PRIVATE_STREAM_1 PES packets, filters out valid VBI data units, converts them to vbi_sliced format and calls the vbi_dvb_demux_cb function given to vbi_dvb_pes_demux_new() when a new frame is complete.

Returns:
FALSE if the data contained errors.
Bug:
Demultiplexing of raw VBI data is not supported yet, raw data will be discarded.
Since:
0.2.10
void vbi_dvb_demux_set_log_fn ( vbi_dvb_demux dx,
vbi_log_mask  mask,
vbi_log_fn *  log_fn,
void *  user_data 
)
Parameters:
dxDVB demultiplexer context allocated with vbi_dvb_pes_demux_new().
maskWhich kind of information to log. Can be 0.
log_fnThis function is called with log messages. Consider vbi_log_on_stderr(). Can be NULL to disable logging.
user_dataUser pointer passed through to the log_fn function.

The DVB demultiplexer supports the logging of errors in the PES stream and information useful to debug the demultiplexer.

With this function you can redirect log messages generated by this module which would normally go to the global log function (see vbi_set_log_fn()), or enable logging only in the DVB demultiplexer dx.

Note:
The log messages may change in the future.
Since:
0.2.22
void vbi_dvb_demux_delete ( vbi_dvb_demux dx)

Deletes DVB VBI demux.

Parameters:
dxDVB demultiplexer context allocated with vbi_dvb_pes_demux_new(), can be NULL.

Frees all resources associated with dx.

Since:
0.2.10
vbi_dvb_demux* vbi_dvb_pes_demux_new ( vbi_dvb_demux_cb callback,
void *  user_data 
)

Allocates DVB VBI demux.

Parameters:
callbackFunction to be called by vbi_dvb_demux_feed() when a new frame is available. If you want to use the vbi_dvb_demux_cor() function instead, callback must be NULL. Conversely you must not call vbi_dvb_demux_cor() if a callback is given.
user_dataUser pointer passed through to callback function.

Allocates a new DVB VBI (EN 301 472, EN 301 775) demultiplexer taking a PES stream as input.

Returns:
Pointer to newly allocated DVB demux context which must be freed with vbi_dvb_demux_delete() when done. NULL on failure (out of memory).
Since:
0.2.10