libdvbv5 1.26.1
Library to work with Digital TV devices on Linux
Digital TV device enumeration

Files

file  dvb-dev.h
 Provides interfaces to handle Digital TV devices.
 

Data Structures

struct  dvb_dev_list
 Digital TV device node properties. More...
 
struct  dvb_device
 Digital TV list of devices. More...
 

Functions

struct dvb_devicedvb_dev_alloc (void)
 Allocate a struct dvb_device.
 
void dvb_dev_free (struct dvb_device *dvb)
 free a struct dvb_device
 
int dvb_dev_find (struct dvb_device *dvb, dvb_dev_change_t handler, void *user_priv)
 finds all DVB devices on the local machine
 
void dvb_dev_stop_monitor (struct dvb_device *dvb)
 Stop the dvb_dev_find loop.
 
void dvb_dev_set_logpriv (struct dvb_device *dvb, unsigned verbose, dvb_logfunc_priv logfunc, void *logpriv)
 Sets the DVB verbosity and log function with context private data.
 
void dvb_dev_set_log (struct dvb_device *dvb, unsigned verbose, dvb_logfunc logfunc)
 Sets the DVB verbosity and log function.
 
struct dvb_open_descriptordvb_dev_open (struct dvb_device *dvb, const char *sysname, int flags)
 Opens a dvb device.
 
void dvb_dev_close (struct dvb_open_descriptor *open_dev)
 Closes a dvb device.
 
int dvb_dev_get_fd (struct dvb_open_descriptor *open_dev)
 returns fd from a local device This will not work for remote devices.
 
ssize_t dvb_dev_read (struct dvb_open_descriptor *open_dev, void *buf, size_t count)
 read from a dvb demux or dvr file
 
void dvb_dev_dmx_stop (struct dvb_open_descriptor *open_dev)
 Stops the demux filter for a given file descriptor.
 
int dvb_dev_set_bufsize (struct dvb_open_descriptor *open_dev, int buffersize)
 Start a demux or dvr buffer size.
 
int dvb_dev_dmx_set_pesfilter (struct dvb_open_descriptor *open_dev, int pid, dmx_pes_type_t type, dmx_output_t output, int buffersize)
 Start a filter for a MPEG-TS Packetized Elementary Stream (PES)
 
int dvb_dev_dmx_set_section_filter (struct dvb_open_descriptor *open_dev, int pid, unsigned filtsize, unsigned char *filter, unsigned char *mask, unsigned char *mode, unsigned int flags)
 Sets a MPEG-TS section filter.
 
int dvb_dev_dmx_get_pmt_pid (struct dvb_open_descriptor *open_dev, int sid)
 read the contents of the MPEG-TS PAT table, seeking for an specific service ID
 

Detailed Description

Function Documentation

◆ dvb_dev_alloc()

struct dvb_device * dvb_dev_alloc ( void  )

Allocate a struct dvb_device.

Note
Before using the dvb device function calls, the struct dvb_device should be allocated via this function call.
Returns
on success, returns a pointer to the allocated struct dvb_device or NULL if not enough memory to allocate the struct.
Examples
dvb-fe-tool.c, dvbv5-scan.c, and dvbv5-zap.c.

◆ dvb_dev_close()

void dvb_dev_close ( struct dvb_open_descriptor open_dev)

Closes a dvb device.

Parameters
open_devPoints to the struct dvb_open_descriptor to be closed.
Examples
dvbv5-scan.c, and dvbv5-zap.c.

◆ dvb_dev_dmx_get_pmt_pid()

int dvb_dev_dmx_get_pmt_pid ( struct dvb_open_descriptor open_dev,
int  sid 
)

read the contents of the MPEG-TS PAT table, seeking for an specific service ID

