ZVBI Library
0.2.33
|
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_demux * | vbi_dvb_pes_demux_new (vbi_dvb_demux_cb *callback, void *user_data) |
Allocates DVB VBI demux. |
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 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) |
dx | DVB demultiplexer context allocated with vbi_dvb_pes_demux_new(). |
user_data | User data pointer given to vbi_dvb_pes_demux_new(). |
sliced | Pointer to demultiplexed sliced data. |
sliced_lines | Number of lines in the sliced array. |
pts | Presentation 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.
void vbi_dvb_demux_reset | ( | vbi_dvb_demux * | dx | ) |
Resets DVB VBI demux.
dx | DVB 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.
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.
dx | DVB demultiplexer context allocated with vbi_dvb_pes_demux_new(). |
sliced | Demultiplexed sliced data will be stored here. |
max_lines | At most this number of sliced lines will be stored at sliced. |
pts | If 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.
vbi_bool vbi_dvb_demux_feed | ( | vbi_dvb_demux * | dx, |
const uint8_t * | buffer, | ||
unsigned int | buffer_size | ||
) |
Feeds DVB VBI demux with data.
dx | DVB demultiplexer context allocated with vbi_dvb_pes_demux_new(). |
buffer | DVB PES data, need not align with packet boundaries. |
buffer_size | Number 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.
FALSE
if the data contained errors.void vbi_dvb_demux_set_log_fn | ( | vbi_dvb_demux * | dx, |
vbi_log_mask | mask, | ||
vbi_log_fn * | log_fn, | ||
void * | user_data | ||
) |
dx | DVB demultiplexer context allocated with vbi_dvb_pes_demux_new(). |
mask | Which kind of information to log. Can be 0 . |
log_fn | This function is called with log messages. Consider vbi_log_on_stderr(). Can be NULL to disable logging. |
user_data | User 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.
void vbi_dvb_demux_delete | ( | vbi_dvb_demux * | dx | ) |
Deletes DVB VBI demux.
dx | DVB demultiplexer context allocated with vbi_dvb_pes_demux_new(), can be NULL . |
Frees all resources associated with dx.
vbi_dvb_demux* vbi_dvb_pes_demux_new | ( | vbi_dvb_demux_cb * | callback, |
void * | user_data | ||
) |
Allocates DVB VBI demux.
callback | Function 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_data | User pointer passed through to callback function. |
Allocates a new DVB VBI (EN 301 472, EN 301 775) demultiplexer taking a PES stream as input.
NULL
on failure (out of memory).