libdvbv5  1.11.0
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...
 

Enumerations

enum  dvb_dev_type {
  DVB_DEVICE_FRONTEND, DVB_DEVICE_DEMUX, DVB_DEVICE_DVR, DVB_DEVICE_NET,
  DVB_DEVICE_CA, DVB_DEVICE_CA_SEC
}
 Type of a device entry to search. More...
 

Functions

struct dvb_devicedvb_dev_alloc (void)
 Allocate a struct dvb_device. More...
 
void dvb_dev_free (struct dvb_device *dvb)
 free a struct dvb_device More...
 
int dvb_dev_find (struct dvb_device *dvb, int enable_monitor)
 finds all DVB devices on the local machine More...
 
void dvb_dev_stop_monitor (struct dvb_device *dvb)
 Stop the dvb_dev_find loop. More...
 
void dvb_dev_set_log (struct dvb_device *dvb, unsigned verbose, dvb_logfunc logfunc)
 Sets the DVB verbosity and log function. More...
 
struct dvb_open_descriptordvb_dev_open (struct dvb_device *dvb, char *sysname, int flags)
 Opens a dvb device. More...
 
void dvb_dev_close (struct dvb_open_descriptor *open_dev)
 Closes a dvb device. More...
 
ssize_t dvb_dev_read (struct dvb_open_descriptor *open_dev, void *buf, size_t count)
 read from a dvb demux or dvr file More...
 
void dvb_dev_dmx_stop (struct dvb_open_descriptor *open_dev)
 Stops the demux filter for a given file descriptor. More...
 
int dvb_dev_set_bufsize (struct dvb_open_descriptor *open_dev, int buffersize)
 Start a demux or dvr buffer size. More...
 
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) More...
 
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. More...
 
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 More...
 

Detailed Description

Enumeration Type Documentation

Type of a device entry to search.

Parameters
DVB_DEVICE_FRONTENDDigital TV frontend
DVB_DEVICE_DEMUXDigital TV demux
DVB_DEVICE_DVRDigital TV Digital Video Record
DVB_DEVICE_NETDigital TV network interface control
DVB_DEVICE_CADigital TV Conditional Access
DVB_DEVICE_CA_SECDigital TV Conditional Access serial
Enumerator
DVB_DEVICE_FRONTEND 
DVB_DEVICE_DEMUX 
DVB_DEVICE_DVR 
DVB_DEVICE_NET 
DVB_DEVICE_CA 
DVB_DEVICE_CA_SEC 

Definition at line 58 of file dvb-dev.h.

Function Documentation

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.
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.
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.
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.
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.
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.
int dvb_dev_find ( struct dvb_device dvb,
int  enable_monitor 
)

finds all DVB devices on the local machine

Parameters
dvbpointer to struct dvb_device to be filled
enable_monitorif different than zero put the routine into monitor mode

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 device seek loop will only be interrupted after calling dvb_dev_stop_monitor().

Please notice that, in such mode, the function will wait forever. So, it is up to the application to put start a separate thread to handle it in monitor mode, and add the needed mutexes to make it thread safe.

Returns
returns 0 on success, a negative value otherwise.
Examples:
dvb-fe-tool.c, dvbv5-scan.c, and dvbv5-zap.c.
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.
struct dvb_open_descriptor* dvb_dev_open ( struct dvb_device dvb,
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_sysname().
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.
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.
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.
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.
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.