Parameters
open_devPoints to the struct dvb_open_descriptor
sidSession ID to seeking
Returns
At return, it returns a negative value if error or the PID associated with the desired Session ID.
Warning
This function currently assumes that the PAT fits into one session.
Note
valid only for DVB_DEVICE_DEMUX.
Examples
dvbv5-zap.c.

◆ dvb_dev_dmx_set_pesfilter()

int dvb_dev_dmx_set_pesfilter ( struct dvb_open_descriptor open_dev,
int  pid,
dmx_pes_type_t  type,
dmx_output_t  output,
int  buffersize 
)

Start a filter for a MPEG-TS Packetized Elementary Stream (PES)

Parameters
open_devPoints to the struct dvb_open_descriptor
pidProgram ID to filter. Use 0x2000 to select all PIDs
typetype of the PID (DMX_PES_VIDEO, DMX_PES_AUDIO, DMX_PES_OTHER, etc).
outputWhere the data will be output (DMX_OUT_TS_TAP, DMX_OUT_DECODER, etc).
buffersizeSize of the buffer to be allocated to store the filtered data.

This is a wrapper function for DMX_SET_PES_FILTER and DMX_SET_BUFFER_SIZE ioctls.

See http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html for more details.

Returns
Retuns zero on success, -1 otherwise.
Note
valid only for DVB_DEVICE_DEMUX.
Examples
dvbv5-zap.c.

◆ dvb_dev_dmx_set_section_filter()

int dvb_dev_dmx_set_section_filter ( struct dvb_open_descriptor open_dev,
int  pid,
unsigned  filtsize,
unsigned char *  filter,
unsigned char *  mask,
unsigned char *  mode,
unsigned int  flags 
)

Sets a MPEG-TS section filter.

Parameters
open_devPoints to the struct dvb_open_descriptor
pidProgram ID to filter. Use 0x2000 to select all PIDs
filtsizeSize of the filter (up to 18 btyes)
filterdata to filter. Can be NULL or should have filtsize length
maskfilter mask. Can be NULL or should have filtsize length
modemode mask. Can be NULL or should have filtsize length
flagsflags for set filter (DMX_CHECK_CRC,DMX_ONESHOT, DMX_IMMEDIATE_START).

This is a wrapper function for DMX_SET_FILTER ioctl.

See http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html for more details.

Returns
Retuns zero on success, -1 otherwise.
Note
valid only for DVB_DEVICE_DEMUX.

◆ dvb_dev_dmx_stop()

void dvb_dev_dmx_stop ( struct dvb_open_descriptor open_dev)

Stops the demux filter for a given file descriptor.

Parameters
open_devPoints to the struct dvb_open_descriptor

This is a wrapper function for DMX_STOP ioctl.

See http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html for more details.

Note
valid only for DVB_DEVICE_DEMUX.

◆ dvb_dev_find()

int dvb_dev_find ( struct dvb_device dvb,
dvb_dev_change_t  handler,
void *  user_priv 
)

finds all DVB devices on the local machine

Parameters
dvbpointer to struct dvb_device to be filled
handlerif not NULL, then this is called whenever something changed monitor mode
user_privpointer to user private data

This routine can be called on two modes: normal or monitor mode

In normal mode, it will seek for the local Digital TV devices, store them at the struct dvb_device and return.

In monitor mode, it will not only enumerate all devices, but it will also keep waiting for device changes. The handler callback is called for the changed device.

Returns
returns 0 on success, a negative value otherwise.
Examples
dvb-fe-tool.c, dvbv5-scan.c, and dvbv5-zap.c.

◆ dvb_dev_free()

void dvb_dev_free ( struct dvb_device dvb)

free a struct dvb_device

Parameters
dvbpointer to struct dvb_device to be freed
Examples
dvb-fe-tool.c, dvbv5-scan.c, and dvbv5-zap.c.

◆ dvb_dev_get_fd()

int dvb_dev_get_fd ( struct dvb_open_descriptor open_dev)

returns fd from a local device This will not work for remote devices.

