Digital television (DVB)
Single-page view · as markdown
Digital TV CA close()
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
Digital TV CA close()
Synopsis #
int Arguments #
-
fdFile descriptor returned by a previous call to
open().
Description #
This system call closes a previously opened CA device.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
Digital TV CA open()
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
Digital TV CA open()
Synopsis #
int Arguments #
-
nameName of specific Digital TV CA device.
-
flagsA bit-wise OR of the following flags:
|
|
read-only access |
|
|
read/write access |
|
|
open in non-blocking mode (blocking mode is the default) |
Description #
This system call opens a named ca device (e.g. /dev/dvb/adapter?/ca?) for subsequent use.
When an open() call has succeeded, the device will be ready for use. The significance of blocking or non-blocking mode is described in the documentation for functions where there is a difference. It does not affect the semantics of the open() call itself. A device opened in blocking mode can later be put into non-blocking mode (and vice versa) using the F_SETFL command of the fcntl system call. This is a standard system call, documented in the Linux manual page for fcntl. Only one user can open the CA Device in O_RDWR mode. All other attempts to open the device in this mode will fail, and an error code will be returned.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
CA_GET_CAP
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
CA_GET_CAP
Synopsis #
int ioctl(fd, CA_GET_CAP, struct ca_caps *caps)
Arguments #
-
fdFile descriptor returned by a previous call to
open(). -
capsPointer to struct
ca_caps.
Description #
Queries the Kernel for information about the available CA and descrambler slots, and their types.
Return Value #
On success 0 is returned and ca_caps is filled.
On error, -1 is returned and the errno variable is set appropriately.
The generic error codes are described at the Generic Error Codes chapter.
CA_GET_DESCR_INFO
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
CA_GET_DESCR_INFO
Synopsis #
int ioctl(fd, CA_GET_DESCR_INFO, struct ca_descr_info *desc)
Arguments #
-
fdFile descriptor returned by a previous call to
open(). -
descPointer to struct
ca_descr_info.
Description #
Returns information about all descrambler slots.
Return Value #
On success 0 is returned, and ca_descr_info is filled.
On error -1 is returned, and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
CA_GET_MSG
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
CA_GET_MSG
Synopsis #
int ioctl(fd, CA_GET_MSG, struct ca_msg *msg)
Arguments #
-
fdFile descriptor returned by a previous call to
open(). -
msgPointer to struct
ca_msg.
Description #
Receives a message via a CI CA module.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
CA_GET_SLOT_INFO
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
CA_GET_SLOT_INFO
Synopsis #
int ioctl(fd, CA_GET_SLOT_INFO, struct ca_slot_info *info)
Arguments #
-
fdFile descriptor returned by a previous call to
open(). -
infoPointer to struct
ca_slot_info.
Description #
Returns information about a CA slot identified by ca_slot_info.slot_num.
Return Value #
On success 0 is returned, and ca_slot_info is filled.
On error -1 is returned, and the errno variable is set appropriately.
|
|
the slot is not available. |
The generic error codes are described at the Generic Error Codes chapter.
CA_RESET
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
CA_RESET
Synopsis #
int ioctl(fd, CA_RESET)
Arguments #
-
fdFile descriptor returned by a previous call to
open().
Description #
Puts the Conditional Access hardware on its initial state. It should be called before start using the CA hardware.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
CA_SEND_MSG
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
CA_SEND_MSG
Synopsis #
int ioctl(fd, CA_SEND_MSG, struct ca_msg *msg)
Arguments #
-
fdFile descriptor returned by a previous call to
open(). -
msgPointer to struct
ca_msg.
Description #
Sends a message via a CI CA module.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
CA_SET_DESCR
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
CA_SET_DESCR
Synopsis #
int ioctl(fd, CA_SET_DESCR, struct ca_descr *desc)
Arguments #
-
fdFile descriptor returned by a previous call to
open(). -
msgPointer to struct
ca_descr.
Description #
CA_SET_DESCR is used for feeding descrambler CA slots with descrambling keys (referred as control words).
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
Digital TV CA Device
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
The Digital TV CA device controls the conditional access hardware. It can be accessed through /dev/dvb/adapter?/ca?. Data types and ioctl definitions can be accessed by including linux/dvb/ca.h in your application.
CA Data Types
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
struct ca_slot_info #
CA slot interface types and info.
Definition
;
Members
num: slot number.type: slot type.flags: flags applicable to the slot.
Description
This struct stores the CA slot information.
type can be:
CA_CI- CI high level interface;CA_CI_LINK- CI link layer level interface;CA_CI_PHYS- CI physical layer level interface;CA_DESCR- built-in descrambler;CA_SC-simple smart card interface.
flags can be:
CA_CI_MODULE_PRESENT- module (or card) inserted;CA_CI_MODULE_READY- module is ready for usage.
struct ca_descr_info #
descrambler types and info.
Definition
;
Members
num: number of available descramblers (keys).type: type of supported scrambling system.
Description
Identifies the number of descramblers and their type.
type can be:
CA_ECD- European Common Descrambler (ECD) hardware;CA_NDS- Videoguard (NDS) hardware;CA_DSS- Distributed Sample Scrambling (DSS) hardware.
struct ca_caps #
CA slot interface capabilities.
Definition
;
Members
slot_num: total number of CA card and module slots.slot_type: bitmap with all supported types as defined atstruct ca_slot_info(e. g.CA_CI,CA_CI_LINK, etc).descr_num: total number of descrambler slots (keys)descr_type: bitmap with all supported types as defined atstruct ca_descr_info(e. g.CA_ECD,CA_NDS, etc).
struct ca_msg #
a message to/from a CI-CAM
Definition
;
Members
index: unusedtype: unusedlength: length of the messagemsg: message
Description
This struct carries a message to be send/received from a CI CA module.
struct ca_descr #
CA descrambler control words info
Definition
;
Members
index: CA Descrambler slotparity: control words parity, where 0 means even and 1 means oddcw: CA Descrambler control words
CA Function Calls
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
The High level CI API
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
This document describes the high level CI API as in accordance to the Linux DVB API.
With the High Level CI approach any new card with almost any random architecture can be implemented with this style, the definitions inside the switch statement can be easily adapted for any card, thereby eliminating the need for any additional ioctls.
The disadvantage is that the driver/hardware has to manage the rest. For the application programmer it would be as simple as sending/receiving an array to/from the CI ioctls as defined in the Linux DVB API. No changes have been made in the API to accommodate this feature.
Why the need for another CI interface? #
This is one of the most commonly asked question. Well a nice question. Strictly speaking this is not a new interface.
The CI interface is defined in the DVB API in ca.h as:
typedef struct ca_slot_info ca_slot_info_t;
This CI interface follows the CI high level interface, which is not implemented by most applications. Hence this area is revisited.
This CI interface is quite different in the case that it tries to accommodate all other CI based devices, that fall into the other categories.
This means that this CI interface handles the EN50221 style tags in the Application layer only and no session management is taken care of by the application. The driver/hardware will take care of all that.
This interface is purely an EN50221 interface exchanging APDU's. This means that no session management, link layer or a transport layer do exist in this case in the application to driver communication. It is as simple as that. The driver/hardware has to take care of that.
With this High Level CI interface, the interface can be defined with the regular ioctls.
All these ioctls are also valid for the High level CI interface
#define CA_RESET _IO('o', 128) #define CA_GET_CAP _IOR('o', 129, ca_caps_t) #define CA_GET_SLOT_INFO _IOR('o', 130, ca_slot_info_t) #define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t) #define CA_GET_MSG _IOR('o', 132, ca_msg_t) #define CA_SEND_MSG _IOW('o', 133, ca_msg_t) #define CA_SET_DESCR _IOW('o', 134, ca_descr_t)
On querying the device, the device yields information thus:
CA_GET_SLOT_INFO
----------------------------
Command = [info]
APP: Number=[1]
APP: Type=[1]
APP: flags=[1]
APP: CI High level interface
APP: CA/CI Module Present
CA_GET_CAP
----------------------------
Command = [caps]
APP: Slots=[1]
APP: Type=[1]
APP: Descrambler keys=[16]
APP: Type=[1]
CA_SEND_MSG
----------------------------
Descriptors(Program Level)=[ 09 06 06 04 05 50 ff f1]
Found CA descriptor @ program level
(20) ES type=[2] ES pid=[201] ES length =[0 (0x0)]
(25) ES type=[4] ES pid=[301] ES length =[0 (0x0)]
ca_message length is 25 (0x19) bytes
EN50221 CA MSG=[ 9f 80 32 19 03 01 2d d1 f0 08 01 09 06 06 04 05 50 ff f1 02 e0 c9 00 00 04 e1 2d 00 00]
Not all ioctl's are implemented in the driver from the API, the other features of the hardware that cannot be implemented by the API are achieved using the CA_GET_MSG and CA_SEND_MSG ioctls. An EN50221 style wrapper is used to exchange the data to maintain compatibility with other hardware.
/* a message to/from a CI-CAM */
typedef struct ca_msg ca_msg_t;
The flow of data can be described thus,
App (User)
-----
parse
|
|
v
en50221 APDU (package)
--------------------------------------
| | | High Level CI driver
| | |
| v |
| en50221 APDU (unpackage) |
| | |
| | |
| v |
| sanity checks |
| | |
| | |
| v |
| do (H/W dep) |
--------------------------------------
| Hardware
|
v
The High Level CI interface uses the EN50221 DVB standard, following a standard ensures futureproofness.
Digital TV Demux Device
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
The Digital TV demux device controls the MPEG-TS filters for the digital TV. If the driver and hardware supports, those filters are implemented at the hardware. Otherwise, the Kernel provides a software emulation.
It can be accessed through /dev/adapter?/demux?. Data types and ioctl definitions can be accessed by including linux/dvb/dmx.h in your application.
DMX_ADD_PID
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_ADD_PID
Synopsis #
int ioctl(fd, DMX_ADD_PID, __u16 *pid)
Arguments #
-
fdFile descriptor returned by
open(). -
pidPID number to be filtered.
Description #
This ioctl call allows to add multiple PIDs to a transport stream filter previously set up with DMX_SET_PES_FILTER and output equal to DMX_OUT_TSDEMUX_TAP <dmx_output>.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
ioctl DMX_EXPBUF
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_EXPBUF - Export a buffer as a DMABUF file descriptor.
Synopsis #
int ioctl(int fd, DMX_EXPBUF, struct dmx_exportbuffer *argp)
Arguments #
-
fdFile descriptor returned by
open(). -
argpPointer to struct
dmx_exportbuffer.
Description #
This ioctl is an extension to the memory mapping I/O method. It can be used to export a buffer as a DMABUF file at any time after buffers have been allocated with the ioctl DMX_REQBUFS ioctl.
To export a buffer, applications fill struct dmx_exportbuffer. Applications must set the index field. Valid index numbers range from zero to the number of buffers allocated with ioctl DMX_REQBUFS (struct dmx_requestbuffers count) minus one. Additional flags may be posted in the flags field. Refer to a manual for open() for details. Currently only O_CLOEXEC, O_RDONLY, O_WRONLY, and O_RDWR are supported. All other fields must be set to zero. In the case of multi-planar API, every plane is exported separately using multiple ioctl DMX_EXPBUF calls.
After calling ioctl DMX_EXPBUF the fd field will be set by a driver, on success. This is a DMABUF file descriptor. The application may pass it to other DMABUF-aware devices. It is recommended to close a DMABUF file when it is no longer used to allow the associated memory to be reclaimed.
Examples #
int
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
-
EINVAL
A queue is not in MMAP mode or DMABUF exporting is not supported or
flagsorindexfields are invalid.
Digital TV demux close()
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
Digital TV demux close()
Synopsis #
int Arguments #
-
fdFile descriptor returned by a previous call to
open().
Description #
This system call deactivates and deallocates a filter that was previously allocated via the open() call.
Return Value #
On success 0 is returned.
On error, -1 is returned and the errno variable is set appropriately.
The generic error codes are described at the Generic Error Codes chapter.
Digital TV demux open()
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
Digital TV demux open()
Synopsis #
int Arguments #
-
nameName of specific Digital TV demux device.
-
flagsA bit-wise OR of the following flags:
|
|
read-only access |
|
|
read/write access |
|
|
open in non-blocking mode (blocking mode is the default) |
Description #
This system call, used with a device name of /dev/dvb/adapter?/demux?, allocates a new filter and returns a handle which can be used for subsequent control of that filter. This call has to be made for each filter to be used, i.e. every returned file descriptor is a reference to a single filter. /dev/dvb/adapter?/dvr? is a logical device to be used for retrieving Transport Streams for digital video recording. When reading from this device a transport stream containing the packets from all PES filters set in the corresponding demux device (/dev/dvb/adapter?/demux?) having the output set to DMX_OUT_TS_TAP. A recorded Transport Stream is replayed by writing to this device.
The significance of blocking or non-blocking mode is described in the documentation for functions where there is a difference. It does not affect the semantics of the open() call itself. A device opened in blocking mode can later be put into non-blocking mode (and vice versa) using the F_SETFL command of the fcntl system call.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
|
|
"Too many open files", i.e. no more filters available. |
The generic error codes are described at the Generic Error Codes chapter.
Digital TV demux read()
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
Digital TV demux read()
Synopsis #
size_t Arguments #
-
fdFile descriptor returned by a previous call to
open().-
bufBuffer to be filled
-
-
countMax number of bytes to read
Description #
This system call returns filtered data, which might be section or Packetized Elementary Stream (PES) data. The filtered data is transferred from the driver's internal circular buffer to buf. The maximum amount of data to be transferred is implied by count.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
|
|
No data to return and |
|
|
The filtered data was not read from the buffer in due time, resulting in non-read data being lost. The buffer is flushed. |
|
|
The section was not loaded within the stated timeout period. See ioctl DMX_SET_FILTER for how to set a timeout. |
|
|
The driver failed to write to the callers buffer due to an invalid *buf pointer. |
The generic error codes are described at the Generic Error Codes chapter.
Digital TV demux write()
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
Digital TV demux write()
Synopsis #
ssize_t Arguments #
-
fdFile descriptor returned by a previous call to
open(). -
bufBuffer with data to be written
-
countNumber of bytes at the buffer
Description #
This system call is only provided by the logical device /dev/dvb/adapter?/dvr?, associated with the physical demux device that provides the actual DVR functionality. It is used for replay of a digitally recorded Transport Stream. Matching filters have to be defined in the corresponding physical demux device, /dev/dvb/adapter?/demux?. The amount of data to be transferred is implied by count.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
|
|
No data was written. This might happen if |
|
|
This error code indicates that there are conflicting requests. The corresponding demux device is setup to receive data from the front- end. Make sure that these filters are stopped and that the filters with input set to |
The generic error codes are described at the Generic Error Codes chapter.
DMX_GET_PES_PIDS
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_GET_PES_PIDS
Synopsis #
int ioctl(fd, DMX_GET_PES_PIDS, __u16 pids[5])
Arguments #
-
fdFile descriptor returned by
open(). -
pidsArray used to store 5 Program IDs.
Description #
This ioctl allows to query a DVB device to return the first PID used by audio, video, textext, subtitle and PCR programs on a given service. They're stored as:
|
PID element |
position |
content |
|---|---|---|
|
pids[DMX_PES_AUDIO] |
0 |
first audio PID |
|
pids[DMX_PES_VIDEO] |
1 |
first video PID |
|
pids[DMX_PES_TELETEXT] |
2 |
first teletext PID |
|
pids[DMX_PES_SUBTITLE] |
3 |
first subtitle PID |
|
pids[DMX_PES_PCR] |
4 |
first Program Clock Reference PID |
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
The generic error codes are described at the Generic Error Codes chapter.
DMX_GET_STC
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_GET_STC
Synopsis #
int ioctl(int fd, DMX_GET_STC, struct dmx_stc *stc)
Arguments #
-
fdFile descriptor returned by
open(). -
stcPointer to
dmx_stcwhere the stc data is to be stored.
Description #
This ioctl call returns the current value of the system time counter (which is driven by a PES filter of type DMX_PES_PCR <dmx_ts_pes>). Some hardware supports more than one STC, so you must specify which one by setting the num <dmx_stc> field of stc before the ioctl (range 0...n). The result is returned in form of a ratio with a 64 bit numerator and a 32 bit denominator, so the real 90kHz STC value is stc->stc / stc->base.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
|
|
Invalid stc number. |
The generic error codes are described at the Generic Error Codes chapter.
Digital TV mmap()
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
dmx-mmap - Map device memory into application address space
Synopsis #
void *Arguments #
-
startMap the buffer to this address in the application's address space. When the
MAP_FIXEDflag is specified,startmust be a multiple of the pagesize and mmap will fail when the specified address cannot be used. Use of this option is discouraged; applications should just specify aNULLpointer here. -
lengthLength of the memory area to map. This must be a multiple of the DVB packet length (188, on most drivers).
-
protThe
protargument describes the desired memory protection. Regardless of the device type and the direction of data exchange it should be set toPROT_READ|PROT_WRITE, permitting read and write access to image buffers. Drivers should support at least this combination of flags. -
flagsThe
flagsparameter specifies the type of the mapped object, mapping options and whether modifications made to the mapped copy of the page are private to the process or are to be shared with other references.MAP_FIXEDrequests that the driver selects no other address than the one specified. If the specified address cannot be used,mmap()will fail. IfMAP_FIXEDis specified,startmust be a multiple of the pagesize. Use of this option is discouraged.One of the
MAP_SHAREDorMAP_PRIVATEflags must be set.MAP_SHAREDallows applications to share the mapped memory with other (e. g. child-) processes. -
fdFile descriptor returned by
open(). -
offsetOffset of the buffer in device memory, as returned by ioctl DMX_QUERYBUF ioctl.
Description #
The mmap() function asks to map length bytes starting at offset in the memory of the device specified by fd into the application address space, preferably at address start. This latter address is a hint only, and is usually specified as 0.
Suitable length and offset parameters are queried with the ioctl DMX_QUERYBUF ioctl. Buffers must be allocated with the ioctl DMX_REQBUFS ioctl before they can be queried.
To unmap buffers the munmap() function is used.
Return Value #
On success mmap() returns a pointer to the mapped buffer. On error MAP_FAILED (-1) is returned, and the errno variable is set appropriately. Possible error codes are:
-
EBADF
fdis not a valid file descriptor. -
EACCES
fdis not open for reading and writing. -
EINVAL
The
startorlengthoroffsetare not suitable. (E. g. they are too large, or not aligned on aPAGESIZEboundary.)The
flagsorprotvalue is not supported.No buffers have been allocated with the ioctl DMX_REQBUFS ioctl.
-
ENOMEM
Not enough physical or virtual memory was available to complete the request.
DVB munmap()
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
dmx-munmap - Unmap device memory
Synopsis #
int Arguments #
-
startAddress of the mapped buffer as returned by the
mmap()function. -
lengthLength of the mapped buffer. This must be the same value as given to
mmap().
Description #
Unmaps a previously with the mmap() function mapped buffer and frees it, if possible.
Return Value #
On success munmap() returns 0, on failure -1 and the errno variable is set appropriately:
-
EINVAL
The
startorlengthis incorrect, or no buffers have been mapped yet.
ioctl DMX_QBUF, DMX_DQBUF
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_QBUF - DMX_DQBUF - Exchange a buffer with the driver
Synopsis #
int ioctl(int fd, DMX_QBUF, struct dmx_buffer *argp)
int ioctl(int fd, DMX_DQBUF, struct dmx_buffer *argp)
Arguments #
-
fdFile descriptor returned by
open(). -
argpPointer to struct
dmx_buffer.
Description #
Applications call the DMX_QBUF ioctl to enqueue an empty (capturing) or filled (output) buffer in the driver's incoming queue. The semantics depend on the selected I/O method.
To enqueue a buffer applications set the index field. Valid index numbers range from zero to the number of buffers allocated with ioctl DMX_REQBUFS (struct dmx_requestbuffers count) minus one. The contents of the struct dmx_buffer returned by a ioctl DMX_QUERYBUF ioctl will do as well.
When DMX_QBUF is called with a pointer to this structure, it locks the memory pages of the buffer in physical memory, so they cannot be swapped out to disk. Buffers remain locked until dequeued, until the device is closed.
Applications call the DMX_DQBUF ioctl to dequeue a filled (capturing) buffer from the driver's outgoing queue. They just set the index field with the buffer ID to be queued. When DMX_DQBUF is called with a pointer to struct dmx_buffer, the driver fills the remaining fields or returns an error code.
By default DMX_DQBUF blocks when no buffer is in the outgoing queue. When the O_NONBLOCK flag was given to the open() function, DMX_DQBUF returns immediately with an EAGAIN error code when no buffer is available.
The struct dmx_buffer structure is specified in buffer.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
-
EAGAIN
Non-blocking I/O has been selected using
O_NONBLOCKand no buffer was in the outgoing queue. -
EINVAL
The
indexis out of bounds, or no buffers have been allocated yet. -
EIO
DMX_DQBUFfailed due to an internal error. Can also indicate temporary problems like signal loss or CRC errors.
ioctl DMX_QUERYBUF
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_QUERYBUF - Query the status of a buffer
Synopsis #
int ioctl(int fd, DMX_QUERYBUF, struct dvb_buffer *argp)
Arguments #
-
fdFile descriptor returned by
open(). -
argpPointer to struct
dvb_buffer.
Description #
This ioctl is part of the mmap streaming I/O method. It can be used to query the status of a buffer at any time after buffers have been allocated with the ioctl DMX_REQBUFS ioctl.
Applications set the index field. Valid index numbers range from zero to the number of buffers allocated with ioctl DMX_REQBUFS (struct dvb_requestbuffers count) minus one.
After calling ioctl DMX_QUERYBUF with a pointer to this structure, drivers return an error code or fill the rest of the structure.
On success, the offset will contain the offset of the buffer from the start of the device memory, the length field its size, and the bytesused the number of bytes occupied by data in the buffer (payload).
Return Value #
On success 0 is returned, the offset will contain the offset of the buffer from the start of the device memory, the length field its size, and the bytesused the number of bytes occupied by data in the buffer (payload).
On error it returns -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
-
EINVAL
The
indexis out of bounds.
DMX_REMOVE_PID
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_REMOVE_PID
Synopsis #
int ioctl(fd, DMX_REMOVE_PID, __u16 *pid)
Arguments #
-
fdFile descriptor returned by
open(). -
pidPID of the PES filter to be removed.
Description #
This ioctl call allows to remove a PID when multiple PIDs are set on a transport stream filter, e. g. a filter previously set up with output equal to DMX_OUT_TSDEMUX_TAP <dmx_output>, created via either DMX_SET_PES_FILTER or DMX_ADD_PID.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
The generic error codes are described at the Generic Error Codes chapter.
ioctl DMX_REQBUFS
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_REQBUFS - Initiate Memory Mapping and/or DMA buffer I/O
Synopsis #
int ioctl(int fd, DMX_REQBUFS, struct dmx_requestbuffers *argp)
Arguments #
-
fdFile descriptor returned by
open(). -
argpPointer to struct
dmx_requestbuffers.
Description #
This ioctl is used to initiate a memory mapped or DMABUF based demux I/O.
Memory mapped buffers are located in device memory and must be allocated with this ioctl before they can be mapped into the application's address space. User buffers are allocated by applications themselves, and this ioctl is merely used to switch the driver into user pointer I/O mode and to setup some internal structures. Similarly, DMABUF buffers are allocated by applications through a device driver, and this ioctl only configures the driver into DMABUF I/O mode without performing any direct allocation.
To allocate device buffers applications initialize all fields of the struct dmx_requestbuffers structure. They set the count field to the desired number of buffers, and size to the size of each buffer.
When the ioctl is called with a pointer to this structure, the driver will attempt to allocate the requested number of buffers and it stores the actual number allocated in the count field. The count can be smaller than the number requested, even zero, when the driver runs out of free memory. A larger number is also possible when the driver requires more buffers to function correctly. The actual allocated buffer size can is returned at size, and can be smaller than what's requested.
When this I/O method is not supported, the ioctl returns an EOPNOTSUPP error code.
Applications can call ioctl DMX_REQBUFS again to change the number of buffers, however this cannot succeed when any buffers are still mapped. A count value of zero frees all buffers, after aborting or finishing any DMA in progress.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
-
EOPNOTSUPP
The the requested I/O method is not supported.
DMX_SET_BUFFER_SIZE
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_SET_BUFFER_SIZE
Synopsis #
int ioctl(int fd, DMX_SET_BUFFER_SIZE, unsigned long size)
Arguments #
-
fdFile descriptor returned by
open(). -
sizeUnsigned long size
Description #
This ioctl call is used to set the size of the circular buffer used for filtered data. The default size is two maximum sized sections, i.e. if this function is not called a buffer size of 2 * 4096 bytes will be used.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
The generic error codes are described at the Generic Error Codes chapter.
DMX_SET_FILTER
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_SET_FILTER
Synopsis #
int ioctl(int fd, DMX_SET_FILTER, struct dmx_sct_filter_params *params)
Arguments #
-
fdFile descriptor returned by
open().
params
Pointer to structure containing filter parameters.
Description #
This ioctl call sets up a filter according to the filter and mask parameters provided. A timeout may be defined stating number of seconds to wait for a section to be loaded. A value of 0 means that no timeout should be applied. Finally there is a flag field where it is possible to state whether a section should be CRC-checked, whether the filter should be a "one-shot" filter, i.e. if the filtering operation should be stopped after the first section is received, and whether the filtering operation should be started immediately (without waiting for a DMX_START ioctl call). If a filter was previously set-up, this filter will be canceled, and the receive buffer will be flushed.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
The generic error codes are described at the Generic Error Codes chapter.
DMX_SET_PES_FILTER
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_SET_PES_FILTER
Synopsis #
int ioctl(int fd, DMX_SET_PES_FILTER, struct dmx_pes_filter_params *params)
Arguments #
-
fdFile descriptor returned by
open(). -
paramsPointer to structure containing filter parameters.
Description #
This ioctl call sets up a PES filter according to the parameters provided. By a PES filter is meant a filter that is based just on the packet identifier (PID), i.e. no PES header or payload filtering capability is supported.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
|
|
This error code indicates that there are conflicting requests. There are active filters filtering data from another input source. Make sure that these filters are stopped before starting this filter. |
The generic error codes are described at the Generic Error Codes chapter.
DMX_START
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_START
Synopsis #
int ioctl(int fd, DMX_START)
Arguments #
-
fdFile descriptor returned by
open().
Description #
This ioctl call is used to start the actual filtering operation defined via the ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
|
|
Invalid argument, i.e. no filtering parameters provided via the DMX_SET_FILTER or DMX_SET_PES_FILTER ioctls. |
|
|
This error code indicates that there are conflicting requests. There are active filters filtering data from another input source. Make sure that these filters are stopped before starting this filter. |
The generic error codes are described at the Generic Error Codes chapter.
DMX_STOP
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
DMX_STOP
Synopsis #
int ioctl(int fd, DMX_STOP)
Arguments #
-
fdFile descriptor returned by
open().
Description #
This ioctl call is used to stop the actual filtering operation defined via the ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via the DMX_START command.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
The generic error codes are described at the Generic Error Codes chapter.
Demux Function Calls
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
- Digital TV demux open()
- Digital TV demux close()
- Digital TV demux read()
- Digital TV demux write()
- Digital TV mmap()
- DVB munmap()
- DMX_START
- DMX_STOP
- DMX_SET_FILTER
- DMX_SET_PES_FILTER
- DMX_SET_BUFFER_SIZE
- DMX_GET_STC
- DMX_GET_PES_PIDS
- DMX_ADD_PID
- DMX_REMOVE_PID
- ioctl DMX_REQBUFS
- ioctl DMX_QUERYBUF
- ioctl DMX_EXPBUF
- ioctl DMX_QBUF, DMX_DQBUF
Demux Data Types
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
enum dmx_output #
Output for the demux.
Constants
DMX_OUT_DECODER: Streaming directly to decoder.DMX_OUT_TAP: Output going to a memory buffer (to be retrieved via the read command). Delivers the stream output to the demux device on which the ioctl is called.DMX_OUT_TS_TAP: Output multiplexed into a new TS (to be retrieved by reading from the logical DVR device). Routes output to the logical DVR device/dev/dvb/adapter?/dvr?, which delivers a TS multiplexed from all filters for which DMX_OUT_TS_TAP was specified.DMX_OUT_TSDEMUX_TAP: Like DMX_OUT_TS_TAP but retrieved from the DMX device.
enum dmx_input #
Input from the demux.
Constants
DMX_IN_FRONTEND: Input from a front-end device.DMX_IN_DVR: Input from the logical DVR device.
enum dmx_ts_pes #
type of the PES filter.
Constants
DMX_PES_AUDIO0: first audio PID. Also referred as DMX_PES_AUDIO.DMX_PES_VIDEO0: first video PID. Also referred as DMX_PES_VIDEO.DMX_PES_TELETEXT0: first teletext PID. Also referred as DMX_PES_TELETEXT.DMX_PES_SUBTITLE0: first subtitle PID. Also referred as DMX_PES_SUBTITLE.DMX_PES_PCR0: first Program Clock Reference PID. Also referred as DMX_PES_PCR.DMX_PES_AUDIO1: second audio PID.DMX_PES_VIDEO1: second video PID.DMX_PES_TELETEXT1: second teletext PID.DMX_PES_SUBTITLE1: second subtitle PID.DMX_PES_PCR1: second Program Clock Reference PID.DMX_PES_AUDIO2: third audio PID.DMX_PES_VIDEO2: third video PID.DMX_PES_TELETEXT2: third teletext PID.DMX_PES_SUBTITLE2: third subtitle PID.DMX_PES_PCR2: third Program Clock Reference PID.DMX_PES_AUDIO3: fourth audio PID.DMX_PES_VIDEO3: fourth video PID.DMX_PES_TELETEXT3: fourth teletext PID.DMX_PES_SUBTITLE3: fourth subtitle PID.DMX_PES_PCR3: fourth Program Clock Reference PID.DMX_PES_OTHER: any other PID.
struct dmx_filter #
Specifies a section header filter.
Definition
;
Members
filter: bit array with bits to be matched at the section header.mask: bits that are valid at the filter bit array.mode: mode of match: if bit is zero, it will match if equal (positive match); if bit is one, it will match if the bit is negated.
Note
All arrays in this struct have a size of DMX_FILTER_SIZE (16 bytes).
struct dmx_sct_filter_params #
Specifies a section filter.
Definition
;
Members
pid: PID to be filtered.filter: section header filter, as defined bystruct dmx_filter.timeout: maximum time to filter, in milliseconds.flags: extra flags for the section filter.
Description
Carries the configuration for a MPEG-TS section filter.
The flags can be:
DMX_CHECK_CRC- only deliver sections where the CRC check succeeded;DMX_ONESHOT- disable the section filter after one section has been delivered;DMX_IMMEDIATE_START- Start filter immediately without requiring a DMX_START.
struct dmx_pes_filter_params #
Specifies Packetized Elementary Stream (PES) filter parameters.
Definition
;
Members
pid: PID to be filtered.input: Demux input, as specified byenum dmx_input.output: Demux output, as specified byenum dmx_output.pes_type: Type of the pes filter, as specified byenum dmx_pes_type.flags: Demux PES flags.
struct dmx_stc #
Stores System Time Counter (STC) information.
Definition
;
Members
num: input data: number of the STC, from 0 to N.base: output: divisor for STC to get 90 kHz clock.stc: output: stc in base * 90 kHz units.
enum dmx_buffer_flags #
DMX memory-mapped buffer flags
Constants
DMX_BUFFER_FLAG_HAD_CRC32_DISCARD: Indicates that the Kernel discarded one or more frames due to wrong CRC32 checksum.DMX_BUFFER_FLAG_TEI: Indicates that the Kernel has detected a Transport Error indicator (TEI) on a filtered pid.DMX_BUFFER_PKT_COUNTER_MISMATCH: Indicates that the Kernel has detected a packet counter mismatch on a filtered pid.DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED: Indicates that the Kernel has detected one or more frame discontinuity.DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR: Received at least one packet with a frame discontinuity indicator.
struct dmx_buffer #
dmx buffer info
Definition
;
Members
index: id number of the bufferbytesused: number of bytes occupied by data in the buffer (payload);offset: for buffers with memory == DMX_MEMORY_MMAP; offset from the start of the device memory for this plane, (or a "cookie" that should be passed tommap()as offset)length: size in bytes of the bufferflags: bit array of buffer flags as defined byenum dmx_buffer_flags. Filled only atDMX_DQBUF.count: monotonic counter for filled buffers. Helps to identify data stream loses. Filled only atDMX_DQBUF.
Description
Contains data exchanged by application and driver using one of the streaming I/O methods.
Please notice that, for DMX_QBUF, only index should be filled.
On DMX_DQBUF calls, all fields will be filled by the Kernel.
struct dmx_requestbuffers #
request dmx buffer information
Definition
;
Members
count: number of requested buffers,size: size in bytes of the requested buffer
Description
Contains data used for requesting a dmx buffer. All reserved fields must be set to zero.
struct dmx_exportbuffer #
export of dmx buffer as DMABUF file descriptor
Definition
;
Members
index: id number of the bufferflags: flags for newly created file, currently only O_CLOEXEC is supported, refer to manual of open syscall for more detailsfd: file descriptor associated with DMABUF (set by driver)
Description
Contains data used for exporting a dmx buffer as DMABUF file descriptor.
The buffer is identified by a 'cookie' returned by DMX_QUERYBUF
(identical to the cookie used to mmap() the buffer to userspace). All
reserved fields must be set to zero. The field reserved0 is expected to
become a structure 'type' allowing an alternative layout of the structure
content. Therefore this field should not be used for any other extensions.
Querying frontend status and statistics
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Once FE_SET_PROPERTY is called, the frontend will run a kernel thread that will periodically check for the tuner lock status and provide statistics about the quality of the signal.
The information about the frontend tuner locking status can be queried using ioctl FE_READ_STATUS.
Signal statistics are provided via ioctl FE_SET_PROPERTY, FE_GET_PROPERTY.
frontend events
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
dvb_frontend_event
frontend events #
;
frontend parameters
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
dvb_frontend_parameters
frontend parameters #
The kind of parameters passed to the frontend device for tuning depend on the kind of hardware you are using.
The struct dvb_frontend_parameters uses a union with specific per-system parameters. However, as newer delivery systems required more data, the structure size weren't enough to fit, and just extending its size would break the existing applications. So, those parameters were replaced by the usage of FE_GET_PROPERTY/FE_SET_PROPERTY ioctl's. The new API is flexible enough to add new parameters to existing delivery systems, and to add newer delivery systems.
So, newer applications should use FE_GET_PROPERTY/FE_SET_PROPERTY instead, in order to be able to support the newer System Delivery like DVB-S2, DVB-T2, DVB-C2, ISDB, etc.
All kinds of parameters are combined as a union in the dvb_frontend_parameters structure:
;
In the case of QPSK frontends the frequency field specifies the intermediate frequency, i.e. the offset which is effectively added to the local oscillator frequency (LOF) of the LNB. The intermediate frequency has to be specified in units of kHz. For QAM and OFDM frontends the frequency specifies the absolute frequency and is given in Hz.
dvb_qpsk_parameters
QPSK parameters #
For satellite QPSK frontends you have to use the dvb_qpsk_parameters structure:
;
dvb_qam_parameters
QAM parameters #
for cable QAM frontend you use the dvb_qam_parameters structure:
;
dvb_vsb_parameters
VSB parameters #
ATSC frontends are supported by the dvb_vsb_parameters structure:
;
dvb_ofdm_parameters
OFDM parameters #
DVB-T frontends are supported by the dvb_ofdm_parameters structure:
;
Part II - Digital TV API
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Version 5.10
Table of Contents
- Introduction
- Digital TV Frontend API
- Digital TV Demux Device
- Digital TV CA Device
- Digital TV Network API
- Digital TV Deprecated APIs
- Examples
- headers
Revision and Copyright #
Authors:
-
- J. - K. Metzler, Ralph <rjkm@metzlerbros.de>
- Original author of the Digital TV API documentation.
-
- O. - C. Metzler, Marcus <rjkm@metzlerbros.de>
- Original author of the Digital TV API documentation.
- Carvalho Chehab, Mauro <mchehab+samsung@kernel.org>
- Ported document to Docbook XML, addition of DVBv5 API, documentation gaps fix.
Copyright © 2002-2003 : Convergence GmbH
Copyright © 2009-2017 : Mauro Carvalho Chehab
Revision History #
revision: 2.2.0 / 2017-09-01 (mcc)
Most gaps between the uAPI document and the Kernel implementation got fixed for the non-legacy API.
revision: 2.1.0 / 2015-05-29 (mcc)
DocBook improvements and cleanups, in order to document the system calls on a more standard way and provide more description about the current Digital TV API.
revision: 2.0.4 / 2011-05-06 (mcc)
Add more information about DVBv5 API, better describing the frontend GET/SET props ioctl's.
revision: 2.0.3 / 2010-07-03 (mcc)
Add some frontend capabilities flags, present on kernel, but missing at the specs.
revision: 2.0.2 / 2009-10-25 (mcc)
documents FE_SET_FRONTEND_TUNE_MODE and FE_DISHETWORK_SEND_LEGACY_CMD ioctls.
revision: 2.0.1 / 2009-09-16 (mcc)
Added ISDB-T test originally written by Patrick Boettcher
revision: 2.0.0 / 2009-09-06 (mcc)
Conversion from LaTex to DocBook XML. The contents is the same as the original LaTex version.
revision: 1.0.0 / 2003-07-24 (rjkm)
Initial revision on LaTEX.
Property types
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Tuning into a Digital TV physical channel and starting decoding it requires changing a set of parameters, in order to control the tuner, the demodulator, the Linear Low-noise Amplifier (LNA) and to set the antenna subsystem via Satellite Equipment Control - SEC (on satellite systems). The actual parameters are specific to each particular digital TV standards, and may change as the digital TV specs evolves.
In the past (up to DVB API version 3 - DVBv3), the strategy used was to have a union with the parameters needed to tune for DVB-S, DVB-C, DVB-T and ATSC delivery systems grouped there. The problem is that, as the second generation standards appeared, the size of such union was not big enough to group the structs that would be required for those new standards. Also, extending it would break userspace.
So, the legacy union/struct based approach was deprecated, in favor of a properties set approach. On such approach, FE_GET_PROPERTY and FE_SET_PROPERTY are used to setup the frontend and read its status.
The actual action is determined by a set of dtv_property cmd/data pairs. With one single ioctl, is possible to get/set up to 64 properties.
This section describes the new and recommended way to set the frontend, with supports all digital TV delivery systems.
Example: in order to set the hardware to tune into a DVB-C channel at 651 kHz, modulated with 256-QAM, FEC 3/4 and symbol rate of 5.217 Mbauds, those properties should be sent to FE_SET_PROPERTY ioctl:
DTV_DELIVERY_SYSTEM = SYS_DVBC_ANNEX_A
DTV_FREQUENCY = 651000000
DTV_MODULATION = QAM_256
DTV_INVERSION = INVERSION_AUTO
DTV_SYMBOL_RATE = 5217000
DTV_INNER_FEC = FEC_3_4
The code that would that would do the above is show in dtv-prop-example.
Example: Setting digital TV frontend properties
static struct dtv_property props = ;
static struct dtv_properties dtv_prop = ;
int
Examples
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
In the past, we used to have a set of examples here. However, those examples got out of date and doesn't even compile nowadays.
Also, nowadays, the best is to use the libdvbv5 DVB API nowadays, with is fully documented.
Please refer to the libdvbv5 for updated/recommended examples.
Frontend bandwidth
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
fe_bandwidth
|
ID |
Description |
|---|---|
|
|
Autodetect bandwidth (if supported) |
|
|
1.712 MHz |
|
|
5 MHz |
|
|
6 MHz |
|
|
7 MHz |
|
|
8 MHz |
|
|
10 MHz |
ioctl FE_DISEQC_RECV_SLAVE_REPLY
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_DISEQC_RECV_SLAVE_REPLY - Receives reply from a DiSEqC 2.0 command
Synopsis #
int ioctl(int fd, FE_DISEQC_RECV_SLAVE_REPLY, struct dvb_diseqc_slave_reply *argp)
Arguments #
-
fdFile descriptor returned by
open(). -
argppointer to struct
dvb_diseqc_slave_reply.
Description #
Receives reply from a DiSEqC 2.0 command.
The received message is stored at the buffer pointed by argp.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
ioctl FE_DISEQC_RESET_OVERLOAD
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_DISEQC_RESET_OVERLOAD - Restores the power to the antenna subsystem, if it was powered off due - to power overload.
Synopsis #
int ioctl(int fd, FE_DISEQC_RESET_OVERLOAD, NULL)
Arguments #
-
fdFile descriptor returned by
open().
Description #
If the bus has been automatically powered off due to power overload, this ioctl call restores the power to the bus. The call requires read/write access to the device. This call has no effect if the device is manually powered off. Not all Digital TV adapters support this ioctl.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
ioctl FE_DISEQC_SEND_BURST
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_DISEQC_SEND_BURST - Sends a 22KHz tone burst for 2x1 mini DiSEqC satellite selection.
Synopsis #
int ioctl(int fd, FE_DISEQC_SEND_BURST, enum fe_sec_mini_cmd tone)
Arguments #
-
fdFile descriptor returned by
open(). -
toneAn integer enumerated value described at
fe_sec_mini_cmd.
Description #
This ioctl is used to set the generation of a 22kHz tone burst for mini DiSEqC satellite selection for 2x1 switches. This call requires read/write permissions.
It provides support for what's specified at Digital Satellite Equipment Control (DiSEqC) - Simple "ToneBurst" Detection Circuit specification.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
ioctl FE_DISEQC_SEND_MASTER_CMD
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_DISEQC_SEND_MASTER_CMD - Sends a DiSEqC command
Synopsis #
int ioctl(int fd, FE_DISEQC_SEND_MASTER_CMD, struct dvb_diseqc_master_cmd *argp)
Arguments #
-
fdFile descriptor returned by
open(). -
argppointer to struct
dvb_diseqc_master_cmd
Description #
Sends the DiSEqC command pointed by dvb_diseqc_master_cmd to the antenna subsystem.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
FE_DISHNETWORK_SEND_LEGACY_CMD
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_DISHNETWORK_SEND_LEGACY_CMD
Synopsis #
int ioctl(int fd, FE_DISHNETWORK_SEND_LEGACY_CMD, unsigned long cmd)
Arguments #
-
fdFile descriptor returned by
open(). -
cmdSends the specified raw cmd to the dish via DISEqC.
Description #
It provides a non-standard method for selecting Diseqc voltage on the frontend, for Dish Network legacy switches.
As support for this ioctl were added in 2004, this means that such dishes were already legacy in 2004.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
ioctl FE_ENABLE_HIGH_LNB_VOLTAGE
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_ENABLE_HIGH_LNB_VOLTAGE - Select output DC level between normal LNBf voltages or higher LNBf - voltages.
Synopsis #
int ioctl(int fd, FE_ENABLE_HIGH_LNB_VOLTAGE, unsigned int high)
Arguments #
-
fdFile descriptor returned by
open(). -
highValid flags:
-
0 - normal 13V and 18V.
-
>0 - enables slightly higher voltages instead of 13/18V, in order to compensate for long antenna cables.
-
Description #
Select output DC level between normal LNBf voltages or higher LNBf voltages between 0 (normal) or a value grater than 0 for higher voltages.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
FE_GET_EVENT
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_GET_EVENT
Synopsis #
int ioctl(int fd, FE_GET_EVENT, struct dvb_frontend_event *ev)
Arguments #
-
fdFile descriptor returned by
open(). -
evPoints to the location where the event, if any, is to be stored.
Description #
This ioctl call returns a frontend event if available. If an event is not available, the behavior depends on whether the device is in blocking or non-blocking mode. In the latter case, the call fails immediately with errno set to EWOULDBLOCK. In the former case, the call blocks until an event becomes available.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
|
|
There is no event pending, and the device is in non-blocking mode. |
|
|
Overflow in event queue - one or more events were lost. |
Generic error codes are described at the Generic Error Codes chapter.
FE_GET_FRONTEND
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_GET_FRONTEND
Synopsis #
int ioctl(int fd, FE_GET_FRONTEND, struct dvb_frontend_parameters *p)
Arguments #
-
fdFile descriptor returned by
open(). -
pPoints to parameters for tuning operation.
Description #
This ioctl call queries the currently effective frontend parameters. For this command, read-only access to the device is sufficient.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
|
|
Maximum supported symbol rate reached. |
Generic error codes are described at the Generic Error Codes chapter.
ioctl FE_GET_INFO
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_GET_INFO - Query Digital TV frontend capabilities and returns information about the - front-end. This call only requires read-only access to the device.
Synopsis #
int ioctl(int fd, FE_GET_INFO, struct dvb_frontend_info *argp)
Arguments #
-
fdFile descriptor returned by
open(). -
argppointer to struct
dvb_frontend_info
Description #
All Digital TV frontend devices support the ioctl FE_GET_INFO ioctl. It is used to identify kernel devices compatible with this specification and to obtain information about driver and hardware capabilities. The ioctl takes a pointer to dvb_frontend_info which is filled by the driver. When the driver is not compatible with this specification the ioctl returns an error.
frontend capabilities #
Capabilities describe what a frontend can do. Some capabilities are supported only on some specific frontend types.
The frontend capabilities are described at fe_caps.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
ioctl FE_SET_PROPERTY, FE_GET_PROPERTY
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_SET_PROPERTY - FE_GET_PROPERTY - FE_SET_PROPERTY sets one or more frontend properties. - FE_GET_PROPERTY returns one or more frontend properties.
Synopsis #
int ioctl(int fd, FE_GET_PROPERTY, struct dtv_properties *argp)
int ioctl(int fd, FE_SET_PROPERTY, struct dtv_properties *argp)
Arguments #
-
fdFile descriptor returned by
open(). -
argpPointer to struct
dtv_properties.
Description #
All Digital TV frontend devices support the FE_SET_PROPERTY and FE_GET_PROPERTY ioctls. The supported properties and statistics depends on the delivery system and on the device:
-
FE_SET_PROPERTY:-
This ioctl is used to set one or more frontend properties.
-
This is the basic command to request the frontend to tune into some frequency and to start decoding the digital TV signal.
-
This call requires read/write access to the device.
-
-
FE_GET_PROPERTY:-
This ioctl is used to get properties and statistics from the frontend.
-
No properties are changed, and statistics aren't reset.
-
This call only requires read-only access to the device.
-
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
FE_READ_BER
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_READ_BER
Synopsis #
int ioctl(int fd, FE_READ_BER, uint32_t *ber)
Arguments #
-
fdFile descriptor returned by
open(). -
berThe bit error rate is stored into *ber.
Description #
This ioctl call returns the bit error rate for the signal currently received/demodulated by the front-end. For this command, read-only access to the device is sufficient.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
FE_READ_SIGNAL_STRENGTH
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_READ_SIGNAL_STRENGTH
Synopsis #
int ioctl(int fd, FE_READ_SIGNAL_STRENGTH, uint16_t *strength)
Arguments #
-
fdFile descriptor returned by
open(). -
strengthThe signal strength value is stored into *strength.
Description #
This ioctl call returns the signal strength value for the signal currently received by the front-end. For this command, read-only access to the device is sufficient.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
FE_READ_SNR
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_READ_SNR
Synopsis #
int ioctl(int fd, FE_READ_SNR, int16_t *snr)
Arguments #
-
fdFile descriptor returned by
open(). -
snrThe signal-to-noise ratio is stored into *snr.
Description #
This ioctl call returns the signal-to-noise ratio for the signal currently received by the front-end. For this command, read-only access to the device is sufficient.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
ioctl FE_READ_STATUS
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_READ_STATUS - Returns status information about the front-end. This call only requires - read-only access to the device
Synopsis #
int ioctl(int fd, FE_READ_STATUS, unsigned int *status)
Arguments #
-
fdFile descriptor returned by
open(). -
statuspointer to a bitmask integer filled with the values defined by enum
fe_status.
Description #
All Digital TV frontend devices support the FE_READ_STATUS ioctl. It is used to check about the locking status of the frontend after being tuned. The ioctl takes a pointer to an integer where the status will be written.
int fe_status #
The fe_status parameter is used to indicate the current state and/or state changes of the frontend hardware. It is produced using the enum fe_status values on a bitmask
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
FE_READ_UNCORRECTED_BLOCKS
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_READ_UNCORRECTED_BLOCKS
Synopsis #
int ioctl(int fd, FE_READ_UNCORRECTED_BLOCKS, uint32_t *ublocks)
Arguments #
-
fdFile descriptor returned by
open(). -
ublocksThe total number of uncorrected blocks seen by the driver so far.
Description #
This ioctl call returns the number of uncorrected blocks detected by the device driver during its lifetime. For meaningful measurements, the increment in block count during a specific time interval should be calculated. For this command, read-only access to the device is sufficient.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
ioctl FE_SET_FRONTEND_TUNE_MODE
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_SET_FRONTEND_TUNE_MODE - Allow setting tuner mode flags to the frontend.
Synopsis #
int ioctl(int fd, FE_SET_FRONTEND_TUNE_MODE, unsigned int flags)
Arguments #
-
fdFile descriptor returned by
open(). -
flagsValid flags:
-
0 - normal tune mode
-
FE_TUNE_MODE_ONESHOT- When set, this flag will disable any zigzagging or other "normal" tuning behaviour. Additionally, there will be no automatic monitoring of the lock status, and hence no frontend events will be generated. If a frontend device is closed, this flag will be automatically turned off when the device is reopened read-write.
-
Description #
Allow setting tuner mode flags to the frontend, between 0 (normal) or FE_TUNE_MODE_ONESHOT mode
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
FE_SET_FRONTEND
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_SET_FRONTEND
Synopsis #
int ioctl(int fd, FE_SET_FRONTEND, struct dvb_frontend_parameters *p)
Arguments #
-
fdFile descriptor returned by
open(). -
pPoints to parameters for tuning operation.
Description #
This ioctl call starts a tuning operation using specified parameters. The result of this call will be successful if the parameters were valid and the tuning could be initiated. The result of the tuning operation in itself, however, will arrive asynchronously as an event (see documentation for FE_GET_EVENT and FrontendEvent.) If a new FE_SET_FRONTEND operation is initiated before the previous one was completed, the previous operation will be aborted in favor of the new one. This command requires read/write access to the device.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
|
|
Maximum supported symbol rate reached. |
Generic error codes are described at the Generic Error Codes chapter.
ioctl FE_SET_TONE
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_SET_TONE - Sets/resets the generation of the continuous 22kHz tone.
Synopsis #
int ioctl(int fd, FE_SET_TONE, enum fe_sec_tone_mode tone)
Arguments #
-
fdFile descriptor returned by
open(). -
toneAn integer enumerated value described at
fe_sec_tone_mode
Description #
This ioctl is used to set the generation of the continuous 22kHz tone. This call requires read/write permissions.
Usually, satellite antenna subsystems require that the digital TV device to send a 22kHz tone in order to select between high/low band on some dual-band LNBf. It is also used to send signals to DiSEqC equipment, but this is done using the DiSEqC ioctls.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
ioctl FE_SET_VOLTAGE
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
FE_SET_VOLTAGE - Allow setting the DC level sent to the antenna subsystem.
Synopsis #
int ioctl(int fd, FE_SET_VOLTAGE, enum fe_sec_voltage voltage)
Arguments #
-
fdFile descriptor returned by
open(). -
voltageAn integer enumerated value described at
fe_sec_voltage
Description #
This ioctl allows to set the DC voltage level sent through the antenna cable to 13V, 18V or off.
Usually, a satellite antenna subsystems require that the digital TV device to send a DC voltage to feed power to the LNBf. Depending on the LNBf type, the polarization or the intermediate frequency (IF) of the LNBf can controlled by the voltage level. Other devices (for example, the ones that implement DISEqC and multipoint LNBf's don't need to control the voltage level, provided that either 13V or 18V is sent to power up the LNBf.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
Frontend type
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
For historical reasons, frontend types are named by the type of modulation used in transmission. The fontend types are given by fe_type_t type, defined as:
fe_type
|
fe_type |
Description |
DTV_DELIVERY_SYSTEM equivalent type |
|---|---|---|
|
|
For DVB-S standard |
|
|
|
For DVB-C annex A standard |
|
|
|
For DVB-T standard |
|
|
|
For ATSC standard (terrestrial) or for DVB-C Annex B (cable) used in US. |
|
Newer formats like DVB-S2, ISDB-T, ISDB-S and DVB-T2 are not described at the above, as they're supported via the new FE_GET_PROPERTY/FE_GET_SET_PROPERTY ioctl's, using the DTV_DELIVERY_SYSTEM parameter.
In the old days, struct dvb_frontend_info used to contain fe_type_t field to indicate the delivery systems, filled with either FE_QPSK, FE_QAM, FE_OFDM or FE_ATSC. While this is still filled to keep backward compatibility, the usage of this field is deprecated, as it can report just one delivery system, but some devices support multiple delivery systems. Please use DTV_ENUM_DELSYS instead.
On devices that support multiple delivery systems, struct dvb_frontend_info::fe_type_t is filled with the currently standard, as selected by the last call to FE_SET_PROPERTY using the DTV_DELIVERY_SYSTEM property.
Digital TV property parameters
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
There are several different Digital TV parameters that can be used by FE_SET_PROPERTY and FE_GET_PROPERTY ioctls. This section describes each of them. Please notice, however, that only a subset of them are needed to setup a frontend.
DTV_UNDEFINED #
Used internally. A GET/SET operation for it won't change or return anything.
DTV_TUNE #
Interpret the cache of data, build either a traditional frontend tunerequest so we can pass validation in the FE_SET_FRONTEND ioctl.
DTV_CLEAR #
Reset a cache of data specific to the frontend here. This does not effect hardware.
DTV_FREQUENCY #
Frequency of the digital TV transponder/channel.
DTV_MODULATION #
Specifies the frontend modulation type for delivery systems that support multiple modulations.
The modulation can be one of the types defined by enum fe_modulation.
Most of the digital TV standards offer more than one possible modulation type.
The table below presents a summary of the types of modulation types supported by each delivery system, as currently defined by specs.
|
Standard |
Modulation types |
|---|---|
|
ATSC (version 1) |
8-VSB and 16-VSB. |
|
DMTB |
4-QAM, 16-QAM, 32-QAM, 64-QAM and 4-QAM-NR. |
|
DVB-C Annex A/C |
16-QAM, 32-QAM, 64-QAM and 256-QAM. |
|
DVB-C Annex B |
64-QAM. |
|
DVB-C2 |
QPSK, 16-QAM, 64-QAM, 256-QAM, 1024-QAM and 4096-QAM. |
|
DVB-T |
QPSK, 16-QAM and 64-QAM. |
|
DVB-T2 |
QPSK, 16-QAM, 64-QAM and 256-QAM. |
|
DVB-S |
No need to set. It supports only QPSK. |
|
DVB-S2 |
QPSK, 8-PSK, 16-APSK and 32-APSK. |
|
DVB-S2X |
8-APSK-L, 16-APSK-L, 32-APSK-L, 64-APSK and 64-APSK-L. |
|
ISDB-T |
QPSK, DQPSK, 16-QAM and 64-QAM. |
|
ISDB-S |
8-PSK, QPSK and BPSK. |
DTV_BANDWIDTH_HZ #
Bandwidth for the channel, in HZ.
Should be set only for terrestrial delivery systems.
Possible values: 1712000, 5000000, 6000000, 7000000, 8000000, 10000000.
|
Terrestrial Standard |
Possible values for bandwidth |
|---|---|
|
ATSC (version 1) |
No need to set. It is always 6MHz. |
|
DMTB |
No need to set. It is always 8MHz. |
|
DVB-T |
6MHz, 7MHz and 8MHz. |
|
DVB-T2 |
1.172 MHz, 5MHz, 6MHz, 7MHz, 8MHz and 10MHz |
|
ISDB-T |
5MHz, 6MHz, 7MHz and 8MHz, although most places use 6MHz. |
DTV_INVERSION #
Specifies if the frontend should do spectral inversion or not.
The acceptable values are defined by fe_spectral_inversion.
DTV_DISEQC_MASTER #
Currently not implemented.
DTV_SYMBOL_RATE #
Used on cable and satellite delivery systems.
Digital TV symbol rate, in bauds (symbols/second).
DTV_INNER_FEC #
Used on cable and satellite delivery systems.
The acceptable values are defined by fe_code_rate.
DTV_VOLTAGE #
Used on satellite delivery systems.
The voltage is usually used with non-DiSEqC capable LNBs to switch the polarization (horizontal/vertical). When using DiSEqC equipment this voltage has to be switched consistently to the DiSEqC commands as described in the DiSEqC spec.
The acceptable values are defined by fe_sec_voltage.
DTV_TONE #
Currently not used.
DTV_PILOT #
Used on DVB-S2.
Sets DVB-S2 pilot.
The acceptable values are defined by fe_pilot.
DTV_ROLLOFF #
Used on DVB-S2.
Sets DVB-S2 rolloff.
The acceptable values are defined by fe_rolloff.
DTV_DISEQC_SLAVE_REPLY #
Currently not implemented.
DTV_FE_CAPABILITY_COUNT #
Currently not implemented.
DTV_FE_CAPABILITY #
Currently not implemented.
DTV_DELIVERY_SYSTEM #
Specifies the type of the delivery system.
The acceptable values are defined by fe_delivery_system.
DTV_ISDBT_PARTIAL_RECEPTION #
Used only on ISDB.
If DTV_ISDBT_SOUND_BROADCASTING is '0' this bit field represents whether the channel is in partial reception mode or not.
If '1' DTV_ISDBT_LAYERA_* values are assigned to the center segment and DTV_ISDBT_LAYERA_SEGMENT_COUNT has to be '1'.
If in addition DTV_ISDBT_SOUND_BROADCASTING is '1' DTV_ISDBT_PARTIAL_RECEPTION represents whether this ISDB-Tsb channel is consisting of one segment and layer or three segments and two layers.
Possible values: 0, 1, -1 (AUTO)
DTV_ISDBT_SOUND_BROADCASTING #
Used only on ISDB.
This field represents whether the other DTV_ISDBT_*-parameters are referring to an ISDB-T and an ISDB-Tsb channel. (See also DTV_ISDBT_PARTIAL_RECEPTION).
Possible values: 0, 1, -1 (AUTO)
DTV_ISDBT_SB_SUBCHANNEL_ID #
Used only on ISDB.
This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'.
(Note of the author: This might not be the correct description of the SUBCHANNEL-ID in all details, but it is my understanding of the technical background needed to program a device)
An ISDB-Tsb channel (1 or 3 segments) can be broadcasted alone or in a set of connected ISDB-Tsb channels. In this set of channels every channel can be received independently. The number of connected ISDB-Tsb segment can vary, e.g. depending on the frequency spectrum bandwidth available.
Example: Assume 8 ISDB-Tsb connected segments are broadcasted. The broadcaster has several possibilities to put those channels in the air: Assuming a normal 13-segment ISDB-T spectrum he can align the 8 segments from position 1-8 to 5-13 or anything in between.
The underlying layer of segments are sub-channels: each segment is consisting of several sub-channels with a predefined IDs. A sub-channel is used to help the demodulator to synchronize on the channel.
An ISDB-T channel is always centered over all sub-channels. As for the example above, in ISDB-Tsb it is no longer as simple as that.
The DTV_ISDBT_SB_SUBCHANNEL_ID parameter is used to give the sub-channel ID of the segment to be demodulated.
Possible values: 0 .. 41, -1 (AUTO)
DTV_ISDBT_SB_SEGMENT_IDX #
Used only on ISDB.
This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'.
DTV_ISDBT_SB_SEGMENT_IDX gives the index of the segment to be demodulated for an ISDB-Tsb channel where several of them are transmitted in the connected manner.
Possible values: 0 .. DTV_ISDBT_SB_SEGMENT_COUNT - 1
Note: This value cannot be determined by an automatic channel search.
DTV_ISDBT_SB_SEGMENT_COUNT #
Used only on ISDB.
This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'.
DTV_ISDBT_SB_SEGMENT_COUNT gives the total count of connected ISDB-Tsb channels.
Possible values: 1 .. 13
Note: This value cannot be determined by an automatic channel search.
DTV-ISDBT-LAYER[A-C] parameters #
Used only on ISDB.
ISDB-T channels can be coded hierarchically. As opposed to DVB-T in ISDB-T hierarchical layers can be decoded simultaneously. For that reason a ISDB-T demodulator has 3 Viterbi and 3 Reed-Solomon decoders.
ISDB-T has 3 hierarchical layers which each can use a part of the available segments. The total number of segments over all layers has to 13 in ISDB-T.
There are 3 parameter sets, for Layers A, B and C.
DTV_ISDBT_LAYER_ENABLED #
Used only on ISDB.
Hierarchical reception in ISDB-T is achieved by enabling or disabling layers in the decoding process. Setting all bits of DTV_ISDBT_LAYER_ENABLED to '1' forces all layers (if applicable) to be demodulated. This is the default.
If the channel is in the partial reception mode (DTV_ISDBT_PARTIAL_RECEPTION = 1) the central segment can be decoded independently of the other 12 segments. In that mode layer A has to have a SEGMENT_COUNT of 1.
In ISDB-Tsb only layer A is used, it can be 1 or 3 in ISDB-Tsb according to DTV_ISDBT_PARTIAL_RECEPTION. SEGMENT_COUNT must be filled accordingly.
Only the values of the first 3 bits are used. Other bits will be silently ignored:
DTV_ISDBT_LAYER_ENABLED bit 0: layer A enabled
DTV_ISDBT_LAYER_ENABLED bit 1: layer B enabled
DTV_ISDBT_LAYER_ENABLED bit 2: layer C enabled
DTV_ISDBT_LAYER_ENABLED bits 3-31: unused
DTV_ISDBT_LAYER[A-C]_FEC #
Used only on ISDB.
The Forward Error Correction mechanism used by a given ISDB Layer, as defined by fe_code_rate.
Possible values are: FEC_AUTO, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8
DTV_ISDBT_LAYER[A-C]_MODULATION #
Used only on ISDB.
The modulation used by a given ISDB Layer, as defined by fe_modulation.
Possible values are: QAM_AUTO, QPSK, QAM_16, QAM_64, DQPSK
DTV_ISDBT_LAYER[A-C]_SEGMENT_COUNT #
Used only on ISDB.
Possible values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1 (AUTO)
Note: Truth table for DTV_ISDBT_SOUND_BROADCASTING and DTV_ISDBT_PARTIAL_RECEPTION and LAYER[A-C]_SEGMENT_COUNT
|
Partial Reception |
Sound Broadcasting |
Layer A width |
Layer B width |
Layer C width |
total width |
|---|---|---|---|---|---|
|
0 |
0 |
1 .. 13 |
1 .. 13 |
1 .. 13 |
13 |
|
1 |
0 |
1 |
1 .. 13 |
1 .. 13 |
13 |
|
0 |
1 |
1 |
0 |
0 |
1 |
|
1 |
1 |
1 |
2 |
0 |
13 |
DTV_ISDBT_LAYER[A-C]_TIME_INTERLEAVING #
Used only on ISDB.
Valid values: 0, 1, 2, 4, -1 (AUTO)
when DTV_ISDBT_SOUND_BROADCASTING is active, value 8 is also valid.
Note: The real time interleaving length depends on the mode (fft-size). The values here are referring to what can be found in the TMCC-structure, as shown in the table below.
isdbt_layer_interleaving_table
|
|
Mode 1 (2K FFT) |
Mode 2 (4K FFT) |
Mode 3 (8K FFT) |
|---|---|---|---|
|
0 |
0 |
0 |
0 |
|
1 |
4 |
2 |
1 |
|
2 |
8 |
4 |
2 |
|
4 |
16 |
8 |
4 |
DTV_ATSCMH_FIC_VER #
Used only on ATSC-MH.
Version number of the FIC (Fast Information Channel) signaling data.
FIC is used for relaying information to allow rapid service acquisition by the receiver.
Possible values: 0, 1, 2, 3, ..., 30, 31
DTV_ATSCMH_PARADE_ID #
Used only on ATSC-MH.
Parade identification number
A parade is a collection of up to eight MH groups, conveying one or two ensembles.
Possible values: 0, 1, 2, 3, ..., 126, 127
DTV_ATSCMH_NOG #
Used only on ATSC-MH.
Number of MH groups per MH subframe for a designated parade.
Possible values: 1, 2, 3, 4, 5, 6, 7, 8
DTV_ATSCMH_TNOG #
Used only on ATSC-MH.
Total number of MH groups including all MH groups belonging to all MH parades in one MH subframe.
Possible values: 0, 1, 2, 3, ..., 30, 31
DTV_ATSCMH_SGN #
Used only on ATSC-MH.
Start group number.
Possible values: 0, 1, 2, 3, ..., 14, 15
DTV_ATSCMH_PRC #
Used only on ATSC-MH.
Parade repetition cycle.
Possible values: 1, 2, 3, 4, 5, 6, 7, 8
DTV_ATSCMH_RS_FRAME_MODE #
Used only on ATSC-MH.
Reed Solomon (RS) frame mode.
The acceptable values are defined by atscmh_rs_frame_mode.
DTV_ATSCMH_RS_FRAME_ENSEMBLE #
Used only on ATSC-MH.
Reed Solomon (RS) frame ensemble.
The acceptable values are defined by atscmh_rs_frame_ensemble.
DTV_ATSCMH_RS_CODE_MODE_PRI #
Used only on ATSC-MH.
Reed Solomon (RS) code mode (primary).
The acceptable values are defined by atscmh_rs_code_mode.
DTV_ATSCMH_RS_CODE_MODE_SEC #
Used only on ATSC-MH.
Reed Solomon (RS) code mode (secondary).
The acceptable values are defined by atscmh_rs_code_mode.
DTV_ATSCMH_SCCC_BLOCK_MODE #
Used only on ATSC-MH.
Series Concatenated Convolutional Code Block Mode.
The acceptable values are defined by atscmh_sccc_block_mode.
DTV_ATSCMH_SCCC_CODE_MODE_A #
Used only on ATSC-MH.
Series Concatenated Convolutional Code Rate.
The acceptable values are defined by atscmh_sccc_code_mode.
DTV_ATSCMH_SCCC_CODE_MODE_B #
Used only on ATSC-MH.
Series Concatenated Convolutional Code Rate.
Possible values are the same as documented on enum atscmh_sccc_code_mode.
DTV_ATSCMH_SCCC_CODE_MODE_C #
Used only on ATSC-MH.
Series Concatenated Convolutional Code Rate.
Possible values are the same as documented on enum atscmh_sccc_code_mode.
DTV_ATSCMH_SCCC_CODE_MODE_D #
Used only on ATSC-MH.
Series Concatenated Convolutional Code Rate.
Possible values are the same as documented on enum atscmh_sccc_code_mode.
DTV_API_VERSION #
Returns the major/minor version of the Digital TV API
DTV_CODE_RATE_HP #
Used on terrestrial transmissions.
The acceptable values are defined by fe_transmit_mode.
DTV_CODE_RATE_LP #
Used on terrestrial transmissions.
The acceptable values are defined by fe_transmit_mode.
DTV_GUARD_INTERVAL #
The acceptable values are defined by fe_guard_interval.
DTV_TRANSMISSION_MODE #
Used only on OFTM-based standards, e. g. DVB-T/T2, ISDB-T, DTMB.
Specifies the FFT size (with corresponds to the approximate number of carriers) used by the standard.
The acceptable values are defined by fe_transmit_mode.
DTV_HIERARCHY #
Used only on DVB-T and DVB-T2.
Frontend hierarchy.
The acceptable values are defined by fe_hierarchy.
DTV_STREAM_ID #
Used on DVB-C2, DVB-S2, DVB-T2 and ISDB-S.
DVB-C2, DVB-S2, DVB-T2 and ISDB-S support the transmission of several streams on a single transport stream. This property enables the digital TV driver to handle substream filtering, when supported by the hardware. By default, substream filtering is disabled.
For DVB-C2, DVB-S2 and DVB-T2, the valid substream id range is from 0 to 255.
For ISDB, the valid substream id range is from 1 to 65535.
To disable it, you should use the special macro NO_STREAM_ID_FILTER.
Note: any value outside the id range also disables filtering.
DTV_DVBT2_PLP_ID_LEGACY #
Obsolete, replaced with DTV_STREAM_ID.
DTV_ENUM_DELSYS #
A Multi standard frontend needs to advertise the delivery systems provided. Applications need to enumerate the provided delivery systems, before using any other operation with the frontend. Prior to its introduction, FE_GET_INFO was used to determine a frontend type. A frontend which provides more than a single delivery system, FE_GET_INFO doesn't help much. Applications which intends to use a multistandard frontend must enumerate the delivery systems associated with it, rather than trying to use FE_GET_INFO. In the case of a legacy frontend, the result is just the same as with FE_GET_INFO, but in a more structured format.
The acceptable values are defined by fe_delivery_system.
DTV_INTERLEAVING #
Time interleaving to be used.
The acceptable values are defined by fe_interleaving.
DTV_LNA #
Low-noise amplifier.
Hardware might offer controllable LNA which can be set manually using that parameter. Usually LNA could be found only from terrestrial devices if at all.
Possible values: 0, 1, LNA_AUTO
0, LNA off
1, LNA on
use the special macro LNA_AUTO to set LNA auto
DTV_SCRAMBLING_SEQUENCE_INDEX #
Used on DVB-S2.
This 18 bit field, when present, carries the index of the DVB-S2 physical layer scrambling sequence as defined in clause 5.5.4 of EN 302 307. There is no explicit signalling method to convey scrambling sequence index to the receiver. If S2 satellite delivery system descriptor is available it can be used to read the scrambling sequence index (EN 300 468 table 41).
By default, gold scrambling sequence index 0 is used.
The valid scrambling sequence index range is from 0 to 262142.
Frontend uAPI data types
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
enum fe_caps #
Frontend capabilities
Constants
FE_IS_STUPID: There's something wrong at the frontend, and it can't report its capabilities.FE_CAN_INVERSION_AUTO: Can auto-detect frequency spectral band inversionFE_CAN_FEC_1_2: Supports FEC 1/2FE_CAN_FEC_2_3: Supports FEC 2/3FE_CAN_FEC_3_4: Supports FEC 3/4FE_CAN_FEC_4_5: Supports FEC 4/5FE_CAN_FEC_5_6: Supports FEC 5/6FE_CAN_FEC_6_7: Supports FEC 6/7FE_CAN_FEC_7_8: Supports FEC 7/8FE_CAN_FEC_8_9: Supports FEC 8/9FE_CAN_FEC_AUTO: Can auto-detect FECFE_CAN_QPSK: Supports QPSK modulationFE_CAN_QAM_16: Supports 16-QAM modulationFE_CAN_QAM_32: Supports 32-QAM modulationFE_CAN_QAM_64: Supports 64-QAM modulationFE_CAN_QAM_128: Supports 128-QAM modulationFE_CAN_QAM_256: Supports 256-QAM modulationFE_CAN_QAM_AUTO: Can auto-detect QAM modulationFE_CAN_TRANSMISSION_MODE_AUTO: Can auto-detect transmission modeFE_CAN_BANDWIDTH_AUTO: Can auto-detect bandwidthFE_CAN_GUARD_INTERVAL_AUTO: Can auto-detect guard intervalFE_CAN_HIERARCHY_AUTO: Can auto-detect hierarchyFE_CAN_8VSB: Supports 8-VSB modulationFE_CAN_16VSB: Supporta 16-VSB modulationFE_HAS_EXTENDED_CAPS: UnusedFE_CAN_MULTISTREAM: Supports multistream filteringFE_CAN_TURBO_FEC: Supports "turbo FEC" modulationFE_CAN_2G_MODULATION: Supports "2nd generation" modulation, e. g. DVB-S2, DVB-T2, DVB-C2FE_NEEDS_BENDING: UnusedFE_CAN_RECOVER: Can recover from a cable unplug automaticallyFE_CAN_MUTE_TS: Can stop spurious TS data output
struct dvb_frontend_info #
Frontend properties and capabilities
Definition
;
Members
-
name: Name of the frontend -
type:DEPRECATED. Should not be used on modern programs, as a frontend may have more than one type. In order to get the support types of a given frontend, use
DTV_ENUM_DELSYSinstead. -
frequency_min: Minimal frequency supported by the frontend. -
frequency_max: Minimal frequency supported by the frontend. -
frequency_stepsize: All frequencies are multiple of this value. -
frequency_tolerance: Frequency tolerance. -
symbol_rate_min: Minimal symbol rate, in bauds (for Cable/Satellite systems). -
symbol_rate_max: Maximal symbol rate, in bauds (for Cable/Satellite systems). -
symbol_rate_tolerance: Maximal symbol rate tolerance, in ppm (for Cable/Satellite systems). -
notifier_delay:DEPRECATED. Not used by any driver.
-
caps: Capabilities supported by the frontend, as specified inenum fe_caps.
Description
struct dvb_diseqc_master_cmd #
DiSEqC master command
Definition
;
Members
msg: DiSEqC message to be sent. It contains a 3 bytes header with: framing + address + command, and an optional argument of up to 3 bytes of data.msg_len: Length of the DiSEqC message. Valid values are 3 to 6.
Description
Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for the possible messages that can be used.
struct dvb_diseqc_slave_reply #
DiSEqC received data
Definition
;
Members
msg: DiSEqC message buffer to store a message received via DiSEqC. It contains one byte header with: framing and an optional argument of up to 3 bytes of data.msg_len: Length of the DiSEqC message. Valid values are 0 to 4, where 0 means no message.timeout: Return from ioctl after timeout ms with errorcode when no message was received.
Description
Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for the possible messages that can be used.
enum fe_sec_voltage #
DC Voltage used to feed the LNBf
Constants
SEC_VOLTAGE_13: Output 13V to the LNBfSEC_VOLTAGE_18: Output 18V to the LNBfSEC_VOLTAGE_OFF: Don't feed the LNBf with a DC voltage
enum fe_sec_tone_mode #
Type of tone to be send to the LNBf.
Constants
SEC_TONE_ON: Sends a 22kHz tone burst to the antenna.SEC_TONE_OFF: Don't send a 22kHz tone to the antenna (except if theFE_DISEQC_*ioctls are called).
enum fe_sec_mini_cmd #
Type of mini burst to be sent
Constants
SEC_MINI_A: Sends a mini-DiSEqC 22kHz '0' Tone Burst to select satellite-ASEC_MINI_B: Sends a mini-DiSEqC 22kHz '1' Data Burst to select satellite-B
enum fe_status #
Enumerates the possible frontend status.
Constants
FE_NONE: The frontend doesn't have any kind of lock. That's the initial frontend statusFE_HAS_SIGNAL: Has found something above the noise level.FE_HAS_CARRIER: Has found a signal.FE_HAS_VITERBI: FEC inner coding (Viterbi, LDPC or other inner code). is stable.FE_HAS_SYNC: Synchronization bytes was found.FE_HAS_LOCK: Digital TV were locked and everything is working.FE_TIMEDOUT: Fo lock within the last about 2 seconds.FE_REINIT: Frontend was reinitialized, application is recommended to reset DiSEqC, tone and parameters.
enum fe_spectral_inversion #
Type of inversion band
Constants
INVERSION_OFF: Don't do spectral band inversion.INVERSION_ON: Do spectral band inversion.INVERSION_AUTO: Autodetect spectral band inversion.
Description
This parameter indicates if spectral inversion should be presumed or
not. In the automatic setting (INVERSION_AUTO) the hardware will try
to figure out the correct setting by itself. If the hardware doesn't
support, the dvb_frontend will try to lock at the carrier first with
inversion off. If it fails, it will try to enable inversion.
enum fe_code_rate #
Type of Forward Error Correction (FEC)
Constants
FEC_NONE: No Forward Error Correction CodeFEC_1_2: Forward Error Correction Code 1/2FEC_2_3: Forward Error Correction Code 2/3FEC_3_4: Forward Error Correction Code 3/4FEC_4_5: Forward Error Correction Code 4/5FEC_5_6: Forward Error Correction Code 5/6FEC_6_7: Forward Error Correction Code 6/7FEC_7_8: Forward Error Correction Code 7/8FEC_8_9: Forward Error Correction Code 8/9FEC_AUTO: Autodetect Error Correction CodeFEC_3_5: Forward Error Correction Code 3/5FEC_9_10: Forward Error Correction Code 9/10FEC_2_5: Forward Error Correction Code 2/5FEC_1_3: Forward Error Correction Code 1/3FEC_1_4: Forward Error Correction Code 1/4FEC_5_9: Forward Error Correction Code 5/9FEC_7_9: Forward Error Correction Code 7/9FEC_8_15: Forward Error Correction Code 8/15FEC_11_15: Forward Error Correction Code 11/15FEC_13_18: Forward Error Correction Code 13/18FEC_9_20: Forward Error Correction Code 9/20FEC_11_20: Forward Error Correction Code 11/20FEC_23_36: Forward Error Correction Code 23/36FEC_25_36: Forward Error Correction Code 25/36FEC_13_45: Forward Error Correction Code 13/45FEC_26_45: Forward Error Correction Code 26/45FEC_28_45: Forward Error Correction Code 28/45FEC_32_45: Forward Error Correction Code 32/45FEC_77_90: Forward Error Correction Code 77/90FEC_11_45: Forward Error Correction Code 11/45FEC_4_15: Forward Error Correction Code 4/15FEC_14_45: Forward Error Correction Code 14/45FEC_7_15: Forward Error Correction Code 7/15
Description
Please note that not all FEC types are supported by a given standard.
enum fe_modulation #
Type of modulation/constellation
Constants
QPSK: QPSK modulationQAM_16: 16-QAM modulationQAM_32: 32-QAM modulationQAM_64: 64-QAM modulationQAM_128: 128-QAM modulationQAM_256: 256-QAM modulationQAM_AUTO: Autodetect QAM modulationVSB_8: 8-VSB modulationVSB_16: 16-VSB modulationPSK_8: 8-PSK modulationAPSK_16: 16-APSK modulationAPSK_32: 32-APSK modulationDQPSK: DQPSK modulationQAM_4_NR: 4-QAM-NR modulationQAM_1024: 1024-QAM modulationQAM_4096: 4096-QAM modulationAPSK_8_L: 8APSK-L modulationAPSK_16_L: 16APSK-L modulationAPSK_32_L: 32APSK-L modulationAPSK_64: 64APSK modulationAPSK_64_L: 64APSK-L modulation
Description
Please note that not all modulations are supported by a given standard.
enum fe_transmit_mode #
Transmission mode
Constants
TRANSMISSION_MODE_2K: Transmission mode 2KTRANSMISSION_MODE_8K: Transmission mode 8KTRANSMISSION_MODE_AUTO: Autodetect transmission mode. The hardware will try to find the correct FFT-size (if capable) to fill in the missing parameters.TRANSMISSION_MODE_4K: Transmission mode 4KTRANSMISSION_MODE_1K: Transmission mode 1KTRANSMISSION_MODE_16K: Transmission mode 16KTRANSMISSION_MODE_32K: Transmission mode 32KTRANSMISSION_MODE_C1: Single Carrier (C=1) transmission mode (DTMB only)TRANSMISSION_MODE_C3780: Multi Carrier (C=3780) transmission mode (DTMB only)
Description
Please note that not all transmission modes are supported by a given standard.
enum fe_guard_interval #
Guard interval
Constants
GUARD_INTERVAL_1_32: Guard interval 1/32GUARD_INTERVAL_1_16: Guard interval 1/16GUARD_INTERVAL_1_8: Guard interval 1/8GUARD_INTERVAL_1_4: Guard interval 1/4GUARD_INTERVAL_AUTO: Autodetect the guard intervalGUARD_INTERVAL_1_128: Guard interval 1/128GUARD_INTERVAL_19_128: Guard interval 19/128GUARD_INTERVAL_19_256: Guard interval 19/256GUARD_INTERVAL_PN420: PN length 420 (1/4)GUARD_INTERVAL_PN595: PN length 595 (1/6)GUARD_INTERVAL_PN945: PN length 945 (1/9)GUARD_INTERVAL_1_64: Guard interval 1/64
Description
Please note that not all guard intervals are supported by a given standard.
enum fe_hierarchy #
Hierarchy
Constants
HIERARCHY_NONE: No hierarchyHIERARCHY_1: Hierarchy 1HIERARCHY_2: Hierarchy 2HIERARCHY_4: Hierarchy 4HIERARCHY_AUTO: Autodetect hierarchy (if supported)
Description
Please note that not all hierarchy types are supported by a given standard.
enum fe_interleaving #
Interleaving
Constants
INTERLEAVING_NONE: No interleaving.INTERLEAVING_AUTO: Auto-detect interleaving.INTERLEAVING_240: Interleaving of 240 symbols.INTERLEAVING_720: Interleaving of 720 symbols.
Description
Please note that, currently, only DTMB uses it.
enum fe_pilot #
Type of pilot tone
Constants
PILOT_ON: Pilot tones enabledPILOT_OFF: Pilot tones disabledPILOT_AUTO: Autodetect pilot tones
enum fe_rolloff #
Rolloff factor
Constants
ROLLOFF_35: Roloff factor: α=35%ROLLOFF_20: Roloff factor: α=20%ROLLOFF_25: Roloff factor: α=25%ROLLOFF_AUTO: Auto-detect the roloff factor.ROLLOFF_15: Rolloff factor: α=15%ROLLOFF_10: Rolloff factor: α=10%ROLLOFF_5: Rolloff factor: α=5%
Description
enum fe_delivery_system #
Type of the delivery system
Constants
SYS_UNDEFINED: Undefined standard. Generally, indicates an errorSYS_DVBC_ANNEX_A: Cable TV: DVB-C following ITU-T J.83 Annex A specSYS_DVBC_ANNEX_B: Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM)SYS_DVBT: Terrestrial TV: DVB-TSYS_DSS: Satellite TV: DSS (not fully supported)SYS_DVBS: Satellite TV: DVB-SSYS_DVBS2: Satellite TV: DVB-S2 and DVB-S2XSYS_DVBH: Terrestrial TV (mobile): DVB-H (standard deprecated)SYS_ISDBT: Terrestrial TV: ISDB-TSYS_ISDBS: Satellite TV: ISDB-SSYS_ISDBC: Cable TV: ISDB-C (no drivers yet)SYS_ATSC: Terrestrial TV: ATSCSYS_ATSCMH: Terrestrial TV (mobile): ATSC-M/HSYS_DTMB: Terrestrial TV: DTMBSYS_CMMB: Terrestrial TV (mobile): CMMB (not fully supported)SYS_DAB: Digital audio: DAB (not fully supported)SYS_DVBT2: Terrestrial TV: DVB-T2SYS_TURBO: Satellite TV: DVB-S TurboSYS_DVBC_ANNEX_C: Cable TV: DVB-C following ITU-T J.83 Annex C specSYS_DVBC2: Cable TV: DVB-C2
enum atscmh_sccc_block_mode #
Type of Series Concatenated Convolutional Code Block Mode.
Constants
ATSCMH_SCCC_BLK_SEP: Separate SCCC: the SCCC outer code mode shall be set independently for each Group Region (A, B, C, D)ATSCMH_SCCC_BLK_COMB: Combined SCCC: all four Regions shall have the same SCCC outer code mode.ATSCMH_SCCC_BLK_RES: Reserved. Shouldn't be used.
enum atscmh_sccc_code_mode #
Type of Series Concatenated Convolutional Code Rate.
Constants
ATSCMH_SCCC_CODE_HLF: The outer code rate of a SCCC Block is 1/2 rate.ATSCMH_SCCC_CODE_QTR: The outer code rate of a SCCC Block is 1/4 rate.ATSCMH_SCCC_CODE_RES: Reserved. Should not be used.
enum atscmh_rs_frame_ensemble #
Reed Solomon(RS) frame ensemble.
Constants
ATSCMH_RSFRAME_ENS_PRI: Primary Ensemble.ATSCMH_RSFRAME_ENS_SEC: Secondary Ensemble.
enum atscmh_rs_frame_mode #
Reed Solomon (RS) frame mode.
Constants
ATSCMH_RSFRAME_PRI_ONLY: Single Frame: There is only a primary RS Frame for all Group Regions.ATSCMH_RSFRAME_PRI_SEC: Dual Frame: There are two separate RS Frames: Primary RS Frame for Group Region A and B and Secondary RS Frame for Group Region C and D.ATSCMH_RSFRAME_RES: Reserved. Shouldn't be used.
enum atscmh_rs_code_mode #
ATSC-M/H Reed Solomon modes
Constants
ATSCMH_RSCODE_211_187: Reed Solomon code (211,187).ATSCMH_RSCODE_223_187: Reed Solomon code (223,187).ATSCMH_RSCODE_235_187: Reed Solomon code (235,187).ATSCMH_RSCODE_RES: Reserved. Shouldn't be used.
enum fecap_scale_params #
scale types for the quality parameters.
Constants
FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That could indicate a temporary or a permanent condition.FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically used on signal measures.FE_SCALE_RELATIVE: The scale is a relative percentual measure, ranging from 0 (0%) to 0xffff (100%).FE_SCALE_COUNTER: The scale counts the occurrence of an event, like bit error, block error, lapsed time.
struct dtv_stats #
Used for reading a DTV status property
Definition
;
Members
scale: Filled with enum fecap_scale_params - the scale in usage for that parameter{unnamed_union}: anonymousuvalue: unsigned integer value of the measure, used when scale is eitherFE_SCALE_RELATIVEorFE_SCALE_COUNTER.svalue: integer value of the measure, forFE_SCALE_DECIBEL, used for dB measures. The unit is 0.001 dB.
Description
For most delivery systems, this will return a single value for each parameter.
It should be noticed, however, that new OFDM delivery systems like ISDB can use different modulation types for each group of carriers. On such standards, up to 8 groups of statistics can be provided, one for each carrier group (called "layer" on ISDB).
In order to be consistent with other delivery systems, the first value refers to the entire set of carriers ("global").
scale should use the value FE_SCALE_NOT_AVAILABLE when
the value for the entire group of carriers or from one specific layer
is not provided by the hardware.
len should be filled with the latest filled status + 1.
In other words, for ISDB, those values should be filled like:
u.st.stat.svalue[0] = global statistics;
u.st.stat.scale[0] = FE_SCALE_DECIBEL;
u.st.stat.value[1] = layer A statistics;
u.st.stat.scale[1] = FE_SCALE_NOT_AVAILABLE (if not available);
u.st.stat.svalue[2] = layer B statistics;
u.st.stat.scale[2] = FE_SCALE_DECIBEL;
u.st.stat.svalue[3] = layer C statistics;
u.st.stat.scale[3] = FE_SCALE_DECIBEL;
u.st.len = 4;
struct dtv_fe_stats #
store Digital TV frontend statistics
Definition
;
Members
len: length of the statistics - if zero, stats is disabled.stat: array with digital TV statistics.
Description
On most standards, len can either be 0 or 1. However, for ISDB, each layer is modulated in separate. So, each layer may have its own set of statistics. If so, stat[0] carries on a global value for the property. Indexes 1 to 3 means layer A to B.
struct dtv_property #
store one of frontend command and its value
Definition
;
Members
cmd: Digital TV command.reserved: Not used.u: Union with the values for the command.u.data: A unsigned 32 bits integer with command value.u.st: astruct dtv_fe_statsarray of statistics.u.buffer: Struct to store bigger properties. Currently unused.u.buffer.data: an unsigned 32-bits array.u.buffer.len: number of elements of the buffer.u.buffer.reserved1: Reserved.u.buffer.reserved2: Reserved.result: Currently unused.
struct dtv_properties #
a set of command/value pairs.
Definition
;
Members
num: amount of commands stored at the struct.props: a pointer tostruct dtv_property.
Properties used on cable delivery systems
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
DVB-C delivery system #
The DVB-C Annex-A is the widely used cable standard. Transmission uses QAM modulation.
The DVB-C Annex-C is optimized for 6MHz, and is used in Japan. It supports a subset of the Annex A modulation types, and a roll-off of 0.13, instead of 0.15
The following parameters are valid for DVB-C Annex A/C:
In addition, the DTV QoS statistics are also valid.
DVB-C Annex B delivery system #
The DVB-C Annex-B is only used on a few Countries like the United States.
The following parameters are valid for DVB-C Annex B:
In addition, the DTV QoS statistics are also valid.
Properties used on satellite delivery systems
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
DVB-S delivery system #
The following parameters are valid for DVB-S:
In addition, the DTV QoS statistics are also valid.
Future implementations might add those two missing parameters:
DVB-S2 delivery system #
In addition to all parameters valid for DVB-S, DVB-S2 supports the following parameters:
In addition, the DTV QoS statistics are also valid.
Turbo code delivery system #
In addition to all parameters valid for DVB-S, turbo code supports the following parameters:
ISDB-S delivery system #
The following parameters are valid for ISDB-S:
Properties used on terrestrial delivery systems
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
DVB-T delivery system #
The following parameters are valid for DVB-T:
In addition, the DTV QoS statistics are also valid.
DVB-T2 delivery system #
DVB-T2 support is currently in the early stages of development, so expect that this section may grow and become more detailed with time.
The following parameters are valid for DVB-T2:
In addition, the DTV QoS statistics are also valid.
ISDB-T delivery system #
This ISDB-T/ISDB-Tsb API extension should reflect all information needed to tune any ISDB-T/ISDB-Tsb hardware. Of course it is possible that some very sophisticated devices won't need certain parameters to tune.
The information given here should help application writers to know how to handle ISDB-T and ISDB-Tsb hardware using the Linux Digital TV API.
The details given here about ISDB-T and ISDB-Tsb are just enough to basically show the dependencies between the needed parameter values, but surely some information is left out. For more detailed information see the following documents:
ARIB STD-B31 - "Transmission System for Digital Terrestrial Television Broadcasting" and
ARIB TR-B14 - "Operational Guidelines for Digital Terrestrial Television Broadcasting".
In order to understand the ISDB specific parameters, one has to have some knowledge the channel structure in ISDB-T and ISDB-Tsb. I.e. it has to be known to the reader that an ISDB-T channel consists of 13 segments, that it can have up to 3 layer sharing those segments, and things like that.
The following parameters are valid for ISDB-T:
In addition, the DTV QoS statistics are also valid.
ATSC delivery system #
The following parameters are valid for ATSC:
In addition, the DTV QoS statistics are also valid.
ATSC-MH delivery system #
The following parameters are valid for ATSC-MH:
In addition, the DTV QoS statistics are also valid.
DTMB delivery system #
The following parameters are valid for DTMB:
In addition, the DTV QoS statistics are also valid.
Frontend statistics indicators
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
The values are returned via dtv_property.stat. If the property is supported, dtv_property.stat.len is bigger than zero.
For most delivery systems, dtv_property.stat.len will be 1 if the stats is supported, and the properties will return a single value for each parameter.
It should be noted, however, that new OFDM delivery systems like ISDB can use different modulation types for each group of carriers. On such standards, up to 3 groups of statistics can be provided, and dtv_property.stat.len is updated to reflect the "global" metrics, plus one metric per each carrier group (called "layer" on ISDB).
So, in order to be consistent with other delivery systems, the first value at dtv_property.stat.dtv_stats <dtv_stats> array refers to the global metric. The other elements of the array represent each layer, starting from layer A(index 1), layer B (index 2) and so on.
The number of filled elements are stored at dtv_property.stat.len.
Each element of the dtv_property.stat.dtv_stats array consists on two elements:
-
svalueoruvalue, wheresvalueis for signed values of the measure (dB measures) anduvalueis for unsigned values (counters, relative scale) -
scale- Scale for the value. It can be:-
FE_SCALE_NOT_AVAILABLE- The parameter is supported by the frontend, but it was not possible to collect it (could be a transitory or permanent condition) -
FE_SCALE_DECIBEL- parameter is a signed value, measured in 1/1000 dB -
FE_SCALE_RELATIVE- parameter is a unsigned value, where 0 means 0% and 65535 means 100%. -
FE_SCALE_COUNTER- parameter is a unsigned value that counts the occurrence of an event, like bit error, block error, or lapsed time.
-
DTV_STAT_SIGNAL_STRENGTH #
Indicates the signal strength level at the analog part of the tuner or of the demod.
Possible scales for this metric are:
-
FE_SCALE_NOT_AVAILABLE- it failed to measure it, or the measurement was not complete yet. -
FE_SCALE_DECIBEL- signal strength is in 0.001 dBm units, power measured in miliwatts. This value is generally negative. -
FE_SCALE_RELATIVE- The frontend provides a 0% to 100% measurement for power (actually, 0 to 65535).
DTV_STAT_CNR #
Indicates the Signal to Noise ratio for the main carrier.
Possible scales for this metric are:
-
FE_SCALE_NOT_AVAILABLE- it failed to measure it, or the measurement was not complete yet. -
FE_SCALE_DECIBEL- Signal/Noise ratio is in 0.001 dB units. -
FE_SCALE_RELATIVE- The frontend provides a 0% to 100% measurement for Signal/Noise (actually, 0 to 65535).
DTV_STAT_PRE_ERROR_BIT_COUNT #
Measures the number of bit errors before the forward error correction (FEC) on the inner coding block (before Viterbi, LDPC or other inner code).
This measure is taken during the same interval as DTV_STAT_PRE_TOTAL_BIT_COUNT.
In order to get the BER (Bit Error Rate) measurement, it should be divided by DTV_STAT_PRE_TOTAL_BIT_COUNT.
This measurement is monotonically increased, as the frontend gets more bit count measurements. The frontend may reset it when a channel/transponder is tuned.
Possible scales for this metric are:
-
FE_SCALE_NOT_AVAILABLE- it failed to measure it, or the measurement was not complete yet. -
FE_SCALE_COUNTER- Number of error bits counted before the inner coding.
DTV_STAT_PRE_TOTAL_BIT_COUNT #
Measures the amount of bits received before the inner code block, during the same period as DTV_STAT_PRE_ERROR_BIT_COUNT measurement was taken.
It should be noted that this measurement can be smaller than the total amount of bits on the transport stream, as the frontend may need to manually restart the measurement, losing some data between each measurement interval.
This measurement is monotonically increased, as the frontend gets more bit count measurements. The frontend may reset it when a channel/transponder is tuned.
Possible scales for this metric are:
-
FE_SCALE_NOT_AVAILABLE- it failed to measure it, or the measurement was not complete yet. -
FE_SCALE_COUNTER- Number of bits counted while measuring DTV_STAT_PRE_ERROR_BIT_COUNT.
DTV_STAT_POST_ERROR_BIT_COUNT #
Measures the number of bit errors after the forward error correction (FEC) done by inner code block (after Viterbi, LDPC or other inner code).
This measure is taken during the same interval as DTV_STAT_POST_TOTAL_BIT_COUNT.
In order to get the BER (Bit Error Rate) measurement, it should be divided by DTV_STAT_POST_TOTAL_BIT_COUNT.
This measurement is monotonically increased, as the frontend gets more bit count measurements. The frontend may reset it when a channel/transponder is tuned.
Possible scales for this metric are:
-
FE_SCALE_NOT_AVAILABLE- it failed to measure it, or the measurement was not complete yet. -
FE_SCALE_COUNTER- Number of error bits counted after the inner coding.
DTV_STAT_POST_TOTAL_BIT_COUNT #
Measures the amount of bits received after the inner coding, during the same period as DTV_STAT_POST_ERROR_BIT_COUNT measurement was taken.
It should be noted that this measurement can be smaller than the total amount of bits on the transport stream, as the frontend may need to manually restart the measurement, losing some data between each measurement interval.
This measurement is monotonically increased, as the frontend gets more bit count measurements. The frontend may reset it when a channel/transponder is tuned.
Possible scales for this metric are:
-
FE_SCALE_NOT_AVAILABLE- it failed to measure it, or the measurement was not complete yet. -
FE_SCALE_COUNTER- Number of bits counted while measuring DTV_STAT_POST_ERROR_BIT_COUNT.
DTV_STAT_ERROR_BLOCK_COUNT #
Measures the number of block errors after the outer forward error correction coding (after Reed-Solomon or other outer code).
This measurement is monotonically increased, as the frontend gets more bit count measurements. The frontend may reset it when a channel/transponder is tuned.
Possible scales for this metric are:
-
FE_SCALE_NOT_AVAILABLE- it failed to measure it, or the measurement was not complete yet. -
FE_SCALE_COUNTER- Number of error blocks counted after the outer coding.
DTV-STAT_TOTAL_BLOCK_COUNT #
Measures the total number of blocks received during the same period as DTV_STAT_ERROR_BLOCK_COUNT measurement was taken.
It can be used to calculate the PER indicator, by dividing DTV_STAT_ERROR_BLOCK_COUNT by DTV-STAT_TOTAL_BLOCK_COUNT.
Possible scales for this metric are:
-
FE_SCALE_NOT_AVAILABLE- it failed to measure it, or the measurement was not complete yet. -
FE_SCALE_COUNTER- Number of blocks counted while measuring DTV_STAT_ERROR_BLOCK_COUNT.
Digital TV Frontend API
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
The Digital TV frontend API was designed to support three groups of delivery systems: Terrestrial, cable and Satellite. Currently, the following delivery systems are supported:
-
Terrestrial systems: DVB-T, DVB-T2, ATSC, ATSC M/H, ISDB-T, DVB-H, DTMB, CMMB
-
Cable systems: DVB-C Annex A/C, ClearQAM (DVB-C Annex B)
-
Satellite systems: DVB-S, DVB-S2, DVB Turbo, ISDB-S, DSS
The Digital TV frontend controls several sub-devices including:
-
Tuner
-
Digital TV demodulator
-
Low noise amplifier (LNA)
-
Satellite Equipment Control (SEC) 1.
The frontend can be accessed through /dev/dvb/adapter?/frontend?. Data types and ioctl definitions can be accessed by including linux/dvb/frontend.h in your application.
[1] On Satellite systems, the API support for the Satellite Equipment Control (SEC) allows to power control and to send/receive signals to control the antenna subsystem, selecting the polarization and choosing the Intermediate Frequency IF) of the Low Noise Block Converter Feed Horn (LNBf). It supports the DiSEqC and V-SEC protocols. The DiSEqC (digital SEC) specification is available at Eutelsat.
Digital TV frontend close()
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
fe-close - Close a frontend device
Synopsis #
int Arguments #
-
fdFile descriptor returned by
open().
Description #
This system call closes a previously opened front-end device. After closing a front-end device, its corresponding hardware might be powered down automatically.
Return Value #
On success 0 is returned.
On error -1 is returned, and the errno variable is set appropriately.
Generic error codes are described at the Generic Error Codes chapter.
Digital TV frontend open()
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
fe-open - Open a frontend device
Synopsis #
int Arguments #
-
device_nameDevice to be opened.
-
flagsOpen flags. Access can either be
O_RDWRorO_RDONLY.Multiple opens are allowed with
O_RDONLY. In this mode, only query and read ioctls are allowed.Only one open is allowed in
O_RDWR. In this mode, all ioctls are allowed.When the
O_NONBLOCKflag is given, the system calls may returnEAGAINerror code when no data is available or when the device driver is temporarily busy.Other flags have no effect.
Description #
This system call opens a named frontend device (/dev/dvb/adapter?/frontend?) for subsequent use. Usually the first thing to do after a successful open is to find out the frontend type with ioctl FE_GET_INFO.
The device can be opened in read-only mode, which only allows monitoring of device status and statistics, or read/write mode, which allows any kind of use (e.g. performing tuning operations.)
In a system with multiple front-ends, it is usually the case that multiple devices cannot be open in read/write mode simultaneously. As long as a front-end device is opened in read/write mode, other open() calls in read/write mode will either fail or block, depending on whether non-blocking or blocking mode was specified. A front-end device opened in blocking mode can later be put into non-blocking mode (and vice versa) using the F_SETFL command of the fcntl system call. This is a standard system call, documented in the Linux manual page for fcntl. When an open() call has succeeded, the device will be ready for use in the specified mode. This implies that the corresponding hardware is powered up, and that other front-ends may have been powered down to make that possible.
Return Value #
On success open() returns the new file descriptor. On error, -1 is returned, and the errno variable is set appropriately.
Possible error codes are:
On success 0 is returned, and ca_slot_info is filled.
On error -1 is returned, and the errno variable is set appropriately.
|
|
The caller has no permission to access the device. |
|
|
The device driver is already in use. |
|
|
The process already has the maximum number of files open. |
|
|
The limit on the total number of files open on the system has been reached. |
The generic error codes are described at the Generic Error Codes chapter.
Frontend Function Calls
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
- Digital TV frontend open()
- Digital TV frontend close()
- ioctl FE_GET_INFO
- ioctl FE_READ_STATUS
- ioctl FE_SET_PROPERTY, FE_GET_PROPERTY
- ioctl FE_DISEQC_RESET_OVERLOAD
- ioctl FE_DISEQC_SEND_MASTER_CMD
- ioctl FE_DISEQC_RECV_SLAVE_REPLY
- ioctl FE_DISEQC_SEND_BURST
- ioctl FE_SET_TONE
- ioctl FE_SET_VOLTAGE
- ioctl FE_ENABLE_HIGH_LNB_VOLTAGE
- ioctl FE_SET_FRONTEND_TUNE_MODE
Frontend Legacy Data Types
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Frontend Legacy Data Types #
Frontend Legacy Function Calls #
Those functions are defined at DVB version 3. The support is kept in the kernel due to compatibility issues only. Their usage is strongly not recommended
Digital TV Frontend legacy API (a. k. a. DVBv3)
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
The usage of this API is deprecated, as it doesn't support all digital TV standards, doesn't provide good statistics measurements and provides incomplete information. This is kept only to support legacy applications.
Digital TV uAPI symbols
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Frontend #
Enumeration values #
BANDWIDTH_10_MHZ:include/uapi/linux/dvb/frontend.h, line 987BANDWIDTH_1_712_MHZ:include/uapi/linux/dvb/frontend.h, line 988BANDWIDTH_5_MHZ:include/uapi/linux/dvb/frontend.h, line 986BANDWIDTH_6_MHZ:include/uapi/linux/dvb/frontend.h, line 984BANDWIDTH_7_MHZ:include/uapi/linux/dvb/frontend.h, line 983BANDWIDTH_8_MHZ:include/uapi/linux/dvb/frontend.h, line 982BANDWIDTH_AUTO:include/uapi/linux/dvb/frontend.h, line 985FE_ATSC:include/uapi/linux/dvb/frontend.h, line 98FE_OFDM:include/uapi/linux/dvb/frontend.h, line 97FE_QAM:include/uapi/linux/dvb/frontend.h, line 96FE_QPSK:include/uapi/linux/dvb/frontend.h, line 95
Enumerations #
atscmh_rs_code_mode:include/uapi/linux/dvb/frontend.h, line 778atscmh_rs_frame_ensemble:include/uapi/linux/dvb/frontend.h, line 747atscmh_rs_frame_mode:include/uapi/linux/dvb/frontend.h, line 765atscmh_sccc_block_mode:include/uapi/linux/dvb/frontend.h, line 718atscmh_sccc_code_mode:include/uapi/linux/dvb/frontend.h, line 735fe_bandwidth:include/uapi/linux/dvb/frontend.h, line 981fe_caps:include/uapi/linux/dvb/frontend.h, line 57fe_code_rate:include/uapi/linux/dvb/frontend.h, line 306fe_delivery_system:include/uapi/linux/dvb/frontend.h, line 676fe_guard_interval:include/uapi/linux/dvb/frontend.h, line 449fe_hierarchy:include/uapi/linux/dvb/frontend.h, line 474fe_interleaving:include/uapi/linux/dvb/frontend.h, line 491fe_modulation:include/uapi/linux/dvb/frontend.h, line 369fe_pilot:include/uapi/linux/dvb/frontend.h, line 602fe_rolloff:include/uapi/linux/dvb/frontend.h, line 622fe_sec_mini_cmd:include/uapi/linux/dvb/frontend.h, line 218fe_sec_tone_mode:include/uapi/linux/dvb/frontend.h, line 205fe_sec_voltage:include/uapi/linux/dvb/frontend.h, line 193fe_spectral_inversion:include/uapi/linux/dvb/frontend.h, line 261fe_status:include/uapi/linux/dvb/frontend.h, line 237fe_transmit_mode:include/uapi/linux/dvb/frontend.h, line 419fe_type:include/uapi/linux/dvb/frontend.h, line 94fecap_scale_params:include/uapi/linux/dvb/frontend.h, line 801
IOCTL Commands #
FE_DISEQC_RECV_SLAVE_REPLY:include/uapi/linux/dvb/frontend.h, line 941FE_DISEQC_RESET_OVERLOAD:include/uapi/linux/dvb/frontend.h, line 939FE_DISEQC_SEND_BURST:include/uapi/linux/dvb/frontend.h, line 942FE_DISEQC_SEND_MASTER_CMD:include/uapi/linux/dvb/frontend.h, line 940FE_DISHNETWORK_SEND_LEGACY_CMD:include/uapi/linux/dvb/frontend.h, line 957FE_ENABLE_HIGH_LNB_VOLTAGE:include/uapi/linux/dvb/frontend.h, line 946FE_GET_EVENT:include/uapi/linux/dvb/frontend.h, line 955FE_GET_FRONTEND:include/uapi/linux/dvb/frontend.h, line 1056FE_GET_INFO:include/uapi/linux/dvb/frontend.h, line 937FE_GET_PROPERTY:include/uapi/linux/dvb/frontend.h, line 960FE_READ_BER:include/uapi/linux/dvb/frontend.h, line 949FE_READ_SIGNAL_STRENGTH:include/uapi/linux/dvb/frontend.h, line 950FE_READ_SNR:include/uapi/linux/dvb/frontend.h, line 951FE_READ_STATUS:include/uapi/linux/dvb/frontend.h, line 948FE_READ_UNCORRECTED_BLOCKS:include/uapi/linux/dvb/frontend.h, line 952FE_SET_FRONTEND:include/uapi/linux/dvb/frontend.h, line 1055FE_SET_FRONTEND_TUNE_MODE:include/uapi/linux/dvb/frontend.h, line 954FE_SET_PROPERTY:include/uapi/linux/dvb/frontend.h, line 959FE_SET_TONE:include/uapi/linux/dvb/frontend.h, line 944FE_SET_VOLTAGE:include/uapi/linux/dvb/frontend.h, line 945
Macros and Definitions #
DTV_API_VERSION:include/uapi/linux/dvb/frontend.h, line 544DTV_ATSCMH_FIC_VER:include/uapi/linux/dvb/frontend.h, line 561DTV_ATSCMH_NOG:include/uapi/linux/dvb/frontend.h, line 563DTV_ATSCMH_PARADE_ID:include/uapi/linux/dvb/frontend.h, line 562DTV_ATSCMH_PRC:include/uapi/linux/dvb/frontend.h, line 566DTV_ATSCMH_RS_CODE_MODE_PRI:include/uapi/linux/dvb/frontend.h, line 569DTV_ATSCMH_RS_CODE_MODE_SEC:include/uapi/linux/dvb/frontend.h, line 570DTV_ATSCMH_RS_FRAME_ENSEMBLE:include/uapi/linux/dvb/frontend.h, line 568DTV_ATSCMH_RS_FRAME_MODE:include/uapi/linux/dvb/frontend.h, line 567DTV_ATSCMH_SCCC_BLOCK_MODE:include/uapi/linux/dvb/frontend.h, line 571DTV_ATSCMH_SCCC_CODE_MODE_A:include/uapi/linux/dvb/frontend.h, line 572DTV_ATSCMH_SCCC_CODE_MODE_B:include/uapi/linux/dvb/frontend.h, line 573DTV_ATSCMH_SCCC_CODE_MODE_C:include/uapi/linux/dvb/frontend.h, line 574DTV_ATSCMH_SCCC_CODE_MODE_D:include/uapi/linux/dvb/frontend.h, line 575DTV_ATSCMH_SGN:include/uapi/linux/dvb/frontend.h, line 565DTV_ATSCMH_TNOG:include/uapi/linux/dvb/frontend.h, line 564DTV_BANDWIDTH_HZ:include/uapi/linux/dvb/frontend.h, line 505DTV_CLEAR:include/uapi/linux/dvb/frontend.h, line 502DTV_CODE_RATE_HP:include/uapi/linux/dvb/frontend.h, line 546DTV_CODE_RATE_LP:include/uapi/linux/dvb/frontend.h, line 547DTV_DELIVERY_SYSTEM:include/uapi/linux/dvb/frontend.h, line 519DTV_DISEQC_MASTER:include/uapi/linux/dvb/frontend.h, line 507DTV_DISEQC_SLAVE_REPLY:include/uapi/linux/dvb/frontend.h, line 514DTV_DVBT2_PLP_ID_LEGACY:include/uapi/linux/dvb/frontend.h, line 556DTV_ENUM_DELSYS:include/uapi/linux/dvb/frontend.h, line 558DTV_FE_CAPABILITY:include/uapi/linux/dvb/frontend.h, line 518DTV_FE_CAPABILITY_COUNT:include/uapi/linux/dvb/frontend.h, line 517DTV_FREQUENCY:include/uapi/linux/dvb/frontend.h, line 503DTV_GUARD_INTERVAL:include/uapi/linux/dvb/frontend.h, line 548DTV_HIERARCHY:include/uapi/linux/dvb/frontend.h, line 550DTV_INNER_FEC:include/uapi/linux/dvb/frontend.h, line 509DTV_INTERLEAVING:include/uapi/linux/dvb/frontend.h, line 577DTV_INVERSION:include/uapi/linux/dvb/frontend.h, line 506DTV_ISDBT_LAYERA_FEC:include/uapi/linux/dvb/frontend.h, line 529DTV_ISDBT_LAYERA_MODULATION:include/uapi/linux/dvb/frontend.h, line 530DTV_ISDBT_LAYERA_SEGMENT_COUNT:include/uapi/linux/dvb/frontend.h, line 531DTV_ISDBT_LAYERA_TIME_INTERLEAVING:include/uapi/linux/dvb/frontend.h, line 532DTV_ISDBT_LAYERB_FEC:include/uapi/linux/dvb/frontend.h, line 534DTV_ISDBT_LAYERB_MODULATION:include/uapi/linux/dvb/frontend.h, line 535DTV_ISDBT_LAYERB_SEGMENT_COUNT:include/uapi/linux/dvb/frontend.h, line 536DTV_ISDBT_LAYERB_TIME_INTERLEAVING:include/uapi/linux/dvb/frontend.h, line 537DTV_ISDBT_LAYERC_FEC:include/uapi/linux/dvb/frontend.h, line 539DTV_ISDBT_LAYERC_MODULATION:include/uapi/linux/dvb/frontend.h, line 540DTV_ISDBT_LAYERC_SEGMENT_COUNT:include/uapi/linux/dvb/frontend.h, line 541DTV_ISDBT_LAYERC_TIME_INTERLEAVING:include/uapi/linux/dvb/frontend.h, line 542DTV_ISDBT_LAYER_ENABLED:include/uapi/linux/dvb/frontend.h, line 552DTV_ISDBT_PARTIAL_RECEPTION:include/uapi/linux/dvb/frontend.h, line 522DTV_ISDBT_SB_SEGMENT_COUNT:include/uapi/linux/dvb/frontend.h, line 527DTV_ISDBT_SB_SEGMENT_IDX:include/uapi/linux/dvb/frontend.h, line 526DTV_ISDBT_SB_SUBCHANNEL_ID:include/uapi/linux/dvb/frontend.h, line 525DTV_ISDBT_SOUND_BROADCASTING:include/uapi/linux/dvb/frontend.h, line 523DTV_LNA:include/uapi/linux/dvb/frontend.h, line 578DTV_MODULATION:include/uapi/linux/dvb/frontend.h, line 504DTV_PILOT:include/uapi/linux/dvb/frontend.h, line 512DTV_ROLLOFF:include/uapi/linux/dvb/frontend.h, line 513DTV_SCRAMBLING_SEQUENCE_INDEX:include/uapi/linux/dvb/frontend.h, line 591DTV_STAT_CNR:include/uapi/linux/dvb/frontend.h, line 582DTV_STAT_ERROR_BLOCK_COUNT:include/uapi/linux/dvb/frontend.h, line 587DTV_STAT_POST_ERROR_BIT_COUNT:include/uapi/linux/dvb/frontend.h, line 585DTV_STAT_POST_TOTAL_BIT_COUNT:include/uapi/linux/dvb/frontend.h, line 586DTV_STAT_PRE_ERROR_BIT_COUNT:include/uapi/linux/dvb/frontend.h, line 583DTV_STAT_PRE_TOTAL_BIT_COUNT:include/uapi/linux/dvb/frontend.h, line 584DTV_STAT_SIGNAL_STRENGTH:include/uapi/linux/dvb/frontend.h, line 581DTV_STAT_TOTAL_BLOCK_COUNT:include/uapi/linux/dvb/frontend.h, line 588DTV_STREAM_ID:include/uapi/linux/dvb/frontend.h, line 554DTV_SYMBOL_RATE:include/uapi/linux/dvb/frontend.h, line 508DTV_TONE:include/uapi/linux/dvb/frontend.h, line 511DTV_TRANSMISSION_MODE:include/uapi/linux/dvb/frontend.h, line 549DTV_TUNE:include/uapi/linux/dvb/frontend.h, line 501DTV_UNDEFINED:include/uapi/linux/dvb/frontend.h, line 500DTV_VOLTAGE:include/uapi/linux/dvb/frontend.h, line 510FE_TUNE_MODE_ONESHOT:include/uapi/linux/dvb/frontend.h, line 933LNA_AUTO:include/uapi/linux/dvb/frontend.h, line 786NO_STREAM_ID_FILTER:include/uapi/linux/dvb/frontend.h, line 785
Structures #
dtv_fe_stats:include/uapi/linux/dvb/frontend.h, line 874dtv_properties:include/uapi/linux/dvb/frontend.h, line 921dtv_property:include/uapi/linux/dvb/frontend.h, line 896dtv_stats:include/uapi/linux/dvb/frontend.h, line 852dvb_diseqc_master_cmd:include/uapi/linux/dvb/frontend.h, line 158dvb_diseqc_slave_reply:include/uapi/linux/dvb/frontend.h, line 180dvb_frontend_event:include/uapi/linux/dvb/frontend.h, line 1048dvb_frontend_info:include/uapi/linux/dvb/frontend.h, line 131dvb_frontend_parameters:include/uapi/linux/dvb/frontend.h, line 1036dvb_ofdm_parameters:include/uapi/linux/dvb/frontend.h, line 1026dvb_qam_parameters:include/uapi/linux/dvb/frontend.h, line 1016dvb_qpsk_parameters:include/uapi/linux/dvb/frontend.h, line 1011dvb_vsb_parameters:include/uapi/linux/dvb/frontend.h, line 1022
Type Definitions #
fe_bandwidth_t:include/uapi/linux/dvb/frontend.h, line 1002fe_caps_t:include/uapi/linux/dvb/frontend.h, line 993fe_code_rate_t:include/uapi/linux/dvb/frontend.h, line 999fe_delivery_system_t:include/uapi/linux/dvb/frontend.h, line 1007fe_guard_interval_t:include/uapi/linux/dvb/frontend.h, line 1003fe_hierarchy_t:include/uapi/linux/dvb/frontend.h, line 1004fe_modulation_t:include/uapi/linux/dvb/frontend.h, line 1000fe_pilot_t:include/uapi/linux/dvb/frontend.h, line 1005fe_rolloff_t:include/uapi/linux/dvb/frontend.h, line 1006fe_sec_mini_cmd_t:include/uapi/linux/dvb/frontend.h, line 996fe_sec_tone_mode_t:include/uapi/linux/dvb/frontend.h, line 995fe_sec_voltage_t:include/uapi/linux/dvb/frontend.h, line 992fe_spectral_inversion_t:include/uapi/linux/dvb/frontend.h, line 998fe_status_t:include/uapi/linux/dvb/frontend.h, line 997fe_transmit_mode_t:include/uapi/linux/dvb/frontend.h, line 1001fe_type_t:include/uapi/linux/dvb/frontend.h, line 994
Demux #
Enumeration values #
DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED:include/uapi/linux/dvb/dmx.h, line 221DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR:include/uapi/linux/dvb/dmx.h, line 222DMX_BUFFER_FLAG_HAD_CRC32_DISCARD:include/uapi/linux/dvb/dmx.h, line 218DMX_BUFFER_FLAG_TEI:include/uapi/linux/dvb/dmx.h, line 219DMX_BUFFER_PKT_COUNTER_MISMATCH:include/uapi/linux/dvb/dmx.h, line 220DMX_IN_DVR:include/uapi/linux/dvb/dmx.h, line 54DMX_IN_FRONTEND:include/uapi/linux/dvb/dmx.h, line 53DMX_OUT_DECODER:include/uapi/linux/dvb/dmx.h, line 39DMX_OUT_TAP:include/uapi/linux/dvb/dmx.h, line 40DMX_OUT_TSDEMUX_TAP:include/uapi/linux/dvb/dmx.h, line 42DMX_OUT_TS_TAP:include/uapi/linux/dvb/dmx.h, line 41DMX_PES_AUDIO0:include/uapi/linux/dvb/dmx.h, line 89DMX_PES_AUDIO1:include/uapi/linux/dvb/dmx.h, line 95DMX_PES_AUDIO2:include/uapi/linux/dvb/dmx.h, line 101DMX_PES_AUDIO3:include/uapi/linux/dvb/dmx.h, line 107DMX_PES_OTHER:include/uapi/linux/dvb/dmx.h, line 113DMX_PES_PCR0:include/uapi/linux/dvb/dmx.h, line 93DMX_PES_PCR1:include/uapi/linux/dvb/dmx.h, line 99DMX_PES_PCR2:include/uapi/linux/dvb/dmx.h, line 105DMX_PES_PCR3:include/uapi/linux/dvb/dmx.h, line 111DMX_PES_SUBTITLE0:include/uapi/linux/dvb/dmx.h, line 92DMX_PES_SUBTITLE1:include/uapi/linux/dvb/dmx.h, line 98DMX_PES_SUBTITLE2:include/uapi/linux/dvb/dmx.h, line 104DMX_PES_SUBTITLE3:include/uapi/linux/dvb/dmx.h, line 110DMX_PES_TELETEXT0:include/uapi/linux/dvb/dmx.h, line 91DMX_PES_TELETEXT1:include/uapi/linux/dvb/dmx.h, line 97DMX_PES_TELETEXT2:include/uapi/linux/dvb/dmx.h, line 103DMX_PES_TELETEXT3:include/uapi/linux/dvb/dmx.h, line 109DMX_PES_VIDEO0:include/uapi/linux/dvb/dmx.h, line 90DMX_PES_VIDEO1:include/uapi/linux/dvb/dmx.h, line 96DMX_PES_VIDEO2:include/uapi/linux/dvb/dmx.h, line 102DMX_PES_VIDEO3:include/uapi/linux/dvb/dmx.h, line 108
Enumerations #
dmx_buffer_flags:include/uapi/linux/dvb/dmx.h, line 217dmx_input:include/uapi/linux/dvb/dmx.h, line 52dmx_output:include/uapi/linux/dvb/dmx.h, line 38dmx_ts_pes:include/uapi/linux/dvb/dmx.h, line 88
IOCTL Commands #
DMX_ADD_PID:include/uapi/linux/dvb/dmx.h, line 296DMX_DQBUF:include/uapi/linux/dvb/dmx.h, line 313DMX_EXPBUF:include/uapi/linux/dvb/dmx.h, line 311DMX_GET_PES_PIDS:include/uapi/linux/dvb/dmx.h, line 294DMX_GET_STC:include/uapi/linux/dvb/dmx.h, line 295DMX_QBUF:include/uapi/linux/dvb/dmx.h, line 312DMX_QUERYBUF:include/uapi/linux/dvb/dmx.h, line 310DMX_REMOVE_PID:include/uapi/linux/dvb/dmx.h, line 297DMX_REQBUFS:include/uapi/linux/dvb/dmx.h, line 309DMX_SET_BUFFER_SIZE:include/uapi/linux/dvb/dmx.h, line 293DMX_SET_FILTER:include/uapi/linux/dvb/dmx.h, line 291DMX_SET_PES_FILTER:include/uapi/linux/dvb/dmx.h, line 292DMX_START:include/uapi/linux/dvb/dmx.h, line 289DMX_STOP:include/uapi/linux/dvb/dmx.h, line 290
Macros and Definitions #
DMX_CHECK_CRC:include/uapi/linux/dvb/dmx.h, line 163DMX_IMMEDIATE_START:include/uapi/linux/dvb/dmx.h, line 165DMX_ONESHOT:include/uapi/linux/dvb/dmx.h, line 164
Structures #
dmx_buffer:include/uapi/linux/dvb/dmx.h, line 245dmx_exportbuffer:include/uapi/linux/dvb/dmx.h, line 283dmx_filter:include/uapi/linux/dvb/dmx.h, line 134dmx_pes_filter_params:include/uapi/linux/dvb/dmx.h, line 178dmx_requestbuffers:include/uapi/linux/dvb/dmx.h, line 263dmx_sct_filter_params:include/uapi/linux/dvb/dmx.h, line 158dmx_stc:include/uapi/linux/dvb/dmx.h, line 193
Type Definitions #
dmx_filter_t:include/uapi/linux/dvb/dmx.h, line 305dmx_input_t:include/uapi/linux/dvb/dmx.h, line 303dmx_output_t:include/uapi/linux/dvb/dmx.h, line 302dmx_pes_type_t:include/uapi/linux/dvb/dmx.h, line 304
Conditional Access #
IOCTL Commands #
CA_GET_CAP:include/uapi/linux/dvb/ca.h, line 121CA_GET_DESCR_INFO:include/uapi/linux/dvb/ca.h, line 123CA_GET_MSG:include/uapi/linux/dvb/ca.h, line 124CA_GET_SLOT_INFO:include/uapi/linux/dvb/ca.h, line 122CA_RESET:include/uapi/linux/dvb/ca.h, line 120CA_SEND_MSG:include/uapi/linux/dvb/ca.h, line 125CA_SET_DESCR:include/uapi/linux/dvb/ca.h, line 126
Macros and Definitions #
CA_CI:include/uapi/linux/dvb/ca.h, line 39CA_CI_LINK:include/uapi/linux/dvb/ca.h, line 40CA_CI_MODULE_PRESENT:include/uapi/linux/dvb/ca.h, line 46CA_CI_MODULE_READY:include/uapi/linux/dvb/ca.h, line 47CA_CI_PHYS:include/uapi/linux/dvb/ca.h, line 41CA_DESCR:include/uapi/linux/dvb/ca.h, line 42CA_DSS:include/uapi/linux/dvb/ca.h, line 70CA_ECD:include/uapi/linux/dvb/ca.h, line 68CA_NDS:include/uapi/linux/dvb/ca.h, line 69CA_SC:include/uapi/linux/dvb/ca.h, line 43
Structures #
ca_caps:include/uapi/linux/dvb/ca.h, line 83ca_descr:include/uapi/linux/dvb/ca.h, line 114ca_descr_info:include/uapi/linux/dvb/ca.h, line 65ca_msg:include/uapi/linux/dvb/ca.h, line 100ca_slot_info:include/uapi/linux/dvb/ca.h, line 36
Type Definitions #
ca_caps_t:include/uapi/linux/dvb/ca.h, line 133ca_descr_info_t:include/uapi/linux/dvb/ca.h, line 132ca_descr_t:include/uapi/linux/dvb/ca.h, line 135ca_msg_t:include/uapi/linux/dvb/ca.h, line 134ca_slot_info_t:include/uapi/linux/dvb/ca.h, line 131
Network #
IOCTL Commands #
NET_ADD_IF:include/uapi/linux/dvb/net.h, line 39NET_GET_IF:include/uapi/linux/dvb/net.h, line 41NET_REMOVE_IF:include/uapi/linux/dvb/net.h, line 40
Macros and Definitions #
DVB_NET_FEEDTYPE_MPE:include/uapi/linux/dvb/net.h, line 34DVB_NET_FEEDTYPE_ULE:include/uapi/linux/dvb/net.h, line 35
Structures #
dvb_net_if:include/uapi/linux/dvb/net.h, line 30
Introduction
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
What you need to know #
The reader of this document is required to have some knowledge in the area of digital video broadcasting (Digital TV) and should be familiar with part I of the MPEG2 specification ISO/IEC 13818 (aka ITU-T H.222), i.e you should know what a program/transport stream (PS/TS) is and what is meant by a packetized elementary stream (PES) or an I-frame.
Various Digital TV standards documents are available for download at:
-
European standards (DVB): http://www.dvb.org and/or http://www.etsi.org.
-
American standards (ATSC): https://www.atsc.org/standards/
-
Japanese standards (ISDB): http://www.dibeg.org/
It is also necessary to know how to access Linux devices and how to use ioctl calls. This also includes the knowledge of C or C++.
History #
The first API for Digital TV cards we used at Convergence in late 1999 was an extension of the Video4Linux API which was primarily developed for frame grabber cards. As such it was not really well suited to be used for Digital TV cards and their new features like recording MPEG streams and filtering several section and PES data streams at the same time.
In early 2000, Convergence was approached by Nokia with a proposal for a new standard Linux Digital TV API. As a commitment to the development of terminals based on open standards, Nokia and Convergence made it available to all Linux developers and published it on https://linuxtv.org in September 2000. With the Linux driver for the Siemens/Hauppauge DVB PCI card, Convergence provided a first implementation of the Linux Digital TV API. Convergence was the maintainer of the Linux Digital TV API in the early days.
Now, the API is maintained by the LinuxTV community (i.e. you, the reader of this document). The Linux Digital TV API is constantly reviewed and improved together with the improvements at the subsystem's core at the Kernel.
Overview #
Components of a Digital TV card/STB
A Digital TV card or set-top-box (STB) usually consists of the following main hardware components:
-
Frontend consisting of tuner and digital TV demodulator
Here the raw signal reaches the digital TV hardware from a satellite dish or antenna or directly from cable. The frontend down-converts and demodulates this signal into an MPEG transport stream (TS). In case of a satellite frontend, this includes a facility for satellite equipment control (SEC), which allows control of LNB polarization, multi feed switches or dish rotors.
-
Conditional Access (CA) hardware like CI adapters and smartcard slots
The complete TS is passed through the CA hardware. Programs to which the user has access (controlled by the smart card) are decoded in real time and re-inserted into the TS.
-
Demultiplexer which filters the incoming Digital TV MPEG-TS stream
The demultiplexer splits the TS into its components like audio and video streams. Besides usually several of such audio and video streams it also contains data streams with information about the programs offered in this or other streams of the same provider.
-
Audio and video decoder
The main targets of the demultiplexer are audio and video decoders. After decoding, they pass on the uncompressed audio and video to the computer screen or to a TV set.
stb_components shows a crude schematic of the control and data flow between those components.
Linux Digital TV Devices #
The Linux Digital TV API lets you control these hardware components through currently six Unix-style character devices for video, audio, frontend, demux, CA and IP-over-DVB networking. The video and audio devices control the MPEG2 decoder hardware, the frontend device the tuner and the Digital TV demodulator. The demux device gives you control over the PES and section filters of the hardware. If the hardware does not support filtering, these filters can be implemented in software. Finally, the CA device controls all the conditional access capabilities of the hardware. It can depend on the individual security requirements of the platform, if and how many of the CA functions are made available to the application through this device.
All devices can be found in the /dev tree under /dev/dvb. The individual devices are called:
-
/dev/dvb/adapterN/audioM, -
/dev/dvb/adapterN/videoM, -
/dev/dvb/adapterN/frontendM, -
/dev/dvb/adapterN/netM, -
/dev/dvb/adapterN/demuxM, -
/dev/dvb/adapterN/dvrM, -
/dev/dvb/adapterN/caM,
where N enumerates the Digital TV cards in a system starting from 0, and M enumerates the devices of each type within each adapter, starting from 0, too. We will omit the "/dev/dvb/adapterN/" in the further discussion of these devices.
More details about the data structures and function calls of all the devices are described in the following chapters.
API include files #
For each of the Digital TV devices a corresponding include file exists. The Digital TV API include files should be included in application sources with a partial path like:
To enable applications to support different API version, an additional include file linux/dvb/version.h exists, which defines the constant DVB_API_VERSION. This document describes DVB_API_VERSION 5.10.
Digital TV Deprecated APIs
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
The APIs described here should not be used on new drivers or applications.
The DVBv3 frontend API has issues with new delivery systems, including DVB-S2, DVB-T2, ISDB, etc.
DVB Audio Device
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
The DVB audio device controls the MPEG2 audio decoder of the DVB hardware. It can be accessed through /dev/dvb/adapter?/audio?. Data types and ioctl definitions can be accessed by including linux/dvb/audio.h in your application.
Please note that most DVB cards don’t have their own MPEG decoder, which results in the omission of the audio and video device.
These ioctls were also used by V4L2 to control MPEG decoders implemented in V4L2. The use of these ioctls for that purpose has been made obsolete and proper V4L2 ioctls or controls have been created to replace that functionality. Use V4L2 ioctls for new drivers!
Audio Data Types #
This section describes the structures, data types and defines used when talking to the audio device.
audio_stream_source_t #
Synopsis #
audio_stream_source_t
typedef enum audio_stream_source_t;
Constants #
|
|
Selects the demultiplexer (fed either by the frontend or the DVR device) as the source of the video stream. |
|
|
|
Selects the stream from the application that comes through the write() system call. |
|
Description #
The audio stream source is set through the AUDIO_SELECT_SOURCE call and can take the following values, depending on whether we are replaying from an internal (demux) or external (user write) source.
The data fed to the decoder is also controlled by the PID-filter. Output selection: dmx_output DMX_OUT_DECODER.
audio_play_state_t #
Synopsis #
audio_play_state_t
typedef enum audio_play_state_t;
Constants #
|
|
Audio is stopped. |
|
|
Audio is currently playing. |
|
|
Audio is frozen. |
Description #
This values can be returned by the AUDIO_GET_STATUS call representing the state of audio playback.
audio_channel_select_t #
Synopsis #
audio_channel_select_t
typedef enum audio_channel_select_t;
Constants #
|
|
Stereo. |
|
|
Mono, select left stereo channel as source. |
|
|
Mono, select right stereo channel as source. |
|
|
Mono source only. |
|
|
Stereo, swap L & R. |
Description #
The audio channel selected via AUDIO_CHANNEL_SELECT is determined by this value.
audio_mixer_t #
Synopsis #
audio_mixer
typedef struct audio_mixer audio_mixer_t;
Variables #
|
|
Volume left channel. Valid range: 0 ... 255 |
|
|
Volume right channel. Valid range: 0 ... 255 |
Description #
This structure is used by the AUDIO_SET_MIXER call to set the audio volume.
audio_status #
Synopsis #
audio_status
typedef struct audio_status audio_status_t;
Variables #
|
|
Shows if A/V synchronization is ON or OFF. |
|
|
TRUE ( != 0 ) |
AV-sync ON. |
|
|
FALSE ( == 0 ) |
AV-sync OFF. |
|
|
|
Indicates if audio is muted or not. |
|
|
TRUE ( != 0 ) |
mute audio |
|
|
FALSE ( == 0 ) |
unmute audio |
|
|
audio_play_state_t |
Current playback state. |
|
|
audio_stream_source_t |
Current source of the data. |
|
|
|
Is the decoding of the current Audio stream in the DVB subsystem enabled or disabled. |
|
|
TRUE ( != 0 ) |
Bypass disabled. |
|
|
FALSE ( == 0 ) |
Bypass enabled. |
|
|
audio_mixer_t |
Current volume settings. |
|
Description #
The AUDIO_GET_STATUS call returns this structure as information about various states of the playback operation.
audio encodings #
Synopsis #
Constants #
|
|
The hardware accepts DTS audio tracks. |
|
|
|
The hardware accepts uncompressed audio with Linear Pulse-Code Modulation (LPCM) |
|
|
|
The hardware accepts MPEG-1 Audio Layer 1. |
|
|
|
The hardware accepts MPEG-1 Audio Layer 2. Also known as MUSICAM. |
|
|
|
The hardware accepts MPEG-1 Audio Layer III. Commonly known as .mp3. |
|
|
|
The hardware accepts AAC (Advanced Audio Coding). |
|
|
|
The hardware accepts Vorbis audio tracks. |
|
|
|
The hardware accepts Sony Dynamic Digital Sound (SDDS). |
|
|
|
The hardware accepts Dolby Digital ATSC A/52 audio. Also known as AC-3. |
|
Description #
A call to AUDIO_GET_CAPABILITIES returns an unsigned integer with the following bits set according to the hardwares capabilities.
Audio Function Calls #
AUDIO_STOP #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
Description #
This ioctl call asks the Audio Device to stop playing the current stream.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_PLAY #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
Description #
This ioctl call asks the Audio Device to start playing an audio stream from the selected source.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_PAUSE #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
Description #
This ioctl call suspends the audio stream being played. Decoding and playing are paused. It is then possible to restart again decoding and playing process of the audio stream using AUDIO_CONTINUE command.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_CONTINUE #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
Description #
This ioctl restarts the decoding and playing process previously paused with AUDIO_PAUSE command.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_SELECT_SOURCE #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
audio_stream_source_t |
Indicates the source that shall be used for the Audio stream. |
|
Description #
This ioctl call informs the audio device which source shall be used for the input data. The possible sources are demux or memory. If AUDIO_SOURCE_MEMORY is selected, the data is fed to the Audio Device through the write command. If AUDIO_SOURCE_DEMUX is selected, the data is directly transferred from the onboard demux-device to the decoder. Note: This only supports DVB-devices with one demux and one decoder so far.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_SET_MUTE #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Indicates if audio device shall mute or not. |
|
|
TRUE ( != 0 ) |
mute audio |
|
|
FALSE ( == 0 ) |
unmute audio |
|
Description #
This ioctl is for DVB devices only. To control a V4L2 decoder use the V4L2 ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD with the V4L2_DEC_CMD_START_MUTE_AUDIO flag instead.
This ioctl call asks the audio device to mute the stream that is currently being played.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_SET_AV_SYNC #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Tells the DVB subsystem if A/V synchronization shall be ON or OFF. |
|
|
TRUE ( != 0 ) |
AV-sync ON. |
|
|
FALSE ( == 0 ) |
AV-sync OFF. |
|
Description #
This ioctl call asks the Audio Device to turn ON or OFF A/V synchronization.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_SET_BYPASS_MODE #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Enables or disables the decoding of the current Audio stream in the DVB subsystem. |
|
|
TRUE ( != 0 ) |
Disable bypass |
|
|
FALSE ( == 0 ) |
Enable bypass |
|
Description #
This ioctl call asks the Audio Device to bypass the Audio decoder and forward the stream without decoding. This mode shall be used if streams that can’t be handled by the DVB system shall be decoded. Dolby DigitalTM streams are automatically forwarded by the DVB subsystem if the hardware can handle it.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_CHANNEL_SELECT #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
Select the output format of the audio (mono left/right, stereo). |
||
Description #
This ioctl is for DVB devices only. To control a V4L2 decoder use the V4L2 V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK control instead.
This ioctl call asks the Audio Device to select the requested channel if possible.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_GET_STATUS #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals AUDIO_GET_STATUS for this command. |
|
|
|
Returns the current state of Audio Device. |
|
Description #
This ioctl call asks the Audio Device to return the current state of the Audio Device.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_GET_CAPABILITIES #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Returns a bit array of supported sound formats. Bits are defined in audio encodings. |
|
Description #
This ioctl call asks the Audio Device to tell us about the decoding capabilities of the audio hardware.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_CLEAR_BUFFER #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
Description #
This ioctl call asks the Audio Device to clear all software and hardware buffers of the audio decoder device.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_SET_ID #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Audio sub-stream id. |
|
Description #
This ioctl selects which sub-stream is to be decoded if a program or system stream is sent to the video device.
If no audio stream type is set the id has to be in range [0xC0,0xDF] for MPEG sound, in [0x80,0x87] for AC3 and in [0xA0,0xA7] for LPCM. See ITU-T H.222.0 | ISO/IEC 13818-1 for further description.
If the stream type is set with AUDIO_SET_STREAMTYPE, specifies the id just the sub-stream id of the audio stream and only the first 5 bits (& 0x1F) are recognized.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_SET_MIXER #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Mixer settings. |
|
Description #
This ioctl lets you adjust the mixer settings of the audio decoder.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
AUDIO_SET_STREAMTYPE #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Stream type. |
|
Description #
This ioctl tells the driver which kind of audio stream to expect. This is useful if the stream offers several audio sub-streams like LPCM and AC3.
Stream types defined in ITU-T H.222.0 | ISO/IEC 13818-1 are used.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
|
|
Type is not a valid or supported stream type. |
AUDIO_BILINGUAL_CHANNEL_SELECT #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Select the output format of the audio (mono left/right, stereo). |
|
Description #
This ioctl has been replaced by the V4L2 V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK control for MPEG decoders controlled through V4L2.
This ioctl call asks the Audio Device to select the requested channel for bilingual streams if possible.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
open() #
Synopsis #
int Arguments #
|
|
Name of specific audio device. |
|
|
|
A bit-wise OR of the following flags: |
|
|
|
read-only access |
|
|
|
read/write access |
|
|
|
Open in non-blocking mode |
|
Description #
This system call opens a named audio device (e.g. /dev/dvb/adapter0/audio0) for subsequent use. When an open() call has succeeded, the device will be ready for use. The significance of blocking or non-blocking mode is described in the documentation for functions where there is a difference. It does not affect the semantics of the open() call itself. A device opened in blocking mode can later be put into non-blocking mode (and vice versa) using the F_SETFL command of the fcntl system call. This is a standard system call, documented in the Linux manual page for fcntl. Only one user can open the Audio Device in O_RDWR mode. All other attempts to open the device in this mode will fail, and an error code will be returned. If the Audio Device is opened in O_RDONLY mode, the only ioctl call that can be used is AUDIO_GET_STATUS. All other call will return with an error code.
Return Value #
|
|
Device driver not loaded/available. |
|
|
Device or resource busy. |
|
|
Invalid argument. |
close() #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
Description #
This system call closes a previously opened audio device.
Return Value #
|
|
Fd is not a valid open file descriptor. |
write() #
Synopsis #
size_t Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Pointer to the buffer containing the PES data. |
|
|
|
Size of buf. |
|
Description #
This system call can only be used if AUDIO_SOURCE_MEMORY is selected in the ioctl call AUDIO_SELECT_SOURCE. The data provided shall be in PES format. If O_NONBLOCK is not specified the function will block until buffer space is available. The amount of data to be transferred is implied by count.
Return Value #
|
|
Mode |
|
|
|
Attempted to write more data than the internal buffer can hold. |
|
|
|
Fd is not a valid open file descriptor. |
|
Legacy DVB MPEG Decoder APIs
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
General Notes #
This API has originally been designed for DVB only and is therefore limited to the Data Formats used in such digital TV-broadcastsystems.
To circumvent this limitations the more versatile V4L2 API has been designed. Which replaces this part of the DVB API.
Nevertheless there have been projects build around this API. To ensure compatibility this API is kept as it is.
Practically the decoders seem to be treated differently. The application typically knows which decoder is in use or it is specially written for one decoder type. Querying capabilities are rarely used because they are already known.
Data Formats #
The API has been designed for DVB and compatible broadcastsystems. Because of that fact the only supported data formats are ISO/IEC 13818-1 compatible MPEG streams. The supported payloads may vary depending on the used decoder.
Timestamps are always MPEG PTS as defined in ITU T-REC-H.222.0 / ISO/IEC 13818-1, if not otherwise noted.
For storing recordings typically TS streams are used, in lesser extent PES. Both variants are commonly accepted for playback, but it may be driver dependent.
Table of Contents #
DVB OSD Device
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
The DVB OSD device controls the OnScreen-Display of the AV7110 based DVB-cards with hardware MPEG2 decoder. It can be accessed through /dev/dvb/adapter?/osd0. Data types and ioctl definitions can be accessed by including linux/dvb/osd.h in your application.
The OSD is not a frame-buffer like on many other cards. It is a kind of canvas one can draw on. The color-depth is limited depending on the memory size installed. An appropriate palette of colors has to be set up. The installed memory size can be identified with the OSD_GET_CAPABILITY ioctl.
OSD Data Types #
OSD_Command #
Synopsis #
typedef enum OSD_Command;
Commands #
|
Command |
Used variables of |
Description |
||
|---|---|---|---|---|
|
|
|
Disables OSD and releases the buffers. |
||
|
|
x0,y0,x1,y1, |
Opens OSD with this size and bit depth |
||
|
|
|
Enables OSD mode. |
||
|
|
|
Disables OSD mode. |
||
|
|
|
Sets all pixel to color 0. |
||
|
|
color |
Sets all pixel to color <color>. |
||
|
|
color, |
Set palette entry <num> to <r,g,b>, <mix> and <trans> apply |
||
|
|
firstcolor{color}, |
Set a number of entries in the palette. |
||
|
|
transparency{color} |
Sets transparency of mixed pixel (0..15). |
||
|
|
x0,y0,color |
Sets pixel <x>,<y> to color number <color>. |
||
|
|
x0,y0 |
Returns color number of pixel <x>,<y>, or -1. |
||
|
|
x0,y0,x1,data |
Fills pixels x0,y through x1,y with the content of data[]. |
||
|
|
x0,y0,x1,y1, |
Fills pixels x0,y0 through x1,y1 with the content of data[]. |
||
|
|
x0,y0,x1,color |
Fills pixels x0,y through x1,y with the color <color>. |
||
|
|
x0,y0,x1,y1,color |
Fills pixels x0,y0 through x1,y1 with the color <color>. |
||
|
|
x0,y0,x1,y1,color |
Draw a line from x0,y0 to x1,y1 with the color <color>. |
||
|
|
x0,y0,x1,y1, |
Fills parameters with the picture dimensions and the pixel
aspect ratio. |
||
|
|
|
Draws a test picture. |
||
|
|
x0,y0,size,color,text |
Draws a text at position x0,y0 with the color <color>. |
||
|
|
x0 |
Set window with number 0<x0<8 as current. |
||
|
|
x0,y0 |
Move current window to (x0, y0). |
||
|
|
x0,y0,x1,y1, |
Open other types of OSD windows. |
||
Description #
The OSD_Command data type is used with the OSD_SEND_CMD ioctl to tell the driver which OSD_Command to execute.
osd_cmd_t #
Synopsis #
typedef struct osd_cmd_s osd_cmd_t;
Variables #
|
|
OSD_Command to be executed. |
|
|
First horizontal position. |
|
|
First vertical position. |
|
|
Second horizontal position. |
|
|
Second vertical position. |
|
|
Number of the color in the palette. |
|
|
Command specific Data. |
Description #
The osd_cmd_t data type is used with the OSD_SEND_CMD ioctl. It contains the data for the OSD_Command and the OSD_Command itself. The structure has to be passed to the driver and the components may be modified by it.
osd_raw_window_t #
Synopsis #
typedef enum osd_raw_window_t;
Constants #
|
|
1 bit bitmap |
|
|
|
2 bit bitmap |
|
|
|
4 bit bitmap |
|
|
|
8 bit bitmap |
|
|
|
1 Bit bitmap half resolution |
|
|
|
2 Bit bitmap half resolution |
|
|
|
4 Bit bitmap half resolution |
|
|
|
8 Bit bitmap half resolution |
|
|
|
4:2:2 YCRCB Graphic Display |
|
|
|
4:4:4 YCRCB Graphic Display |
|
|
|
4:4:4 YCRCB graphic half resolution |
|
|
|
True Size Normal MPEG Video Display |
|
|
|
MPEG Video Display Half Resolution |
|
|
|
MPEG Video Display Quarter Resolution |
|
|
|
MPEG Video Display Double Resolution |
|
|
|
True Size MPEG Video Display Half Resolution |
|
|
|
True Size MPEG Video Display Quarter Resolution |
|
|
|
True Size MPEG Video Display Double Resolution |
|
|
|
Full Size MPEG Video Display |
|
|
|
Cursor |
|
Description #
The osd_raw_window_t data type is used with the OSD_Command OSD_OpenRaw to tell the driver which type of OSD to open.
osd_cap_t #
Synopsis #
typedef struct osd_cap_s osd_cap_t;
Variables #
|
|
Capability to query. |
|
|
Used to store the Data. |
Supported capabilities #
|
|
Memory size installed on the card. |
Description #
This structure of data used with the OSD_GET_CAPABILITY call.
OSD Function Calls #
OSD_SEND_CMD #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Pointer to the location of the structure osd_cmd_t for this command. |
|
Description #
This ioctl sends the OSD_Command to the card.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
|
|
Command is out of range. |
OSD_GET_CAPABILITY #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Pointer to the location of the structure osd_cap_t for this command. |
|
Description #
This ioctl is used to get the capabilities of the OSD of the AV7110 based DVB-decoder-card in use.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
|
|
Unsupported capability. |
open() #
Synopsis #
int Arguments #
|
|
Name of specific OSD device. |
|
|
|
A bit-wise OR of the following flags: |
|
|
|
read-only access |
|
|
|
read/write access |
|
|
|
Open in non-blocking mode |
|
Description #
This system call opens a named OSD device (e.g. /dev/dvb/adapter?/osd0) for subsequent use.
Return Value #
|
|
Device driver not loaded/available. |
|
|
Internal error. |
|
|
Device or resource busy. |
|
|
Invalid argument. |
close() #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open() . |
|
Description #
This system call closes a previously opened OSD device.
Return Value #
|
|
fd is not a valid open file descriptor. |
DVB Video Device
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
The DVB video device controls the MPEG2 video decoder of the DVB hardware. It can be accessed through /dev/dvb/adapter0/video0. Data types and ioctl definitions can be accessed by including linux/dvb/video.h in your application.
Note that the DVB video device only controls decoding of the MPEG video stream, not its presentation on the TV or computer screen. On PCs this is typically handled by an associated video4linux device, e.g. /dev/video, which allows scaling and defining output windows.
Most DVB cards don’t have their own MPEG decoder, which results in the omission of the audio and video device as well as the video4linux device.
These ioctls were also used by V4L2 to control MPEG decoders implemented in V4L2. The use of these ioctls for that purpose has been made obsolete and proper V4L2 ioctls or controls have been created to replace that functionality. Use V4L2 ioctls for new drivers!
Video Data Types #
video_format_t #
Synopsis #
typedef enum video_format_t;
Constants #
|
|
Select 4:3 format. |
|
|
Select 16:9 format. |
|
|
Select 2.21:1 format. |
Description #
The video_format_t data type is used in the VIDEO_SET_FORMAT function to tell the driver which aspect ratio the output hardware (e.g. TV) has. It is also used in the data structures video_status returned by VIDEO_GET_STATUS and video_event returned by VIDEO_GET_EVENT which report about the display format of the current video stream.
video_displayformat_t #
Synopsis #
typedef enum video_displayformat_t;
Constants #
|
|
Use pan and scan format. |
|
|
Use letterbox format. |
|
|
Use center cut out format. |
Description #
In case the display format of the video stream and of the display hardware differ the application has to specify how to handle the cropping of the picture. This can be done using the VIDEO_SET_DISPLAY_FORMAT call which accepts this enum as argument.
video_size_t #
Synopsis #
typedef struct video_size_t;
Variables #
|
|
Video width in pixels. |
|
|
Video height in pixels. |
|
video_format_t |
Aspect ratio. |
Description #
Used in the struct video_event. It stores the resolution and aspect ratio of the video.
video_stream_source_t #
Synopsis #
typedef enum video_stream_source_t;
Constants #
|
|
Select the demux as the main source. |
|
|
|
If this source is selected, the stream comes from the user through the write system call. |
|
Description #
The video stream source is set through the VIDEO_SELECT_SOURCE call and can take the following values, depending on whether we are replaying from an internal (demuxer) or external (user write) source. VIDEO_SOURCE_DEMUX selects the demultiplexer (fed either by the frontend or the DVR device) as the source of the video stream. If VIDEO_SOURCE_MEMORY is selected the stream comes from the application through the write() system call.
video_play_state_t #
Synopsis #
typedef enum video_play_state_t;
Constants #
|
|
Video is stopped. |
|
|
Video is currently playing. |
|
|
Video is frozen. |
Description #
This values can be returned by the VIDEO_GET_STATUS call representing the state of video playback.
struct video_command #
Synopsis #
;
Variables #
|
|
||
|
|
Flags for the Decoder command. |
|
|
|
|
MPEG PTS |
|
|
|
0 or 1000 specifies normal speed, |
|
1: specifies forward single stepping, |
||
|
-1: specifies backward single stepping, |
||
|
>1: playback at speed / 1000 of the normal speed |
||
|
<-1: reverse playback at ( -speed / 1000 ) of the normal speed. |
||
|
|
||
|
|
Reserved |
|
Description #
The structure must be zeroed before use by the application. This ensures it can be extended safely in the future.
Predefined decoder commands and flags #
Synopsis #
Constants #
|
|
Start playback. |
|
|
|
Stop playback. |
|
|
|
Freeze playback. |
|
|
|
Continue playback after freeze. |
|
|
Flags for |
|
Show black picture on freeze. |
|
Flags for |
|
Show black picture on stop. |
|
|
Stop immediately, without emptying buffers. |
|
|
|
The decoder has no special format requirements |
|
|
|
The decoder requires full GOPs |
|
|
Field order |
|
FIELD_UNKNOWN can be used if the hardware does not know whether the Vsync is for an odd, even or progressive (i.e. non-interlaced) field. |
|
|
Vsync is for an odd field. |
|
|
|
Vsync is for an even field. |
|
|
|
progressive (i.e. non-interlaced) |
video_event #
Synopsis #
;
Variables #
|
|
Event type. |
|
|
|
Size changed. |
|
|
|
Framerate changed. |
|
|
|
Decoder stopped. |
|
|
|
Vsync occurred. |
|
|
|
MPEG PTS at occurrence. |
|
|
|
video_size_t size |
Resolution and aspect ratio of the video. |
|
|
in frames per 1000sec |
|
|
|
unknown / odd / even / progressive |
|
Description #
This is the structure of a video event as it is returned by the VIDEO_GET_EVENT call. See there for more details.
video_status #
Synopsis #
The VIDEO_GET_STATUS call returns the following structure informing about various states of the playback operation.
;
Variables #
|
|
Show blank video on freeze? |
|
|
TRUE ( != 0 ) |
Blank screen when freeze. |
|
|
FALSE ( == 0 ) |
Show last decoded frame. |
|
|
video_play_state_t |
Current state of playback. |
|
|
video_stream_source_t |
Current source (demux/memory). |
|
|
video_format_t |
Current aspect ratio of stream. |
|
|
video_displayformat_t |
Applied cropping mode. |
|
Description #
If video_blank is set TRUE video will be blanked out if the channel is changed or if playback is stopped. Otherwise, the last picture will be displayed. play_state indicates if the video is currently frozen, stopped, or being played back. The stream_source corresponds to the selected source for the video stream. It can come either from the demultiplexer or from memory. The video_format indicates the aspect ratio (one of 4:3 or 16:9) of the currently played video stream. Finally, display_format corresponds to the applied cropping mode in case the source video format is not the same as the format of the output device.
video_still_picture #
Synopsis #
;
Variables #
|
|
Pointer to a single iframe in memory. |
|
|
Size of the iframe. |
Description #
An I-frame displayed via the VIDEO_STILLPICTURE call is passed on within this structure.
video capabilities #
Synopsis #
Constants #
Bit definitions for capabilities:
|
|
The hardware can decode MPEG1. |
|
|
|
The hardware can decode MPEG2. |
|
|
|
The video device accepts system stream. You still have to open the video and the audio device but only send the stream to the video device. |
|
|
|
The video device accepts program stream. You still have to open the video and the audio device but only send the stream to the video device. |
|
Description #
A call to VIDEO_GET_CAPABILITIES returns an unsigned integer with the following bits set according to the hardware's capabilities.
Video Function Calls #
VIDEO_STOP #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Indicates how the screen shall be handled. |
|
|
TRUE ( != 0 ) |
Blank screen when stop. |
|
|
FALSE ( == 0 ) |
Show last decoded frame. |
|
Description #
This ioctl is for Digital TV devices only. To control a V4L2 decoder use the V4L2 ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD instead.
This ioctl call asks the Video Device to stop playing the current stream. Depending on the input parameter, the screen can be blanked out or displaying the last decoded frame.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_PLAY #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
Description #
This ioctl is for Digital TV devices only. To control a V4L2 decoder use the V4L2 ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD instead.
This ioctl call asks the Video Device to start playing a video stream from the selected source.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_FREEZE #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
Description #
This ioctl is for Digital TV devices only. To control a V4L2 decoder use the V4L2 ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD instead.
This ioctl call suspends the live video stream being played, if VIDEO_SOURCE_DEMUX is selected. Decoding and playing are frozen. It is then possible to restart the decoding and playing process of the video stream using the VIDEO_CONTINUE command. If VIDEO_SOURCE_MEMORY is selected in the ioctl call VIDEO_SELECT_SOURCE, the Digital TV subsystem will not decode any more data until the ioctl call VIDEO_CONTINUE or VIDEO_PLAY is performed.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_CONTINUE #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
Description #
This ioctl is for Digital TV devices only. To control a V4L2 decoder use the V4L2 ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD instead.
This ioctl call restarts decoding and playing processes of the video stream which was played before a call to VIDEO_FREEZE was made.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_SELECT_SOURCE #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
video_stream_source_t |
Indicates which source shall be used for the Video stream. |
|
Description #
This ioctl is for Digital TV devices only. This ioctl was also supported by the V4L2 ivtv driver, but that has been replaced by the ivtv-specific IVTV_IOC_PASSTHROUGH_MODE ioctl.
This ioctl call informs the video device which source shall be used for the input data. The possible sources are demux or memory. If memory is selected, the data is fed to the video device through the write command using the struct video_stream_source_t. If demux is selected, the data is directly transferred from the onboard demux-device to the decoder.
The data fed to the decoder is also controlled by the PID-filter. Output selection: dmx_output DMX_OUT_DECODER.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_SET_BLANK #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Indicates if the screen shall be blanked. |
|
|
TRUE ( != 0 ) |
Blank screen when stop. |
|
|
FALSE ( == 0 ) |
Show last decoded frame. |
|
Description #
This ioctl call asks the Video Device to blank out the picture.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_GET_STATUS #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Returns the current status of the Video Device. |
|
Description #
This ioctl call asks the Video Device to return the current status of the device.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_GET_EVENT #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Points to the location where the event, if any, is to be stored. |
|
Description #
This ioctl is for DVB devices only. To get events from a V4L2 decoder use the V4L2 ioctl VIDIOC_DQEVENT ioctl instead.
This ioctl call returns an event of type video_event if available. A certain number of the latest events will be cued and returned in order of occurrence. Older events may be discarded if not fetched in time. If an event is not available, the behavior depends on whether the device is in blocking or non-blocking mode. In the latter case, the call fails immediately with errno set to EWOULDBLOCK. In the former case, the call blocks until an event becomes available. The standard Linux poll() and/or select() system calls can be used with the device file descriptor to watch for new events. For select(), the file descriptor should be included in the exceptfds argument, and for poll(), POLLPRI should be specified as the wake-up condition. Read-only permissions are sufficient for this ioctl call.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
|
|
There is no event pending, and the device is in non-blocking mode. |
|
|
|
Overflow in event queue - one or more events were lost. |
|
VIDEO_SET_DISPLAY_FORMAT #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
video_displayformat_t |
Selects the video format to be used. |
|
Description #
This ioctl call asks the Video Device to select the video format to be applied by the MPEG chip on the video.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_STILLPICTURE #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Pointer to the location where the struct with the I-frame and size is stored. |
|
Description #
This ioctl call asks the Video Device to display a still picture (I-frame). The input data shall be the section of an elementary video stream containing an I-frame. Typically this section is extracted from a TS or PES recording. Resolution and codec (see video capabilities) must be supported by the device. If the pointer is NULL, then the current displayed still picture is blanked.
e.g. The AV7110 supports MPEG1 and MPEG2 with the common PAL-SD resolutions.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_FAST_FORWARD #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
The number of frames to skip. |
|
Description #
This ioctl call asks the Video Device to skip decoding of N number of I-frames. This call can only be used if VIDEO_SOURCE_MEMORY is selected.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
|
|
Mode |
VIDEO_SLOWMOTION #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
The number of times to repeat each frame. |
|
Description #
This ioctl call asks the video device to repeat decoding frames N number of times. This call can only be used if VIDEO_SOURCE_MEMORY is selected.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
|
|
Mode |
VIDEO_GET_CAPABILITIES #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Pointer to a location where to store the capability information. |
|
Description #
This ioctl call asks the video device about its decoding capabilities. On success it returns an integer which has bits set according to the defines in video capabilities.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_CLEAR_BUFFER #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
Description #
This ioctl call clears all video buffers in the driver and in the decoder hardware.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_SET_STREAMTYPE #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Stream type. |
|
Description #
This ioctl tells the driver which kind of stream to expect being written to it. Intelligent decoder might also not support or ignore (like the AV7110) this call and determine the stream type themselves.
Currently used stream types:
|
Codec |
Stream type |
|---|---|
|
MPEG2 |
0 |
|
MPEG4 h.264 |
1 |
|
VC1 |
3 |
|
MPEG4 Part2 |
4 |
|
VC1 SM |
5 |
|
MPEG1 |
6 |
|
HEVC h.265 |
7 |
|
AVS |
16 |
|
AVS2 |
40 |
Not every decoder supports all stream types.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_SET_FORMAT #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
video_format_t |
Video format of TV as defined in section video_format_t. |
|
Description #
This ioctl sets the screen format (aspect ratio) of the connected output device (TV) so that the output of the decoder can be adjusted accordingly.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_GET_SIZE #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call, to open(). |
|
|
|
Equals |
|
|
video_size_t |
Returns the size and aspect ratio. |
|
Description #
This ioctl returns the size and aspect ratio.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_GET_PTS #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Returns the 33-bit timestamp as defined in ITU T-REC-H.222.0 / ISO/IEC 13818-1. The PTS should belong to the currently played frame if possible, but may also be a value close to it like the PTS of the last decoded frame or the last PTS extracted by the PES parser. |
|
Description #
For V4L2 decoders this ioctl has been replaced by the V4L2_CID_MPEG_VIDEO_DEC_PTS control.
This ioctl call asks the Video Device to return the current PTS timestamp.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_GET_FRAME_COUNT #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
|
Returns the number of frames displayed since the decoder was started. |
|
Description #
For V4L2 decoders this ioctl has been replaced by the V4L2_CID_MPEG_VIDEO_DEC_FRAME control.
This ioctl call asks the Video Device to return the number of displayed frames since the decoder was started.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_COMMAND #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
struct video_command |
Commands the decoder. |
|
Description #
For V4L2 decoders this ioctl has been replaced by the ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD ioctl.
This ioctl commands the decoder. The struct video_command is a subset of the v4l2_decoder_cmd struct, so refer to the ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD documentation for more information.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
VIDEO_TRY_COMMAND #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Equals |
|
|
struct video_command |
Try a decoder command. |
|
Description #
For V4L2 decoders this ioctl has been replaced by the VIDIOC_TRY_DECODER_CMD ioctl.
This ioctl tries a decoder command. The struct video_command is a subset of the v4l2_decoder_cmd struct, so refer to the VIDIOC_TRY_DECODER_CMD documentation for more information.
Return Value #
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
open() #
Synopsis #
int Arguments #
|
|
Name of specific video device. |
|
|
|
A bit-wise OR of the following flags: |
|
|
|
read-only access |
|
|
|
read/write access |
|
|
|
Open in non-blocking mode |
|
Description #
This system call opens a named video device (e.g. /dev/dvb/adapter?/video?) for subsequent use.
When an open() call has succeeded, the device will be ready for use. The significance of blocking or non-blocking mode is described in the documentation for functions where there is a difference. It does not affect the semantics of the open() call itself. A device opened in blocking mode can later be put into non-blocking mode (and vice versa) using the F_SETFL command of the fcntl system call. This is a standard system call, documented in the Linux manual page for fcntl. Only one user can open the Video Device in O_RDWR mode. All other attempts to open the device in this mode will fail, and an error-code will be returned. If the Video Device is opened in O_RDONLY mode, the only ioctl call that can be used is VIDEO_GET_STATUS. All other call will return an error code.
Return Value #
|
|
Device driver not loaded/available. |
|
|
|
Internal error. |
|
|
|
Device or resource busy. |
|
|
|
Invalid argument. |
|
close() #
Synopsis #
int Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
Description #
This system call closes a previously opened video device.
Return Value #
|
|
fd is not a valid open file descriptor. |
write() #
Synopsis #
size_t Arguments #
|
|
File descriptor returned by a previous call to open(). |
|
|
|
Pointer to the buffer containing the PES data. |
|
|
|
Size of buf. |
|
Description #
This system call can only be used if VIDEO_SOURCE_MEMORY is selected in the ioctl call VIDEO_SELECT_SOURCE. The data provided shall be in PES format, unless the capability allows other formats. TS is the most common format for storing DVB-data, it is usually supported too. If O_NONBLOCK is not specified the function will block until buffer space is available. The amount of data to be transferred is implied by count.
Return Value #
|
|
Mode |
|
|
|
Attempted to write more data than the internal buffer can hold. |
|
|
|
fd is not a valid open file descriptor. |
|
ioctl NET_ADD_IF
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
NET_ADD_IF - Creates a new network interface for a given Packet ID.
Synopsis #
int ioctl(int fd, NET_ADD_IF, struct dvb_net_if *net_if)
Arguments #
-
fdFile descriptor returned by
open(). -
net_ifpointer to struct
dvb_net_if
Description #
The NET_ADD_IF ioctl system call selects the Packet ID (PID) that contains a TCP/IP traffic, the type of encapsulation to be used (MPE or ULE) and the interface number for the new interface to be created. When the system call successfully returns, a new virtual network interface is created.
The struct dvb_net_if::ifnum field will be filled with the number of the created interface.
Return Value #
On success 0 is returned, and ca_slot_info is filled.
On error -1 is returned, and the errno variable is set appropriately.
The generic error codes are described at the Generic Error Codes chapter.
ioctl NET_GET_IF
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
NET_GET_IF - Read the configuration data of an interface created via - NET_ADD_IF.
Synopsis #
int ioctl(int fd, NET_GET_IF, struct dvb_net_if *net_if)
Arguments #
-
fdFile descriptor returned by
open(). -
net_ifpointer to struct
dvb_net_if
Description #
The NET_GET_IF ioctl uses the interface number given by the struct dvb_net_if::ifnum field and fills the content of struct dvb_net_if with the packet ID and encapsulation type used on such interface. If the interface was not created yet with NET_ADD_IF, it will return -1 and fill the errno with EINVAL error code.
Return Value #
On success 0 is returned, and ca_slot_info is filled.
On error -1 is returned, and the errno variable is set appropriately.
The generic error codes are described at the Generic Error Codes chapter.
ioctl NET_REMOVE_IF
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Name #
NET_REMOVE_IF - Removes a network interface.
Synopsis #
int ioctl(int fd, NET_REMOVE_IF, int ifnum)
Arguments #
-
fdFile descriptor returned by
open(). -
net_ifnumber of the interface to be removed
Description #
The NET_REMOVE_IF ioctl deletes an interface previously created via NET_ADD_IF.
Return Value #
On success 0 is returned, and ca_slot_info is filled.
On error -1 is returned, and the errno variable is set appropriately.
The generic error codes are described at the Generic Error Codes chapter.
Net Data Types
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
struct dvb_net_if #
describes a DVB network interface
Definition
;
Members
pid: Packet ID (PID) of the MPEG-TS that contains dataif_num: number of the Digital TV interface.feedtype: Encapsulation type of the feed.
Description
A MPEG-TS stream may contain packet IDs with IP packages on it. This struct describes it, and the type of encoding.
feedtype can be:
DVB_NET_FEEDTYPE_MPEfor MPE encodingDVB_NET_FEEDTYPE_ULEfor ULE encoding.
Digital TV Network API
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
The Digital TV net device controls the mapping of data packages that are part of a transport stream to be mapped into a virtual network interface, visible through the standard Linux network protocol stack.
Currently, two encapsulations are supported:
In order to create the Linux virtual network interfaces, an application needs to tell to the Kernel what are the PIDs and the encapsulation types that are present on the transport stream. This is done through /dev/dvb/adapter?/net? device node. The data will be available via virtual dvb?_? network interfaces, and will be controlled/routed via the standard ip tools (like ip, route, netstat, ifconfig, etc).
Data types and ioctl definitions are defined via linux/dvb/net.h header.
Digital TV net Function Calls #
Querying frontend information
Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)
Usually, the first thing to do when the frontend is opened is to check the frontend capabilities. This is done using ioctl FE_GET_INFO. This ioctl will enumerate the Digital TV API version and other characteristics about the frontend, and can be opened either in read only or read/write mode.