Parameters
open_devPoints to the struct dvb_open_descriptor
Returns
On success, returns the fd. Returns -1 on error.

◆ dvb_dev_open()

struct dvb_open_descriptor * dvb_dev_open ( struct dvb_device dvb,
const char *  sysname,
int  flags 
)

Opens a dvb device.

Parameters
dvbpointer to struct dvb_device to be used
sysnameKernel's name of the device to be opened, as obtained via dvb_dev_seek_by_adapter() or via dvb_dev_find().
flagsFlags to be passed to open: O_RDONLY, O_RDWR and/or O_NONBLOCK
Note
Please notice that O_NONBLOCK is not supported for frontend devices, and will be silently ignored.
the sysname will only work if a previous call to dvb_dev_find() is issued.

This function is equivalent to open(2) system call: it opens a Digital TV given by the dev parameter, using the flags.

Returns
returns a pointer to the dvb_open_descriptor that should be used on further calls if sucess. NULL otherwise.
Examples
dvb-fe-tool.c, dvbv5-scan.c, and dvbv5-zap.c.

◆ dvb_dev_read()

ssize_t dvb_dev_read ( struct dvb_open_descriptor open_dev,
void *  buf,
size_t  count 
)

read from a dvb demux or dvr file

Parameters
open_devPoints to the struct dvb_open_descriptor to be closed.
bufBuffer to store the data
countnumber of bytes to read
Returns
On success, returns the number of bytes read. Returns -1 on error.
Examples
dvbv5-zap.c.

◆ dvb_dev_set_bufsize()

int dvb_dev_set_bufsize ( struct dvb_open_descriptor open_dev,
int  buffersize 
)

Start a demux or dvr buffer size.

Parameters
open_devPoints to the struct dvb_open_descriptor
buffersizeSize of the buffer to be allocated to store the filtered data.

This is a wrapper function for DMX_SET_BUFFER_SIZE ioctl.

See http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html for more details.

Returns
Retuns zero on success, -1 otherwise.
Note
valid only for DVB_DEVICE_DEMUX or DVB_DEVICE_DVR.
Examples
dvbv5-zap.c.

◆ dvb_dev_set_log()

void dvb_dev_set_log ( struct dvb_device dvb,
unsigned  verbose,
dvb_logfunc  logfunc 
)

Sets the DVB verbosity and log function.

Parameters
dvbpointer to struct dvb_device to be used
verboseVerbosity level of the messages that will be printed
logfuncCallback function to be called when a log event happens. Can either store the event into a file or to print it at the TUI/GUI. Can be null.

Sets the function to report log errors and to set the verbosity level of debug report messages. If not called, or if logfunc is NULL, the libdvbv5 will report error and debug messages via stderr, and will use colors for the debug messages.

Examples
dvb-fe-tool.c, dvbv5-scan.c, and dvbv5-zap.c.

◆ dvb_dev_set_logpriv()

void dvb_dev_set_logpriv ( struct dvb_device dvb,
unsigned  verbose,
dvb_logfunc_priv  logfunc,
void *  logpriv 
)

Sets the DVB verbosity and log function with context private data.

Parameters
dvbpointer to struct dvb_device to be used
verboseVerbosity level of the messages that will be printed
logfuncCallback function to be called when a log event happens. Can either store the event into a file or to print it at the TUI/GUI. Can be null.
logprivPrivate data for log function

Sets the function to report log errors and to set the verbosity level of debug report messages. If not called, or if logfunc is NULL, the libdvbv5 will report error and debug messages via stderr, and will use colors for the debug messages.

◆ dvb_dev_stop_monitor()

void dvb_dev_stop_monitor ( struct dvb_device dvb)

Stop the dvb_dev_find loop.

Parameters
dvbpointer to struct dvb_device to be used

This function stops dvb_dev_find() if it is running in monitor mode. It does nothing on other modes. Can be called even if the monitor mode was already stopped.