# Digital television (DVB)

---

# Digital TV CA close()

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Digital TV CA close()

<a id="rst-digital-tv-ca-close"></a>
<a id="rst-ca-fclose"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.ca -->

<a id="rst-name"></a>

## Name

Digital TV CA close()

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-close"></a>

```c
int close(int fd)
```

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by a previous call to `open()`.

<a id="rst-description"></a>

## Description

This system call closes a previously opened CA device.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# Digital TV CA open()

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Digital TV CA open()

<a id="rst-digital-tv-ca-open"></a>
<a id="rst-ca-fopen"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.ca -->

<a id="rst-name"></a>

## Name

Digital TV CA open()

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-open"></a>

```c
int open(const char *name, int flags)
```

<a id="rst-arguments"></a>

## Arguments

- **`name`**

  Name of specific Digital TV CA device.

- **`flags`**

  A bit-wise OR of the following flags:

<!-- tabularcolumns: |p{2.5cm}|p{15.0cm}| -->


<table>
<tbody>
<tr>
<td>


`O_RDONLY`

</td>
<td>


read-only access

</td>
</tr>
<tr>
<td>


`O_RDWR`

</td>
<td>


read/write access

</td>
</tr>
<tr>
<td>


`O_NONBLOCK`

</td>
<td>


open in non-blocking mode (blocking mode is the default)

</td>
</tr>
</tbody>
</table>

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# CA_GET_CAP

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "ca_get_cap".

<a id="rst-ca-get-cap-1"></a>
<a id="rst-ca-get-cap"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.ca -->

<a id="rst-name"></a>

## Name

CA_GET_CAP

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-CA_GET_CAP"></a>

```c
CA_GET_CAP
```

`int ioctl(fd, CA_GET_CAP, struct ca_caps *caps)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by a previous call to `open()`.

- **`caps`**

  Pointer to struct `ca_caps`.

<a id="rst-description"></a>

## Description

Queries the Kernel for information about the available CA and descrambler slots, and their types.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# CA_GET_DESCR_INFO

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "ca_get_descr_info".

<a id="rst-ca-get-descr-info-1"></a>
<a id="rst-ca-get-descr-info"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.ca -->

<a id="rst-name"></a>

## Name

CA_GET_DESCR_INFO

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-CA_GET_DESCR_INFO"></a>

```c
CA_GET_DESCR_INFO
```

`int ioctl(fd, CA_GET_DESCR_INFO, struct ca_descr_info *desc)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by a previous call to `open()`.

- **`desc`**

  Pointer to struct `ca_descr_info`.

<a id="rst-description"></a>

## Description

Returns information about all descrambler slots.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# CA_GET_MSG

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "ca_get_msg".

<a id="rst-ca-get-msg-1"></a>
<a id="rst-ca-get-msg"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.ca -->

<a id="rst-name"></a>

## Name

CA_GET_MSG

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-CA_GET_MSG"></a>

```c
CA_GET_MSG
```

`int ioctl(fd, CA_GET_MSG, struct ca_msg *msg)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by a previous call to `open()`.

- **`msg`**

  Pointer to struct `ca_msg`.

<a id="rst-description"></a>

## Description

Receives a message via a CI CA module.

> [!NOTE]
>
> Please notice that, on most drivers, this is done by reading from the /dev/adapter?/ca? device node.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# CA_GET_SLOT_INFO

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "ca_get_slot_info".

<a id="rst-ca-get-slot-info-1"></a>
<a id="rst-ca-get-slot-info"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.ca -->

<a id="rst-name"></a>

## Name

CA_GET_SLOT_INFO

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-CA_GET_SLOT_INFO"></a>

```c
CA_GET_SLOT_INFO
```

`int ioctl(fd, CA_GET_SLOT_INFO, struct ca_slot_info *info)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by a previous call to `open()`.

- **`info`**

  Pointer to struct `ca_slot_info`.

<a id="rst-description"></a>

## Description

Returns information about a CA slot identified by `ca_slot_info`.slot_num.

<a id="rst-return-value"></a>

## 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.

<!-- tabularcolumns: |p{2.5cm}|p{15.0cm}| -->


<table>
<tbody>
<tr>
<td>


`ENODEV`

</td>
<td>


the slot is not available.

</td>
</tr>
</tbody>
</table>

The generic error codes are described at the [Generic Error Codes](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# CA_RESET

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "ca_reset".

<a id="rst-ca-reset-1"></a>
<a id="rst-ca-reset"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.ca -->

<a id="rst-name"></a>

## Name

CA_RESET

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-CA_RESET"></a>

```c
CA_RESET
```

`int ioctl(fd, CA_RESET)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by a previous call to `open()`.

<a id="rst-description"></a>

## Description

Puts the Conditional Access hardware on its initial state. It should be called before start using the CA hardware.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# CA_SEND_MSG

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "ca_send_msg".

<a id="rst-ca-send-msg-1"></a>
<a id="rst-ca-send-msg"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.ca -->

<a id="rst-name"></a>

## Name

CA_SEND_MSG

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-CA_SEND_MSG"></a>

```c
CA_SEND_MSG
```

`int ioctl(fd, CA_SEND_MSG, struct ca_msg *msg)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by a previous call to `open()`.

- **`msg`**

  Pointer to struct `ca_msg`.

<a id="rst-description"></a>

## Description

Sends a message via a CI CA module.

> [!NOTE]
>
> Please notice that, on most drivers, this is done by writing to the /dev/adapter?/ca? device node.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# CA_SET_DESCR

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "ca_set_descr".

<a id="rst-ca-set-descr-1"></a>
<a id="rst-ca-set-descr"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.ca -->

<a id="rst-name"></a>

## Name

CA_SET_DESCR

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-CA_SET_DESCR"></a>

```c
CA_SET_DESCR
```

`int ioctl(fd, CA_SET_DESCR, struct ca_descr *desc)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by a previous call to `open()`.

- **`msg`**

  Pointer to struct `ca_descr`.

<a id="rst-description"></a>

## Description

CA_SET_DESCR is used for feeding descrambler CA slots with descrambling keys (referred as control words).

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) 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.

<a id="rst-digital-tv-ca-device"></a>
<a id="rst-dvb-ca"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

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.

> [!NOTE]
>
> There are three ioctls at this API that aren't documented: [CA_GET_MSG](</kernel/userspace/userspace-api/media-dvb/ca-get-msg.md#rst-ca-get-msg-1>), [CA_SEND_MSG](</kernel/userspace/userspace-api/media-dvb/ca-send-msg.md#rst-ca-send-msg-1>) and [CA_SET_DESCR](</kernel/userspace/userspace-api/media-dvb/ca-set-descr.md#rst-ca-set-descr-1>). Documentation for them are welcome.

- [CA Data Types](</kernel/userspace/userspace-api/media-dvb/ca-data-types.md>)
- [CA Function Calls](</kernel/userspace/userspace-api/media-dvb/ca-function-calls.md>)
- [The High level CI API](</kernel/userspace/userspace-api/media-dvb/ca-high-level.md>)

---

# CA Data Types

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Reference for CA Data Types.

<a id="rst-ca-data-types-1"></a>
<a id="rst-ca-data-types"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->


#### <a id="c-struct-ca_slot_info"></a>`struct ca_slot_info`

CA slot interface types and info.

**Definition**

```c
struct ca_slot_info {
        int num;
        int type;
    #define CA_CI            1;
    #define CA_CI_LINK       2;
    #define CA_CI_PHYS       4;
    #define CA_DESCR         8;
    #define CA_SC          128;
        unsigned int flags;
    #define CA_CI_MODULE_PRESENT 1;
    #define CA_CI_MODULE_READY   2;
};
```

**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.

#### <a id="c-struct-ca_descr_info"></a>`struct ca_descr_info`

descrambler types and info.

**Definition**

```c
struct ca_descr_info {
        unsigned int num;
        unsigned int type;
    #define CA_ECD           1;
    #define CA_NDS           2;
    #define CA_DSS           4;
};
```

**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.

#### <a id="c-struct-ca_caps"></a>`struct ca_caps`

CA slot interface capabilities.

**Definition**

```c
struct ca_caps {
    unsigned int slot_num;
    unsigned int slot_type;
    unsigned int descr_num;
    unsigned int descr_type;
};
```

**Members**

- `slot_num`: total number of CA card and module slots.
- `slot_type`: bitmap with all supported types as defined at
  [`struct ca_slot_info`](#c-struct-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 at
  [`struct ca_descr_info`](#c-struct-ca_descr_info) (e. g. `CA_ECD`, `CA_NDS`, etc).

#### <a id="c-struct-ca_msg"></a>`struct ca_msg`

a message to/from a CI-CAM

**Definition**

```c
struct ca_msg {
    unsigned int index;
    unsigned int type;
    unsigned int length;
    unsigned char msg[256];
};
```

**Members**

- `index`: unused
- `type`: unused
- `length`: length of the message
- `msg`: message

**Description**

This struct carries a message to be send/received from a CI CA module.

#### <a id="c-struct-ca_descr"></a>`struct ca_descr`

CA descrambler control words info

**Definition**

```c
struct ca_descr {
    unsigned int index;
    unsigned int parity;
    unsigned char cw[8];
};
```

**Members**

- `index`: CA Descrambler slot
- `parity`: control words parity, where 0 means even and 1 means odd
- `cw`: CA Descrambler control words

---

# CA Function Calls

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Reference for CA Function Calls.

<a id="rst-ca-function-calls-1"></a>
<a id="rst-ca-function-calls"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

- [Digital TV CA open()](</kernel/userspace/userspace-api/media-dvb/ca-fopen.md>)
- [Digital TV CA close()](</kernel/userspace/userspace-api/media-dvb/ca-fclose.md>)
- [CA_RESET](</kernel/userspace/userspace-api/media-dvb/ca-reset.md>)
- [CA_GET_CAP](</kernel/userspace/userspace-api/media-dvb/ca-get-cap.md>)
- [CA_GET_SLOT_INFO](</kernel/userspace/userspace-api/media-dvb/ca-get-slot-info.md>)
- [CA_GET_DESCR_INFO](</kernel/userspace/userspace-api/media-dvb/ca-get-descr-info.md>)
- [CA_GET_MSG](</kernel/userspace/userspace-api/media-dvb/ca-get-msg.md>)
- [CA_SEND_MSG](</kernel/userspace/userspace-api/media-dvb/ca-send-msg.md>)
- [CA_SET_DESCR](</kernel/userspace/userspace-api/media-dvb/ca-set-descr.md>)

---

# 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.

<a id="rst-the-high-level-ci-api"></a>

<!-- SPDX-License-Identifier: GPL-2.0 -->

> [!NOTE]
>
> This documentation is outdated.

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.

<a id="rst-why-the-need-for-another-ci-interface"></a>

## 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:



```c
typedef struct ca_slot_info {
        int num;               /* slot number */

        int type;              /* CA interface this slot supports */
#define CA_CI            1     /* CI high level interface */
#define CA_CI_LINK       2     /* CI link layer level interface */
#define CA_CI_PHYS       4     /* CI physical layer level interface */
#define CA_DESCR         8     /* built-in descrambler */
#define CA_SC          128     /* simple smart card interface */

        unsigned int flags;
#define CA_CI_MODULE_PRESENT 1 /* module (or card) inserted */
#define CA_CI_MODULE_READY   2
} 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:



```none
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.



```c
/* a message to/from a CI-CAM */
typedef struct ca_msg {
        unsigned int index;
        unsigned int type;
        unsigned int length;
        unsigned char msg[256];
} ca_msg_t;
```

The flow of data can be described thus,



```none
     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.

<a id="rst-digital-tv-demux-device"></a>
<a id="rst-dvb-demux"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

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.

- [Demux Data Types](</kernel/userspace/userspace-api/media-dvb/dmx-types.md>)
- [Demux Function Calls](</kernel/userspace/userspace-api/media-dvb/dmx-fcalls.md>)

---

# DMX_ADD_PID

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "dmx_add_pid".

<a id="rst-dmx-add-pid-1"></a>
<a id="rst-dmx-add-pid"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_ADD_PID

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_ADD_PID"></a>

```c
DMX_ADD_PID
```

`int ioctl(fd, DMX_ADD_PID, __u16 *pid)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`pid`**

  PID number to be filtered.

<a id="rst-description"></a>

## Description

This ioctl call allows to add multiple PIDs to a transport stream filter previously set up with [DMX_SET_PES_FILTER](</kernel/userspace/userspace-api/media-dvb/dmx-set-pes-filter.md#rst-dmx-set-pes-filter-1>) and output equal to `DMX_OUT_TSDEMUX_TAP <dmx_output>`.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl DMX_EXPBUF

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> DMX_EXPBUF - Export a buffer as a DMABUF file descriptor.

<a id="rst-ioctl-dmx-expbuf"></a>
<a id="rst-dmx-expbuf"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_EXPBUF - Export a buffer as a DMABUF file descriptor.

> [!WARNING]
>
> this API is still experimental

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_EXPBUF"></a>

```c
DMX_EXPBUF
```

`int ioctl(int fd, DMX_EXPBUF, struct dmx_exportbuffer *argp)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`argp`**

  Pointer to struct `dmx_exportbuffer`.

<a id="rst-description"></a>

## 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](</kernel/userspace/userspace-api/media-dvb/dmx-reqbufs.md#rst-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](</kernel/userspace/userspace-api/media-dvb/dmx-reqbufs.md#rst-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](<#rst-dmx-expbuf>) calls.

After calling [ioctl DMX_EXPBUF](<#rst-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.

<a id="rst-examples"></a>

## Examples



```c
int buffer_export(int v4lfd, enum dmx_buf_type bt, int index, int *dmafd)
{
    struct dmx_exportbuffer expbuf;

    memset(&expbuf, 0, sizeof(expbuf));
    expbuf.type = bt;
    expbuf.index = index;
    if (ioctl(v4lfd, DMX_EXPBUF, &expbuf) == -1) {
        perror("DMX_EXPBUF");
        return -1;
    }

    *dmafd = expbuf.fd;

    return 0;
}
```

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

- **EINVAL**

  A queue is not in MMAP mode or DMABUF exporting is not supported or `flags` or `index` fields are invalid.

---

# Digital TV demux close()

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Digital TV demux close()

<a id="rst-digital-tv-demux-close"></a>
<a id="rst-dmx-fclose"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

Digital TV demux close()

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-close"></a>

```c
int close(int fd)
```

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by a previous call to `open()`.

<a id="rst-description"></a>

## Description

This system call deactivates and deallocates a filter that was previously allocated via the `open()` call.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# Digital TV demux open()

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Digital TV demux open()

<a id="rst-digital-tv-demux-open"></a>
<a id="rst-dmx-fopen"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

Digital TV demux open()

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-open"></a>

```c
int open(const char *deviceName, int flags)
```

<a id="rst-arguments"></a>

## Arguments

- **`name`**

  Name of specific Digital TV demux device.

- **`flags`**

  A bit-wise OR of the following flags:

<!-- tabularcolumns: |p{2.5cm}|p{15.0cm}| -->


<table>
<tbody>
<tr>
<td>


`O_RDONLY`

</td>
<td>


read-only access

</td>
</tr>
<tr>
<td>


`O_RDWR`

</td>
<td>


read/write access

</td>
</tr>
<tr>
<td>


`O_NONBLOCK`

</td>
<td>


open in non-blocking mode (blocking mode is the default)

</td>
</tr>
</tbody>
</table>

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## Return Value

On success 0 is returned.

On error -1 is returned, and the `errno` variable is set appropriately.

<!-- tabularcolumns: |p{2.5cm}|p{15.0cm}| -->


<table>
<tbody>
<tr>
<td>


`EMFILE`

</td>
<td>


"Too many open files", i.e. no more filters available.

</td>
</tr>
</tbody>
</table>

The generic error codes are described at the [Generic Error Codes](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# Digital TV demux read()

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Digital TV demux read()

<a id="rst-digital-tv-demux-read"></a>
<a id="rst-dmx-fread"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

Digital TV demux read()

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-read"></a>

```c
size_t read(int fd, void *buf, size_t count)
```

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  > File descriptor returned by a previous call to `open()`.

  - **`buf`**

    Buffer to be filled

- **`count`**

  Max number of bytes to read

<a id="rst-description"></a>

## 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.

> [!NOTE]
>
> if a section filter created with `DMX_CHECK_CRC <dmx_sct_filter_params>` flag set, data that fails on CRC check will be silently ignored.

<a id="rst-return-value"></a>

## Return Value

On success 0 is returned.

On error -1 is returned, and the `errno` variable is set appropriately.

<!-- tabularcolumns: |p{2.5cm}|p{15.0cm}| -->


<table>
<tbody>
<tr>
<td>


`EWOULDBLOCK`

</td>
<td>


No data to return and `O_NONBLOCK` was specified.

</td>
</tr>
<tr>
<td>


`EOVERFLOW`

</td>
<td>


The filtered data was not read from the buffer in due time, resulting in non-read data being lost. The buffer is flushed.

</td>
</tr>
<tr>
<td>


`ETIMEDOUT`

</td>
<td>


The section was not loaded within the stated timeout period. See ioctl [DMX_SET_FILTER](</kernel/userspace/userspace-api/media-dvb/dmx-set-filter.md#rst-dmx-set-filter-1>) for how to set a timeout.

</td>
</tr>
<tr>
<td>


`EFAULT`

</td>
<td>


The driver failed to write to the callers buffer due to an invalid \*buf pointer.

</td>
</tr>
</tbody>
</table>

The generic error codes are described at the [Generic Error Codes](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# Digital TV demux write()

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Digital TV demux write()

<a id="rst-digital-tv-demux-write"></a>
<a id="rst-dmx-fwrite"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

Digital TV demux write()

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-write"></a>

```c
ssize_t write(int fd, const void *buf, size_t count)
```

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by a previous call to `open()`.

- **`buf`**

  Buffer with data to be written

- **`count`**

  Number of bytes at the buffer

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## Return Value

On success 0 is returned.

On error -1 is returned, and the `errno` variable is set appropriately.

<!-- tabularcolumns: |p{2.5cm}|p{15.0cm}| -->


<table>
<tbody>
<tr>
<td>


`EWOULDBLOCK`

</td>
<td>


No data was written. This might happen if `O_NONBLOCK` was specified and there is no more buffer space available (if `O_NONBLOCK` is not specified the function will block until buffer space is available).

</td>
</tr>
<tr>
<td>


`EBUSY`

</td>
<td>


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 `DMX_IN_DVR` are started.

</td>
</tr>
</tbody>
</table>

The generic error codes are described at the [Generic Error Codes](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# DMX_GET_PES_PIDS

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "dmx_get_pes_pids".

<a id="rst-dmx-get-pes-pids-1"></a>
<a id="rst-dmx-get-pes-pids"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_GET_PES_PIDS

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_GET_PES_PIDS"></a>

```c
DMX_GET_PES_PIDS
```

`int ioctl(fd, DMX_GET_PES_PIDS, __u16 pids[5])`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`pids`**

  Array used to store 5 Program IDs.

<a id="rst-description"></a>

## 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:


<table>
<thead>
<tr>
<th>


PID  element

</th>
<th>


position

</th>
<th>


content

</th>
</tr>
</thead>
<tbody>
<tr>
<td>


pids\[DMX_PES_AUDIO\]

</td>
<td>


0

</td>
<td>


first audio PID

</td>
</tr>
<tr>
<td>


pids\[DMX_PES_VIDEO\]

</td>
<td>


1

</td>
<td>


first video PID

</td>
</tr>
<tr>
<td>


pids\[DMX_PES_TELETEXT\]

</td>
<td>


2

</td>
<td>


first teletext PID

</td>
</tr>
<tr>
<td>


pids\[DMX_PES_SUBTITLE\]

</td>
<td>


3

</td>
<td>


first subtitle PID

</td>
</tr>
<tr>
<td>


pids\[DMX_PES_PCR\]

</td>
<td>


4

</td>
<td>


first Program Clock Reference PID

</td>
</tr>
</tbody>
</table>

> [!NOTE]
>
> A value equal to 0xffff means that the PID was not filled by the Kernel.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# DMX_GET_STC

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "dmx_get_stc".

<a id="rst-dmx-get-stc-1"></a>
<a id="rst-dmx-get-stc"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_GET_STC

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_GET_STC"></a>

```c
DMX_GET_STC
```

`int ioctl(int fd, DMX_GET_STC, struct dmx_stc *stc)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`stc`**

  Pointer to `dmx_stc` where the stc data is to be stored.

<a id="rst-description"></a>

## 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`.

<a id="rst-return-value"></a>

## Return Value

On success 0 is returned.

On error -1 is returned, and the `errno` variable is set appropriately.

<!-- tabularcolumns: |p{2.5cm}|p{15.0cm}| -->


<table>
<tbody>
<tr>
<td>


`EINVAL`

</td>
<td>


Invalid stc number.

</td>
</tr>
</tbody>
</table>

The generic error codes are described at the [Generic Error Codes](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# Digital TV mmap()

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> dmx-mmap - Map device memory into application address space

<a id="rst-digital-tv-mmap"></a>
<a id="rst-dmx-mmap"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

dmx-mmap - Map device memory into application address space

> [!WARNING]
>
> this API is still experimental

<a id="rst-synopsis"></a>

## Synopsis



```c
#include <unistd.h>
#include <sys/mman.h>
```





<a id="c-mmap"></a>

```c
void *mmap( void *start, size_t length, int prot, int flags, int fd, off_t offset )
```

<a id="rst-arguments"></a>

## Arguments

- **`start`**

  Map the buffer to this address in the application's address space. When the `MAP_FIXED` flag is specified, `start` must 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 a `NULL` pointer here.

- **`length`**

  Length of the memory area to map. This must be a multiple of the DVB packet length (188, on most drivers).

- **`prot`**

  The `prot` argument describes the desired memory protection. Regardless of the device type and the direction of data exchange it should be set to `PROT_READ` \| `PROT_WRITE`, permitting read and write access to image buffers. Drivers should support at least this combination of flags.

- **`flags`**

  The `flags` parameter 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_FIXED` requests that the driver selects no other address than the one specified. If the specified address cannot be used, `mmap()` will fail. If `MAP_FIXED` is specified, `start` must be a multiple of the pagesize. Use of this option is discouraged.

  One of the `MAP_SHARED` or `MAP_PRIVATE` flags must be set. `MAP_SHARED` allows applications to share the mapped memory with other (e. g. child-) processes.

  > [!NOTE]
  >
  > The Linux Digital TV applications should not set the `MAP_PRIVATE`, `MAP_DENYWRITE`, `MAP_EXECUTABLE` or `MAP_ANON` flags.

- **`fd`**

  File descriptor returned by `open()`.

- **`offset`**

  Offset of the buffer in device memory, as returned by [ioctl DMX_QUERYBUF](</kernel/userspace/userspace-api/media-dvb/dmx-querybuf.md#rst-dmx-querybuf>) ioctl.

<a id="rst-description"></a>

## 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](</kernel/userspace/userspace-api/media-dvb/dmx-querybuf.md#rst-dmx-querybuf>) ioctl. Buffers must be allocated with the [ioctl DMX_REQBUFS](</kernel/userspace/userspace-api/media-dvb/dmx-reqbufs.md#rst-dmx-reqbufs>) ioctl before they can be queried.

To unmap buffers the `munmap()` function is used.

<a id="rst-return-value"></a>

## 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**

  `fd` is not a valid file descriptor.

- **EACCES**

  `fd` is not open for reading and writing.

- **EINVAL**

  The `start` or `length` or `offset` are not suitable. (E. g. they are too large, or not aligned on a `PAGESIZE` boundary.)

  The `flags` or `prot` value is not supported.

  No buffers have been allocated with the [ioctl DMX_REQBUFS](</kernel/userspace/userspace-api/media-dvb/dmx-reqbufs.md#rst-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)_

> dmx-munmap - Unmap device memory

<a id="rst-dvb-munmap"></a>
<a id="rst-dmx-munmap"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

dmx-munmap - Unmap device memory

> [!WARNING]
>
> This API is still experimental.

<a id="rst-synopsis"></a>

## Synopsis



```c
#include <unistd.h>
#include <sys/mman.h>
```





<a id="c-munmap"></a>

```c
int munmap( void *start, size_t length )
```

<a id="rst-arguments"></a>

## Arguments

- **`start`**

  Address of the mapped buffer as returned by the `mmap()` function.

- **`length`**

  Length of the mapped buffer. This must be the same value as given to `mmap()`.

<a id="rst-description"></a>

## Description

Unmaps a previously with the `mmap()` function mapped buffer and frees it, if possible.

<a id="rst-return-value"></a>

## Return Value

On success `munmap()` returns 0, on failure -1 and the `errno` variable is set appropriately:

- **EINVAL**

  The `start` or `length` is incorrect, or no buffers have been mapped yet.

---

# ioctl DMX_QBUF, DMX_DQBUF

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> DMX_QBUF - DMX_DQBUF - Exchange a buffer with the driver

<a id="rst-ioctl-dmx-qbuf-dmx-dqbuf"></a>
<a id="rst-dmx-qbuf"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_QBUF - DMX_DQBUF - Exchange a buffer with the driver

> [!WARNING]
>
> this API is still experimental

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_QBUF"></a>

```c
DMX_QBUF
```

`int ioctl(int fd, DMX_QBUF, struct dmx_buffer *argp)`





<a id="c-DMX_DQBUF"></a>

```c
DMX_DQBUF
```

`int ioctl(int fd, DMX_DQBUF, struct dmx_buffer *argp)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`argp`**

  Pointer to struct `dmx_buffer`.

<a id="rst-description"></a>

## 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](</kernel/userspace/userspace-api/media-dvb/dmx-reqbufs.md#rst-dmx-reqbufs>) (struct `dmx_requestbuffers` `count`) minus one. The contents of the struct `dmx_buffer` returned by a [ioctl DMX_QUERYBUF](</kernel/userspace/userspace-api/media-dvb/dmx-querybuf.md#rst-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](<https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/Documentation/userspace-api/media/v4l/buffer.rst?id=9021cc14f7d98b4a1d2c932f52c5343d4d0f6b92>).

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

- **EAGAIN**

  Non-blocking I/O has been selected using `O_NONBLOCK` and no buffer was in the outgoing queue.

- **EINVAL**

  The `index` is out of bounds, or no buffers have been allocated yet.

- **EIO**

  `DMX_DQBUF` failed 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)_

> DMX_QUERYBUF - Query the status of a buffer

<a id="rst-ioctl-dmx-querybuf"></a>
<a id="rst-dmx-querybuf"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_QUERYBUF - Query the status of a buffer

> [!WARNING]
>
> this API is still experimental

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_QUERYBUF"></a>

```c
DMX_QUERYBUF
```

`int ioctl(int fd, DMX_QUERYBUF, struct dvb_buffer *argp)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`argp`**

  Pointer to struct `dvb_buffer`.

<a id="rst-description"></a>

## 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](</kernel/userspace/userspace-api/media-dvb/dmx-reqbufs.md#rst-dmx-reqbufs>) ioctl.

Applications set the `index` field. Valid index numbers range from zero to the number of buffers allocated with [ioctl DMX_REQBUFS](</kernel/userspace/userspace-api/media-dvb/dmx-reqbufs.md#rst-dmx-reqbufs>) (struct `dvb_requestbuffers` `count`) minus one.

After calling [ioctl DMX_QUERYBUF](<#rst-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).

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

- **EINVAL**

  The `index` is out of bounds.

---

# DMX_REMOVE_PID

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "dmx_remove_pid".

<a id="rst-dmx-remove-pid-1"></a>
<a id="rst-dmx-remove-pid"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_REMOVE_PID

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_REMOVE_PID"></a>

```c
DMX_REMOVE_PID
```

`int ioctl(fd, DMX_REMOVE_PID, __u16 *pid)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`pid`**

  PID of the PES filter to be removed.

<a id="rst-description"></a>

## 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](</kernel/userspace/userspace-api/media-dvb/dmx-set-pes-filter.md#rst-dmx-set-pes-filter-1>) or [DMX_ADD_PID](</kernel/userspace/userspace-api/media-dvb/dmx-add-pid.md#rst-dmx-add-pid-1>).

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl DMX_REQBUFS

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> DMX_REQBUFS - Initiate Memory Mapping and/or DMA buffer I/O

<a id="rst-ioctl-dmx-reqbufs"></a>
<a id="rst-dmx-reqbufs"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_REQBUFS - Initiate Memory Mapping and/or DMA buffer I/O

> [!WARNING]
>
> this API is still experimental

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_REQBUFS"></a>

```c
DMX_REQBUFS
```

`int ioctl(int fd, DMX_REQBUFS, struct dmx_requestbuffers *argp)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`argp`**

  Pointer to struct `dmx_requestbuffers`.

<a id="rst-description"></a>

## 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](<#rst-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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) 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)_

> Duplicate implicit target name: "dmx_set_buffer_size".

<a id="rst-dmx-set-buffer-size-1"></a>
<a id="rst-dmx-set-buffer-size"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_SET_BUFFER_SIZE

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_SET_BUFFER_SIZE"></a>

```c
DMX_SET_BUFFER_SIZE
```

`int ioctl(int fd, DMX_SET_BUFFER_SIZE, unsigned long size)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`size`**

  Unsigned long size

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# DMX_SET_FILTER

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "dmx_set_filter".

<a id="rst-dmx-set-filter-1"></a>
<a id="rst-dmx-set-filter"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_SET_FILTER

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_SET_FILTER"></a>

```c
DMX_SET_FILTER
```

`int ioctl(int fd, DMX_SET_FILTER, struct dmx_sct_filter_params *params)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

`params`

> Pointer to structure containing filter parameters.

<a id="rst-description"></a>

## 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](</kernel/userspace/userspace-api/media-dvb/dmx-start.md#rst-dmx-start-1>) ioctl call). If a filter was previously set-up, this filter will be canceled, and the receive buffer will be flushed.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# DMX_SET_PES_FILTER

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "dmx_set_pes_filter".

<a id="rst-dmx-set-pes-filter-1"></a>
<a id="rst-dmx-set-pes-filter"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_SET_PES_FILTER

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_SET_PES_FILTER"></a>

```c
DMX_SET_PES_FILTER
```

`int ioctl(int fd, DMX_SET_PES_FILTER, struct dmx_pes_filter_params *params)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`params`**

  Pointer to structure containing filter parameters.

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## Return Value

On success 0 is returned.

On error -1 is returned, and the `errno` variable is set appropriately.

<!-- tabularcolumns: |p{2.5cm}|p{15.0cm}| -->


<table>
<tbody>
<tr>
<td>


`EBUSY`

</td>
<td>


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.

</td>
</tr>
</tbody>
</table>

The generic error codes are described at the [Generic Error Codes](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# DMX_START

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "dmx_start".

<a id="rst-dmx-start-1"></a>
<a id="rst-dmx-start"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_START

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_START"></a>

```c
DMX_START
```

`int ioctl(int fd, DMX_START)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

<a id="rst-description"></a>

## Description

This ioctl call is used to start the actual filtering operation defined via the ioctl calls [DMX_SET_FILTER](</kernel/userspace/userspace-api/media-dvb/dmx-set-filter.md#rst-dmx-set-filter-1>) or [DMX_SET_PES_FILTER](</kernel/userspace/userspace-api/media-dvb/dmx-set-pes-filter.md#rst-dmx-set-pes-filter-1>).

<a id="rst-return-value"></a>

## Return Value

On success 0 is returned.

On error -1 is returned, and the `errno` variable is set appropriately.

<!-- tabularcolumns: |p{2.5cm}|p{15.0cm}| -->


<table>
<tbody>
<tr>
<td>


`EINVAL`

</td>
<td>


Invalid argument, i.e. no filtering parameters provided via the [DMX_SET_FILTER](</kernel/userspace/userspace-api/media-dvb/dmx-set-filter.md#rst-dmx-set-filter-1>) or [DMX_SET_PES_FILTER](</kernel/userspace/userspace-api/media-dvb/dmx-set-pes-filter.md#rst-dmx-set-pes-filter-1>) ioctls.

</td>
</tr>
<tr>
<td>


`EBUSY`

</td>
<td>


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.

</td>
</tr>
</tbody>
</table>

The generic error codes are described at the [Generic Error Codes](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# DMX_STOP

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "dmx_stop".

<a id="rst-dmx-stop-1"></a>
<a id="rst-dmx-stop"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->

<a id="rst-name"></a>

## Name

DMX_STOP

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-DMX_STOP"></a>

```c
DMX_STOP
```

`int ioctl(int fd, DMX_STOP)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

<a id="rst-description"></a>

## Description

This ioctl call is used to stop the actual filtering operation defined via the ioctl calls [DMX_SET_FILTER](</kernel/userspace/userspace-api/media-dvb/dmx-set-filter.md#rst-dmx-set-filter-1>) or [DMX_SET_PES_FILTER](</kernel/userspace/userspace-api/media-dvb/dmx-set-pes-filter.md#rst-dmx-set-pes-filter-1>) and started via the [DMX_START](</kernel/userspace/userspace-api/media-dvb/dmx-start.md#rst-dmx-start-1>) command.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# Demux Function Calls

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Reference for Demux Function Calls.

<a id="rst-demux-function-calls"></a>
<a id="rst-dmx-fcalls"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

- [Digital TV demux open()](</kernel/userspace/userspace-api/media-dvb/dmx-fopen.md>)
- [Digital TV demux close()](</kernel/userspace/userspace-api/media-dvb/dmx-fclose.md>)
- [Digital TV demux read()](</kernel/userspace/userspace-api/media-dvb/dmx-fread.md>)
- [Digital TV demux write()](</kernel/userspace/userspace-api/media-dvb/dmx-fwrite.md>)
- [Digital TV mmap()](</kernel/userspace/userspace-api/media-dvb/dmx-mmap.md>)
- [DVB munmap()](</kernel/userspace/userspace-api/media-dvb/dmx-munmap.md>)
- [DMX_START](</kernel/userspace/userspace-api/media-dvb/dmx-start.md>)
- [DMX_STOP](</kernel/userspace/userspace-api/media-dvb/dmx-stop.md>)
- [DMX_SET_FILTER](</kernel/userspace/userspace-api/media-dvb/dmx-set-filter.md>)
- [DMX_SET_PES_FILTER](</kernel/userspace/userspace-api/media-dvb/dmx-set-pes-filter.md>)
- [DMX_SET_BUFFER_SIZE](</kernel/userspace/userspace-api/media-dvb/dmx-set-buffer-size.md>)
- [DMX_GET_STC](</kernel/userspace/userspace-api/media-dvb/dmx-get-stc.md>)
- [DMX_GET_PES_PIDS](</kernel/userspace/userspace-api/media-dvb/dmx-get-pes-pids.md>)
- [DMX_ADD_PID](</kernel/userspace/userspace-api/media-dvb/dmx-add-pid.md>)
- [DMX_REMOVE_PID](</kernel/userspace/userspace-api/media-dvb/dmx-remove-pid.md>)
- [ioctl DMX_REQBUFS](</kernel/userspace/userspace-api/media-dvb/dmx-reqbufs.md>)
- [ioctl DMX_QUERYBUF](</kernel/userspace/userspace-api/media-dvb/dmx-querybuf.md>)
- [ioctl DMX_EXPBUF](</kernel/userspace/userspace-api/media-dvb/dmx-expbuf.md>)
- [ioctl DMX_QBUF, DMX_DQBUF](</kernel/userspace/userspace-api/media-dvb/dmx-qbuf.md>)

---

# Demux Data Types

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Reference for Demux Data Types.

<a id="rst-demux-data-types"></a>
<a id="rst-dmx-types"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.dmx -->


#### <a id="c-enum-dmx_output"></a>`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.

#### <a id="c-enum-dmx_input"></a>`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.

#### <a id="c-enum-dmx_ts_pes"></a>`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.

#### <a id="c-struct-dmx_filter"></a>`struct dmx_filter`

Specifies a section header filter.

**Definition**

```c
struct dmx_filter {
    __u8 filter[DMX_FILTER_SIZE];
    __u8 mask[DMX_FILTER_SIZE];
    __u8 mode[DMX_FILTER_SIZE];
};
```

**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).

#### <a id="c-struct-dmx_sct_filter_params"></a>`struct dmx_sct_filter_params`

Specifies a section filter.

**Definition**

```c
struct dmx_sct_filter_params {
        __u16 pid;
        struct dmx_filter filter;
        __u32 timeout;
        __u32 flags;
    #define DMX_CHECK_CRC       1;
    #define DMX_ONESHOT         2;
    #define DMX_IMMEDIATE_START 4;
};
```

**Members**

- `pid`: PID to be filtered.
- `filter`: section header filter, as defined by [`struct dmx_filter`](#c-struct-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.

#### <a id="c-struct-dmx_pes_filter_params"></a>`struct dmx_pes_filter_params`

Specifies Packetized Elementary Stream (PES) filter parameters.

**Definition**

```c
struct dmx_pes_filter_params {
    __u16 pid;
    enum dmx_input  input;
    enum dmx_output output;
    enum dmx_ts_pes pes_type;
    __u32 flags;
};
```

**Members**

- `pid`: PID to be filtered.
- `input`: Demux input, as specified by [`enum dmx_input`](#c-enum-dmx_input).
- `output`: Demux output, as specified by [`enum dmx_output`](#c-enum-dmx_output).
- `pes_type`: Type of the pes filter, as specified by `enum dmx_pes_type`.
- `flags`: Demux PES flags.

#### <a id="c-struct-dmx_stc"></a>`struct dmx_stc`

Stores System Time Counter (STC) information.

**Definition**

```c
struct dmx_stc {
    unsigned int num;
    unsigned int base;
    __u64 stc;
};
```

**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.

#### <a id="c-enum-dmx_buffer_flags"></a>`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.

#### <a id="c-struct-dmx_buffer"></a>`struct dmx_buffer`

dmx buffer info

**Definition**

```c
struct dmx_buffer {
    __u32 index;
    __u32 bytesused;
    __u32 offset;
    __u32 length;
    __u32 flags;
    __u32 count;
};
```

**Members**

- `index`: id number of the buffer
- `bytesused`: 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 to `mmap()` as offset)
- `length`: size in bytes of the buffer
- `flags`: bit array of buffer flags as defined by [`enum dmx_buffer_flags`](#c-enum-dmx_buffer_flags).
  Filled only at `DMX_DQBUF`.
- `count`: monotonic counter for filled buffers. Helps to identify
  data stream loses. Filled only at `DMX_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.

#### <a id="c-struct-dmx_requestbuffers"></a>`struct dmx_requestbuffers`

request dmx buffer information

**Definition**

```c
struct dmx_requestbuffers {
    __u32 count;
    __u32 size;
};
```

**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.

#### <a id="c-struct-dmx_exportbuffer"></a>`struct dmx_exportbuffer`

export of dmx buffer as DMABUF file descriptor

**Definition**

```c
struct dmx_exportbuffer {
    __u32 index;
    __u32 flags;
    __s32 fd;
};
```

**Members**

- `index`: id number of the buffer
- `flags`: flags for newly created file, currently only O_CLOEXEC is
  supported, refer to manual of open syscall for more details
- `fd`: 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 <FE_GET_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.

<a id="rst-querying-frontend-status-and-statistics"></a>
<a id="rst-dvb-fe-read-status"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

Once [FE_SET_PROPERTY](</kernel/userspace/userspace-api/media-dvb/fe-get-property.md#rst-fe-get-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](</kernel/userspace/userspace-api/media-dvb/fe-read-status.md#rst-fe-read-status>).

Signal statistics are provided via [ioctl FE_SET_PROPERTY, FE_GET_PROPERTY](</kernel/userspace/userspace-api/media-dvb/fe-get-property.md#rst-fe-get-property>).

> [!NOTE]
>
> Most statistics require the demodulator to be fully locked (e. g. with `FE_HAS_LOCK <fe_status>` bit set). See [Frontend statistics indicators](</kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-frontend-stat-properties>) for more details.

---

# frontend events

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Reference for frontend events.

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->





<a id="c-dvb_frontend_event"></a>

```c
dvb_frontend_event
```

<a id="rst-frontend-events"></a>

## frontend events



```c
struct dvb_frontend_event {
    fe_status_t status;
    struct dvb_frontend_parameters parameters;
};
```

---

# frontend parameters

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> The kind of parameters passed to the frontend device for tuning depend on the kind of hardware you are using.

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->





<a id="c-dvb_frontend_parameters"></a>

```c
dvb_frontend_parameters
```

<a id="rst-frontend-parameters"></a>

## 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](</kernel/userspace/userspace-api/media-dvb/fe-get-property.md#rst-fe-get-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](</kernel/userspace/userspace-api/media-dvb/fe-get-property.md#rst-fe-get-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:



```c
struct dvb_frontend_parameters {
    uint32_t frequency;     /* (absolute) frequency in Hz for QAM/OFDM */
                /* intermediate frequency in kHz for QPSK */
    fe_spectral_inversion_t inversion;
    union {
        struct dvb_qpsk_parameters qpsk;
        struct dvb_qam_parameters  qam;
        struct dvb_ofdm_parameters ofdm;
        struct dvb_vsb_parameters  vsb;
    } u;
};
```

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.





<a id="c-dvb_qpsk_parameters"></a>

```c
dvb_qpsk_parameters
```

<a id="rst-qpsk-parameters"></a>

### QPSK parameters

For satellite QPSK frontends you have to use the `dvb_qpsk_parameters` structure:



```c
struct dvb_qpsk_parameters {
    uint32_t        symbol_rate;  /* symbol rate in Symbols per second */
    fe_code_rate_t  fec_inner;    /* forward error correction (see above) */
};
```





<a id="c-dvb_qam_parameters"></a>

```c
dvb_qam_parameters
```

<a id="rst-qam-parameters"></a>

### QAM parameters

for cable QAM frontend you use the `dvb_qam_parameters` structure:



```c
struct dvb_qam_parameters {
    uint32_t         symbol_rate; /* symbol rate in Symbols per second */
    fe_code_rate_t   fec_inner;   /* forward error correction (see above) */
    fe_modulation_t  modulation;  /* modulation type (see above) */
};
```





<a id="c-dvb_vsb_parameters"></a>

```c
dvb_vsb_parameters
```

<a id="rst-vsb-parameters"></a>

### VSB parameters

ATSC frontends are supported by the `dvb_vsb_parameters` structure:



```c
struct dvb_vsb_parameters {
    fe_modulation_t modulation; /* modulation type (see above) */
};
```





<a id="c-dvb_ofdm_parameters"></a>

```c
dvb_ofdm_parameters
```

<a id="rst-ofdm-parameters"></a>

### OFDM parameters

DVB-T frontends are supported by the `dvb_ofdm_parameters` structure:



```c
struct dvb_ofdm_parameters {
    fe_bandwidth_t      bandwidth;
    fe_code_rate_t      code_rate_HP;  /* high priority stream code rate */
    fe_code_rate_t      code_rate_LP;  /* low priority stream code rate */
    fe_modulation_t     constellation; /* modulation type (see above) */
    fe_transmit_mode_t  transmission_mode;
    fe_guard_interval_t guard_interval;
    fe_hierarchy_t      hierarchy_information;
};
```

---

# Part II - Digital TV API

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Version 5.10

<a id="rst-part-ii-digital-tv-api"></a>
<a id="rst-dvbapi"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- This data file has been placed in the public domain. -->

<!-- Derived from the Unicode character mappings available from
<http://www.w3.org/2003/entities/xml/>.
Processed by unicode2rstsubs.py, part of Docutils:
<https://docutils.sourceforge.io>. -->

> [!NOTE]
>
> This API is also known as Linux **DVB API**.
>
> It it was originally written to support the European digital TV standard (DVB), and later extended to support all digital TV standards.
>
> In order to avoid confusion, within this document, it was opted to refer to it, and to associated hardware as **Digital TV**.
>
> The word **DVB** is reserved to be used for:
>
> > - the Digital TV API version (e. g. DVB API version 3 or DVB API version 5);
> >
> > - digital TV data types (enums, structs, defines, etc);
> >
> > - digital TV device nodes (`/dev/dvb/...`);
> >
> > - the European DVB standard.

**Version 5.10**

**Table of Contents**

1. [Introduction](</kernel/userspace/userspace-api/media-dvb/intro.md>)
2. [Digital TV Frontend API](</kernel/userspace/userspace-api/media-dvb/frontend.md>)
3. [Digital TV Demux Device](</kernel/userspace/userspace-api/media-dvb/demux.md>)
4. [Digital TV CA Device](</kernel/userspace/userspace-api/media-dvb/ca.md>)
5. [Digital TV Network API](</kernel/userspace/userspace-api/media-dvb/net.md>)
6. [Digital TV Deprecated APIs](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-apis.md>)
7. [Examples](</kernel/userspace/userspace-api/media-dvb/examples.md>)
8. [headers](<https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/Documentation/userspace-api/media/dvb/headers.rst?id=9021cc14f7d98b4a1d2c932f52c5343d4d0f6b92>)

<a id="rst-revision-and-copyright"></a>

## Revision and Copyright

Authors:

- - **J.** - **K.** Metzler, Ralph &lt;[rjkm@metzlerbros.de](<mailto:rjkm@metzlerbros.de>)&gt;

> - Original author of the Digital TV API documentation.

- - **O.** - **C.** Metzler, Marcus &lt;[rjkm@metzlerbros.de](<mailto:rjkm@metzlerbros.de>)&gt;

> - Original author of the Digital TV API documentation.

- Carvalho Chehab, Mauro &lt;[mchehab+samsung@kernel.org](<mailto:mchehab+samsung@kernel.org>)&gt;

> - Ported document to Docbook XML, addition of DVBv5 API, documentation gaps fix.

**Copyright** © 2002-2003 : Convergence GmbH

**Copyright** © 2009-2017 : Mauro Carvalho Chehab

<a id="rst-revision-history"></a>

## 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…

<a id="rst-property-types"></a>
<a id="rst-frontend-properties"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

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](</kernel/userspace/userspace-api/media-dvb/fe-get-property.md#rst-fe-get-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.

> [!NOTE]
>
> 1. On Linux DVB API version 3, setting a frontend was done via struct `dvb_frontend_parameters`.
>
> 2. Don't use DVB API version 3 calls on hardware with supports newer standards. Such API provides no support or a very limited support to new standards and/or new hardware.
>
> 3. Nowadays, most frontends support multiple delivery systems. Only with DVB API version 5 calls it is possible to switch between the multiple delivery systems supported by a frontend.
>
> 4. DVB API version 5 is also called <em>S2API</em>, as the first new standard added to it was DVB-S2.

<strong>Example</strong>: 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](</kernel/userspace/userspace-api/media-dvb/fe-get-property.md#rst-fe-get-property>) ioctl:

> [DTV\_DELIVERY\_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system>) = SYS\_DVBC\_ANNEX\_A
>
> [DTV\_FREQUENCY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-frequency>) = 651000000
>
> [DTV\_MODULATION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-modulation>) = QAM\_256
>
> [DTV\_INVERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inversion>) = INVERSION\_AUTO
>
> [DTV\_SYMBOL\_RATE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-symbol-rate>) = 5217000
>
> [DTV\_INNER\_FEC](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inner-fec>) = FEC\_3\_4
>
> [DTV\_TUNE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tune>)

The code that would that would do the above is show in [dtv-prop-example](<#rst-dtv-prop-example>).

Example: Setting digital TV frontend properties

<a id="rst-dtv-prop-example"></a>



```c
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/dvb/frontend.h>

static struct dtv_property props[] = {
    { .cmd = DTV_DELIVERY_SYSTEM, .u.data = SYS_DVBC_ANNEX_A },
    { .cmd = DTV_FREQUENCY,       .u.data = 651000000 },
    { .cmd = DTV_MODULATION,      .u.data = QAM_256 },
    { .cmd = DTV_INVERSION,       .u.data = INVERSION_AUTO },
    { .cmd = DTV_SYMBOL_RATE,     .u.data = 5217000 },
    { .cmd = DTV_INNER_FEC,       .u.data = FEC_3_4 },
    { .cmd = DTV_TUNE }
};

static struct dtv_properties dtv_prop = {
    .num = 6, .props = props
};

int main(void)
{
    int fd = open("/dev/dvb/adapter0/frontend0", O_RDWR);

    if (!fd) {
        perror ("open");
        return -1;
    }
    if (ioctl(fd, FE_SET_PROPERTY, &dtv_prop) == -1) {
        perror("ioctl");
        return -1;
    }
    printf("Frontend set\\n");
    return 0;
}
```

> [!NOTE]
>
> While it is possible to directly call the Kernel code like the above example, it is strongly recommended to use [libdvbv5](<https://linuxtv.org/docs/libdvbv5/index.html>), as it provides abstraction to work with the supported digital TV standards and provides methods for usual operations like program scanning and to read/write channel descriptor files.

- [Digital TV property parameters](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md>)
- [Frontend statistics indicators](</kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md>)
- [Properties used on terrestrial delivery systems](</kernel/userspace/userspace-api/media-dvb/frontend-property-terrestrial-systems.md>)
- [Properties used on cable delivery systems](</kernel/userspace/userspace-api/media-dvb/frontend-property-cable-systems.md>)
- [Properties used on satellite delivery systems](</kernel/userspace/userspace-api/media-dvb/frontend-property-satellite-systems.md>)
- [Frontend uAPI data types](</kernel/userspace/userspace-api/media-dvb/frontend-header.md>)

---

# 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.

<a id="rst-examples"></a>
<a id="rst-dvb-examples"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

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](<https://linuxtv.org/docs/libdvbv5/index.html>) for updated/recommended examples.

---

# Frontend bandwidth

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Reference for Frontend bandwidth.

<a id="rst-frontend-bandwidth"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->





<a id="c-fe_bandwidth"></a>

```c
fe_bandwidth
```


<table>
<caption>enum fe_bandwidth</caption>
<thead>
<tr>
<th>


ID

</th>
<th>


Description

</th>
</tr>
</thead>
<tbody>
<tr>
<td>


<a id="rst-bandwidth-auto"></a>

`BANDWIDTH_AUTO`

</td>
<td>


Autodetect bandwidth (if supported)

</td>
</tr>
<tr>
<td>


<a id="rst-bandwidth-1-712-mhz"></a>

`BANDWIDTH_1_712_MHZ`

</td>
<td>


1.712 MHz

</td>
</tr>
<tr>
<td>


<a id="rst-bandwidth-5-mhz"></a>

`BANDWIDTH_5_MHZ`

</td>
<td>


5 MHz

</td>
</tr>
<tr>
<td>


<a id="rst-bandwidth-6-mhz"></a>

`BANDWIDTH_6_MHZ`

</td>
<td>


6 MHz

</td>
</tr>
<tr>
<td>


<a id="rst-bandwidth-7-mhz"></a>

`BANDWIDTH_7_MHZ`

</td>
<td>


7 MHz

</td>
</tr>
<tr>
<td>


<a id="rst-bandwidth-8-mhz"></a>

`BANDWIDTH_8_MHZ`

</td>
<td>


8 MHz

</td>
</tr>
<tr>
<td>


<a id="rst-bandwidth-10-mhz"></a>

`BANDWIDTH_10_MHZ`

</td>
<td>


10 MHz

</td>
</tr>
</tbody>
</table>

---

# ioctl FE_DISEQC_RECV_SLAVE_REPLY

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> FE_DISEQC_RECV_SLAVE_REPLY - Receives reply from a DiSEqC 2.0 command

<a id="rst-ioctl-fe-diseqc-recv-slave-reply"></a>
<a id="rst-fe-diseqc-recv-slave-reply"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_DISEQC_RECV_SLAVE_REPLY - Receives reply from a DiSEqC 2.0 command

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_DISEQC_RECV_SLAVE_REPLY"></a>

```c
FE_DISEQC_RECV_SLAVE_REPLY
```

`int ioctl(int fd, FE_DISEQC_RECV_SLAVE_REPLY, struct dvb_diseqc_slave_reply *argp)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`argp`**

  pointer to struct `dvb_diseqc_slave_reply`.

<a id="rst-description"></a>

## Description

Receives reply from a DiSEqC 2.0 command.

The received message is stored at the buffer pointed by `argp`.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl FE_DISEQC_RESET_OVERLOAD

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> FE_DISEQC_RESET_OVERLOAD - Restores the power to the antenna subsystem, if it was powered off due - to power overload.

<a id="rst-ioctl-fe-diseqc-reset-overload"></a>
<a id="rst-fe-diseqc-reset-overload"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_DISEQC_RESET_OVERLOAD - Restores the power to the antenna subsystem, if it was powered off due - to power overload.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_DISEQC_RESET_OVERLOAD"></a>

```c
FE_DISEQC_RESET_OVERLOAD
```

`int ioctl(int fd, FE_DISEQC_RESET_OVERLOAD, NULL)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl FE_DISEQC_SEND_BURST

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> FE_DISEQC_SEND_BURST - Sends a 22KHz tone burst for 2x1 mini DiSEqC satellite selection.

<a id="rst-ioctl-fe-diseqc-send-burst"></a>
<a id="rst-fe-diseqc-send-burst"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_DISEQC_SEND_BURST - Sends a 22KHz tone burst for 2x1 mini DiSEqC satellite selection.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_DISEQC_SEND_BURST"></a>

```c
FE_DISEQC_SEND_BURST
```

`int ioctl(int fd, FE_DISEQC_SEND_BURST, enum fe_sec_mini_cmd tone)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`tone`**

  An integer enumerated value described at `fe_sec_mini_cmd`.

<a id="rst-description"></a>

## 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.](<http://www.eutelsat.com/files/contributed/satellites/pdf/Diseqc/associated%20docs/simple_tone_burst_detec.pdf>)

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl FE_DISEQC_SEND_MASTER_CMD

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> FE_DISEQC_SEND_MASTER_CMD - Sends a DiSEqC command

<a id="rst-ioctl-fe-diseqc-send-master-cmd"></a>
<a id="rst-fe-diseqc-send-master-cmd"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_DISEQC_SEND_MASTER_CMD - Sends a DiSEqC command

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_DISEQC_SEND_MASTER_CMD"></a>

```c
FE_DISEQC_SEND_MASTER_CMD
```

`int ioctl(int fd, FE_DISEQC_SEND_MASTER_CMD, struct dvb_diseqc_master_cmd *argp)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`argp`**

  pointer to struct `dvb_diseqc_master_cmd`

<a id="rst-description"></a>

## Description

Sends the DiSEqC command pointed by `dvb_diseqc_master_cmd` to the antenna subsystem.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# FE_DISHNETWORK_SEND_LEGACY_CMD

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "fe_dishnetwork_send_legacy_cmd".

<a id="rst-fe-dishnetwork-send-legacy-cmd-1"></a>
<a id="rst-fe-dishnetwork-send-legacy-cmd"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_DISHNETWORK_SEND_LEGACY_CMD

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_DISHNETWORK_SEND_LEGACY_CMD"></a>

```c
FE_DISHNETWORK_SEND_LEGACY_CMD
```

`int ioctl(int fd, FE_DISHNETWORK_SEND_LEGACY_CMD, unsigned long cmd)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`cmd`**

  Sends the specified raw cmd to the dish via DISEqC.

<a id="rst-description"></a>

## Description

> [!WARNING]
>
> This is a very obscure legacy command, used only at stv0299 driver. Should not be used on newer drivers.

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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl FE_ENABLE_HIGH_LNB_VOLTAGE

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> FE_ENABLE_HIGH_LNB_VOLTAGE - Select output DC level between normal LNBf voltages or higher LNBf - voltages.

<a id="rst-ioctl-fe-enable-high-lnb-voltage"></a>
<a id="rst-fe-enable-high-lnb-voltage"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_ENABLE_HIGH_LNB_VOLTAGE - Select output DC level between normal LNBf voltages or higher LNBf - voltages.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_ENABLE_HIGH_LNB_VOLTAGE"></a>

```c
FE_ENABLE_HIGH_LNB_VOLTAGE
```

`int ioctl(int fd, FE_ENABLE_HIGH_LNB_VOLTAGE, unsigned int high)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`high`**

  Valid flags:

  - 0 - normal 13V and 18V.

  - &gt;0 - enables slightly higher voltages instead of 13/18V, in order to compensate for long antenna cables.

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# FE_GET_EVENT

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "fe_get_event".

<a id="rst-fe-get-event-1"></a>
<a id="rst-fe-get-event"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_GET_EVENT

> [!NOTE]
>
> This ioctl is deprecated.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_GET_EVENT"></a>

```c
FE_GET_EVENT
```

`int ioctl(int fd, FE_GET_EVENT, struct dvb_frontend_event *ev)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`ev`**

  Points to the location where the event, if any, is to be stored.

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## Return Value

On success 0 is returned.

On error -1 is returned, and the `errno` variable is set appropriately.


<table>
<tbody>
<tr>
<td>


`EWOULDBLOCK`

</td>
<td>


There is no event pending, and the device is in non-blocking mode.

</td>
</tr>
<tr>
<td>


`EOVERFLOW`

</td>
<td>


Overflow in event queue - one or more events were lost.

</td>
</tr>
</tbody>
</table>

Generic error codes are described at the [Generic Error Codes](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# FE_GET_FRONTEND

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "fe_get_frontend".

<a id="rst-fe-get-frontend-1"></a>
<a id="rst-fe-get-frontend"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_GET_FRONTEND

> [!NOTE]
>
> This ioctl is deprecated.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_GET_FRONTEND"></a>

```c
FE_GET_FRONTEND
```

`int ioctl(int fd, FE_GET_FRONTEND, struct dvb_frontend_parameters *p)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`p`**

  Points to parameters for tuning operation.

<a id="rst-description"></a>

## Description

This ioctl call queries the currently effective frontend parameters. For this command, read-only access to the device is sufficient.

<a id="rst-return-value"></a>

## Return Value

On success 0 is returned.

On error -1 is returned, and the `errno` variable is set appropriately.


<table>
<tbody>
<tr>
<td>


`EINVAL`

</td>
<td>


Maximum supported symbol rate reached.

</td>
</tr>
</tbody>
</table>

Generic error codes are described at the [Generic Error Codes](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl FE_GET_INFO

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

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

<a id="rst-ioctl-fe-get-info"></a>
<a id="rst-fe-get-info"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## 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.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_GET_INFO"></a>

```c
FE_GET_INFO
```

`int ioctl(int fd, FE_GET_INFO, struct dvb_frontend_info *argp)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`argp`**

  pointer to struct `dvb_frontend_info`

<a id="rst-description"></a>

## Description

All Digital TV frontend devices support the [ioctl FE_GET_INFO](<#rst-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.

<a id="rst-frontend-capabilities"></a>

## 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`.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl FE_SET_PROPERTY, FE_GET_PROPERTY

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> FE_SET_PROPERTY - FE_GET_PROPERTY - FE_SET_PROPERTY sets one or more frontend properties. - FE_GET_PROPERTY returns one or more frontend properties.

<a id="rst-ioctl-fe-set-property-fe-get-property"></a>
<a id="rst-fe-get-property"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## 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.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_GET_PROPERTY"></a>

```c
FE_GET_PROPERTY
```

`int ioctl(int fd, FE_GET_PROPERTY, struct dtv_properties *argp)`





<a id="c-FE_SET_PROPERTY"></a>

```c
FE_SET_PROPERTY
```

`int ioctl(int fd, FE_SET_PROPERTY, struct dtv_properties *argp)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`argp`**

  Pointer to struct `dtv_properties`.

<a id="rst-description"></a>

## 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.

> [!NOTE]
>
> At return, the values aren't updated to reflect the actual parameters used. If the actual parameters are needed, an explicit call to `FE_GET_PROPERTY` is needed.

- `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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# FE_READ_BER

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "fe_read_ber".

<a id="rst-fe-read-ber-1"></a>
<a id="rst-fe-read-ber"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_READ_BER

> [!NOTE]
>
> This ioctl is deprecated.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_READ_BER"></a>

```c
FE_READ_BER
```

`int ioctl(int fd, FE_READ_BER, uint32_t *ber)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`ber`**

  The bit error rate is stored into \*ber.

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# FE_READ_SIGNAL_STRENGTH

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "fe_read_signal_strength".

<a id="rst-fe-read-signal-strength-1"></a>
<a id="rst-fe-read-signal-strength"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_READ_SIGNAL_STRENGTH

> [!NOTE]
>
> This ioctl is deprecated.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_READ_SIGNAL_STRENGTH"></a>

```c
FE_READ_SIGNAL_STRENGTH
```

`int ioctl(int fd, FE_READ_SIGNAL_STRENGTH, uint16_t *strength)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`strength`**

  The signal strength value is stored into \*strength.

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# FE_READ_SNR

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "fe_read_snr".

<a id="rst-fe-read-snr-1"></a>
<a id="rst-fe-read-snr"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_READ_SNR

> [!NOTE]
>
> This ioctl is deprecated.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_READ_SNR"></a>

```c
FE_READ_SNR
```

`int ioctl(int fd, FE_READ_SNR, int16_t *snr)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`snr`**

  The signal-to-noise ratio is stored into \*snr.

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl FE_READ_STATUS

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> FE_READ_STATUS - Returns status information about the front-end. This call only requires - read-only access to the device

<a id="rst-ioctl-fe-read-status"></a>
<a id="rst-fe-read-status"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_READ_STATUS - Returns status information about the front-end. This call only requires - read-only access to the device

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_READ_STATUS"></a>

```c
FE_READ_STATUS
```

`int ioctl(int fd, FE_READ_STATUS, unsigned int *status)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`status`**

  pointer to a bitmask integer filled with the values defined by enum `fe_status`.

<a id="rst-description"></a>

## 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.

> [!NOTE]
>
> The size of status is actually sizeof(enum fe_status), with varies according with the architecture. This needs to be fixed in the future.

<a id="rst-int-fe-status"></a>

## 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

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# FE_READ_UNCORRECTED_BLOCKS

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "fe_read_uncorrected_blocks".

<a id="rst-fe-read-uncorrected-blocks-1"></a>
<a id="rst-fe-read-uncorrected-blocks"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_READ_UNCORRECTED_BLOCKS

> [!NOTE]
>
> This ioctl is deprecated.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_READ_UNCORRECTED_BLOCKS"></a>

```c
FE_READ_UNCORRECTED_BLOCKS
```

`int ioctl(int fd, FE_READ_UNCORRECTED_BLOCKS, uint32_t *ublocks)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`ublocks`**

  The total number of uncorrected blocks seen by the driver so far.

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl FE_SET_FRONTEND_TUNE_MODE

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> FE_SET_FRONTEND_TUNE_MODE - Allow setting tuner mode flags to the frontend.

<a id="rst-ioctl-fe-set-frontend-tune-mode"></a>
<a id="rst-fe-set-frontend-tune-mode"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_SET_FRONTEND_TUNE_MODE - Allow setting tuner mode flags to the frontend.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_SET_FRONTEND_TUNE_MODE"></a>

```c
FE_SET_FRONTEND_TUNE_MODE
```

`int ioctl(int fd, FE_SET_FRONTEND_TUNE_MODE, unsigned int flags)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`flags`**

  Valid 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.

<a id="rst-description"></a>

## Description

Allow setting tuner mode flags to the frontend, between 0 (normal) or `FE_TUNE_MODE_ONESHOT` mode

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# FE_SET_FRONTEND

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Duplicate implicit target name: "fe_set_frontend".

<a id="rst-fe-set-frontend-1"></a>
<a id="rst-fe-set-frontend"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

> [!NOTE]
>
> This ioctl is deprecated.

<a id="rst-name"></a>

## Name

FE_SET_FRONTEND

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_SET_FRONTEND"></a>

```c
FE_SET_FRONTEND
```

`int ioctl(int fd, FE_SET_FRONTEND, struct dvb_frontend_parameters *p)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`p`**

  Points to parameters for tuning operation.

<a id="rst-description"></a>

## 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](</kernel/userspace/userspace-api/media-dvb/fe-get-event.md#rst-fe-get-event-1>) and FrontendEvent.) If a new [FE_SET_FRONTEND](<#rst-fe-set-frontend-1>) 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.

<a id="rst-return-value"></a>

## Return Value

On success 0 is returned.

On error -1 is returned, and the `errno` variable is set appropriately.

<!-- tabularcolumns: |p{2.5cm}|p{15.0cm}| -->


<table>
<tbody>
<tr>
<td>


`EINVAL`

</td>
<td>


Maximum supported symbol rate reached.

</td>
</tr>
</tbody>
</table>

Generic error codes are described at the [Generic Error Codes](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl FE_SET_TONE

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> FE_SET_TONE - Sets/resets the generation of the continuous 22kHz tone.

<a id="rst-ioctl-fe-set-tone"></a>
<a id="rst-fe-set-tone"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_SET_TONE - Sets/resets the generation of the continuous 22kHz tone.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_SET_TONE"></a>

```c
FE_SET_TONE
```

`int ioctl(int fd, FE_SET_TONE, enum fe_sec_tone_mode tone)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`tone`**

  An integer enumerated value described at `fe_sec_tone_mode`

<a id="rst-description"></a>

## 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.

> [!NOTE]
>
> If more than one device is connected to the same antenna, setting a tone may interfere on other devices, as they may lose the capability of selecting the band. So, it is recommended that applications would change to SEC_TONE_OFF when the device is not used.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl FE_SET_VOLTAGE

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> FE_SET_VOLTAGE - Allow setting the DC level sent to the antenna subsystem.

<a id="rst-ioctl-fe-set-voltage"></a>
<a id="rst-fe-set-voltage"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

FE_SET_VOLTAGE - Allow setting the DC level sent to the antenna subsystem.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-FE_SET_VOLTAGE"></a>

```c
FE_SET_VOLTAGE
```

`int ioctl(int fd, FE_SET_VOLTAGE, enum fe_sec_voltage voltage)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`voltage`**

  An integer enumerated value described at `fe_sec_voltage`

<a id="rst-description"></a>

## 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.

> [!NOTE]
>
> if more than one device is connected to the same antenna, setting a voltage level may interfere on other devices, as they may lose the capability of setting polarization or IF. So, on those cases, setting the voltage to SEC_VOLTAGE_OFF while the device is not is used is recommended.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) 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:

<a id="rst-frontend-type"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

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:





<a id="c-fe_type"></a>

```c
fe_type
```

<!-- tabularcolumns: |p{6.6cm}|p{2.2cm}|p{8.5cm}| -->


<table>
<caption>Frontend types</caption>
<thead>
<tr>
<th>


fe_type

</th>
<th>


Description

</th>
<th>


[DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system>) equivalent type

</th>
</tr>
</thead>
<tbody>
<tr>
<td>


<a id="rst-fe-qpsk"></a>

`FE_QPSK`

</td>
<td>


For DVB-S standard

</td>
<td>


`SYS_DVBS`

</td>
</tr>
<tr>
<td>


<a id="rst-fe-qam"></a>

`FE_QAM`

</td>
<td>


For DVB-C annex A standard

</td>
<td>


`SYS_DVBC_ANNEX_A`

</td>
</tr>
<tr>
<td>


<a id="rst-fe-ofdm"></a>

`FE_OFDM`

</td>
<td>


For DVB-T standard

</td>
<td>


`SYS_DVBT`

</td>
</tr>
<tr>
<td>


<a id="rst-fe-atsc"></a>

`FE_ATSC`

</td>
<td>


For ATSC standard (terrestrial) or for DVB-C Annex B (cable) used in US.

</td>
<td>


`SYS_ATSC` (terrestrial) or `SYS_DVBC_ANNEX_B` (cable)

</td>
</tr>
</tbody>
</table>

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](</kernel/userspace/userspace-api/media-dvb/fe-get-property.md#rst-fe-get-property>) ioctl's, using the [DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-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](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-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](</kernel/userspace/userspace-api/media-dvb/fe-get-property.md#rst-fe-get-property>) using the [DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-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<FE_GET_PROPERTY>. This section describes each of them. Please notice, however, that only a subset of them are needed to setup…

<a id="rst-digital-tv-property-parameters"></a>
<a id="rst-fe-property-parameters"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

There are several different Digital TV parameters that can be used by [FE_SET_PROPERTY and FE_GET_PROPERTY ioctls](</kernel/userspace/userspace-api/media-dvb/fe-get-property.md#rst-fe-get-property>). This section describes each of them. Please notice, however, that only a subset of them are needed to setup a frontend.

<a id="rst-dtv-undefined-1"></a>
<a id="rst-dtv-undefined"></a>

## DTV_UNDEFINED

Used internally. A GET/SET operation for it won't change or return anything.

<a id="rst-dtv-tune-1"></a>
<a id="rst-dtv-tune"></a>

## DTV_TUNE

Interpret the cache of data, build either a traditional frontend tunerequest so we can pass validation in the `FE_SET_FRONTEND` ioctl.

<a id="rst-dtv-clear-1"></a>
<a id="rst-dtv-clear"></a>

## DTV_CLEAR

Reset a cache of data specific to the frontend here. This does not effect hardware.

<a id="rst-dtv-frequency-1"></a>
<a id="rst-dtv-frequency"></a>

## DTV_FREQUENCY

Frequency of the digital TV transponder/channel.

> [!NOTE]
>
> 1. For satellite delivery systems, the frequency is in kHz.
>
> 2. For cable and terrestrial delivery systems, the frequency is in Hz.
>
> 3. On most delivery systems, the frequency is the center frequency of the transponder/channel. The exception is for ISDB-T, where the main carrier has a 1/7 offset from the center.
>
> 4. For ISDB-T, the channels are usually transmitted with an offset of about 143kHz. E.g. a valid frequency could be 474,143 kHz. The stepping is  bound to the bandwidth of the channel which is typically 6MHz.
>
> 5. In ISDB-Tsb, the channel consists of only one or three segments the frequency step is 429kHz, 3\*429 respectively.

<a id="rst-dtv-modulation-1"></a>
<a id="rst-dtv-modulation"></a>

## 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.


<table>
<thead>
<tr>
<th>


Standard

</th>
<th>


Modulation types

</th>
</tr>
</thead>
<tbody>
<tr>
<td>


ATSC (version 1)

</td>
<td>


8-VSB and 16-VSB.

</td>
</tr>
<tr>
<td>


DMTB

</td>
<td>


4-QAM, 16-QAM, 32-QAM, 64-QAM and 4-QAM-NR.

</td>
</tr>
<tr>
<td>


DVB-C Annex A/C

</td>
<td>


16-QAM, 32-QAM, 64-QAM and 256-QAM.

</td>
</tr>
<tr>
<td>


DVB-C Annex B

</td>
<td>


64-QAM.

</td>
</tr>
<tr>
<td>


DVB-C2

</td>
<td>


QPSK, 16-QAM, 64-QAM, 256-QAM, 1024-QAM and 4096-QAM.

</td>
</tr>
<tr>
<td>


DVB-T

</td>
<td>


QPSK, 16-QAM and 64-QAM.

</td>
</tr>
<tr>
<td>


DVB-T2

</td>
<td>


QPSK, 16-QAM, 64-QAM and 256-QAM.

</td>
</tr>
<tr>
<td>


DVB-S

</td>
<td>


No need to set. It supports only QPSK.

</td>
</tr>
<tr>
<td>


DVB-S2

</td>
<td>


QPSK, 8-PSK, 16-APSK and 32-APSK.

</td>
</tr>
<tr>
<td>


DVB-S2X

</td>
<td>


8-APSK-L, 16-APSK-L, 32-APSK-L, 64-APSK and 64-APSK-L.

</td>
</tr>
<tr>
<td>


ISDB-T

</td>
<td>


QPSK, DQPSK, 16-QAM and 64-QAM.

</td>
</tr>
<tr>
<td>


ISDB-S

</td>
<td>


8-PSK, QPSK and BPSK.

</td>
</tr>
</tbody>
</table>

> [!NOTE]
>
> As DVB-S2X specifies extensions to the DVB-S2 standard, the same delivery system enum value is used (SYS_DVBS2).
>
> Please notice that some of the above modulation types may not be defined currently at the Kernel. The reason is simple: no driver needed such definition yet.

<a id="rst-dtv-bandwidth-hz-1"></a>
<a id="rst-dtv-bandwidth-hz"></a>

## 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`.


<table>
<thead>
<tr>
<th>


Terrestrial Standard

</th>
<th>


Possible values for bandwidth

</th>
</tr>
</thead>
<tbody>
<tr>
<td>


ATSC (version 1)

</td>
<td>


No need to set. It is always 6MHz.

</td>
</tr>
<tr>
<td>


DMTB

</td>
<td>


No need to set. It is always 8MHz.

</td>
</tr>
<tr>
<td>


DVB-T

</td>
<td>


6MHz, 7MHz and 8MHz.

</td>
</tr>
<tr>
<td>


DVB-T2

</td>
<td>


1.172 MHz, 5MHz, 6MHz, 7MHz, 8MHz and 10MHz

</td>
</tr>
<tr>
<td>


ISDB-T

</td>
<td>


5MHz, 6MHz, 7MHz and 8MHz, although most places use 6MHz.

</td>
</tr>
</tbody>
</table>

> [!NOTE]
>
> 1. For ISDB-Tsb, the bandwidth can vary depending on the number of connected segments.
>
>    It can be easily derived from other parameters (DTV_ISDBT_SB_SEGMENT_IDX, DTV_ISDBT_SB_SEGMENT_COUNT).
>
> 2. On Satellite and Cable delivery systems, the bandwidth depends on the symbol rate. The kernel will silently ignore any [DTV_BANDWIDTH_HZ](<#rst-dtv-bandwidth-hz>) setting and overwrites it with bandwidth estimation.
>
>    Such bandwidth estimation takes into account the symbol rate set with [DTV_SYMBOL_RATE](<#rst-dtv-symbol-rate>), and the rolloff factor, with is fixed for DVB-C and DVB-S.
>
>    For DVB-S2, the rolloff should also be set via [DTV_ROLLOFF](<#rst-dtv-rolloff>).

<a id="rst-dtv-inversion-1"></a>
<a id="rst-dtv-inversion"></a>

## DTV_INVERSION

Specifies if the frontend should do spectral inversion or not.

The acceptable values are defined by `fe_spectral_inversion`.

<a id="rst-dtv-diseqc-master-1"></a>
<a id="rst-dtv-diseqc-master"></a>

## DTV_DISEQC_MASTER

Currently not implemented.

<a id="rst-dtv-symbol-rate-1"></a>
<a id="rst-dtv-symbol-rate"></a>

## DTV_SYMBOL_RATE

Used on cable and satellite delivery systems.

Digital TV symbol rate, in bauds (symbols/second).

<a id="rst-dtv-inner-fec-1"></a>
<a id="rst-dtv-inner-fec"></a>

## DTV_INNER_FEC

Used on cable and satellite delivery systems.

The acceptable values are defined by `fe_code_rate`.

<a id="rst-dtv-voltage-1"></a>
<a id="rst-dtv-voltage"></a>

## 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`.

<a id="rst-dtv-tone-1"></a>
<a id="rst-dtv-tone"></a>

## DTV_TONE

Currently not used.

<a id="rst-dtv-pilot-1"></a>
<a id="rst-dtv-pilot"></a>

## DTV_PILOT

Used on DVB-S2.

Sets DVB-S2 pilot.

The acceptable values are defined by `fe_pilot`.

<a id="rst-dtv-rolloff-1"></a>
<a id="rst-dtv-rolloff"></a>

## DTV_ROLLOFF

Used on DVB-S2.

Sets DVB-S2 rolloff.

The acceptable values are defined by `fe_rolloff`.

<a id="rst-dtv-diseqc-slave-reply-1"></a>
<a id="rst-dtv-diseqc-slave-reply"></a>

## DTV_DISEQC_SLAVE_REPLY

Currently not implemented.

<a id="rst-dtv-fe-capability-count-1"></a>
<a id="rst-dtv-fe-capability-count"></a>

## DTV_FE_CAPABILITY_COUNT

Currently not implemented.

<a id="rst-dtv-fe-capability-1"></a>
<a id="rst-dtv-fe-capability"></a>

## DTV_FE_CAPABILITY

Currently not implemented.

<a id="rst-dtv-delivery-system-1"></a>
<a id="rst-dtv-delivery-system"></a>

## DTV_DELIVERY_SYSTEM

Specifies the type of the delivery system.

The acceptable values are defined by `fe_delivery_system`.

<a id="rst-dtv-isdbt-partial-reception-1"></a>
<a id="rst-dtv-isdbt-partial-reception"></a>

## 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)

<a id="rst-dtv-isdbt-sound-broadcasting-1"></a>
<a id="rst-dtv-isdbt-sound-broadcasting"></a>

## 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)

<a id="rst-dtv-isdbt-sb-subchannel-id-1"></a>
<a id="rst-dtv-isdbt-sb-subchannel-id"></a>

## 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)

<a id="rst-dtv-isdbt-sb-segment-idx-1"></a>
<a id="rst-dtv-isdbt-sb-segment-idx"></a>

## 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.

<a id="rst-dtv-isdbt-sb-segment-count-1"></a>
<a id="rst-dtv-isdbt-sb-segment-count"></a>

## 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.

<a id="rst-dtv-isdbt-layer-a-c-parameters"></a>
<a id="rst-isdb-hierq-layers"></a>

## 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.

<a id="rst-dtv-isdbt-layer-enabled-1"></a>
<a id="rst-dtv-isdbt-layer-enabled"></a>

### 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

<a id="rst-dtv-isdbt-layer-a-c-fec"></a>
<a id="rst-dtv-isdbt-layer-fec"></a>

### 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`

<a id="rst-dtv-isdbt-layer-a-c-modulation"></a>
<a id="rst-dtv-isdbt-layer-modulation"></a>

### 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`

> [!NOTE]
>
> 1. If layer C is `DQPSK`, then layer B has to be `DQPSK`.
>
> 2. If layer B is `DQPSK` and `DTV_ISDBT_PARTIAL_RECEPTION`= 0, then layer has to be `DQPSK`.

<a id="rst-dtv-isdbt-layer-a-c-segment-count"></a>
<a id="rst-dtv-isdbt-layer-segment-count"></a>

### 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`

<a id="rst-isdbt-layer-seg-cnt-table"></a>


<table>
<caption>Truth table for ISDB-T Sound Broadcasting</caption>
<thead>
<tr>
<th>


Partial Reception

</th>
<th>


Sound Broadcasting

</th>
<th>


Layer A width

</th>
<th>


Layer B width

</th>
<th>


Layer C width

</th>
<th>


total width

</th>
</tr>
</thead>
<tbody>
<tr>
<td>


0

</td>
<td>


0

</td>
<td>


1 .. 13

</td>
<td>


1 .. 13

</td>
<td>


1 .. 13

</td>
<td>


13

</td>
</tr>
<tr>
<td>


1

</td>
<td>


0

</td>
<td>


1

</td>
<td>


1 .. 13

</td>
<td>


1 .. 13

</td>
<td>


13

</td>
</tr>
<tr>
<td>


0

</td>
<td>


1

</td>
<td>


1

</td>
<td>


0

</td>
<td>


0

</td>
<td>


1

</td>
</tr>
<tr>
<td>


1

</td>
<td>


1

</td>
<td>


1

</td>
<td>


2

</td>
<td>


0

</td>
<td>


13

</td>
</tr>
</tbody>
</table>

<a id="rst-dtv-isdbt-layer-a-c-time-interleaving"></a>
<a id="rst-dtv-isdbt-layer-time-interleaving"></a>

### 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.





<a id="c-isdbt_layer_interleaving_table"></a>

```c
isdbt_layer_interleaving_table
```


<table>
<caption>ISDB-T time interleaving modes</caption>
<thead>
<tr>
<th>


`DTV_ISDBT_LAYER[A-C]_TIME_INTERLEAVING`

</th>
<th>


Mode 1 (2K FFT)

</th>
<th>


Mode 2 (4K FFT)

</th>
<th>


Mode 3 (8K FFT)

</th>
</tr>
</thead>
<tbody>
<tr>
<td>


0

</td>
<td>


0

</td>
<td>


0

</td>
<td>


0

</td>
</tr>
<tr>
<td>


1

</td>
<td>


4

</td>
<td>


2

</td>
<td>


1

</td>
</tr>
<tr>
<td>


2

</td>
<td>


8

</td>
<td>


4

</td>
<td>


2

</td>
</tr>
<tr>
<td>


4

</td>
<td>


16

</td>
<td>


8

</td>
<td>


4

</td>
</tr>
</tbody>
</table>

<a id="rst-dtv-atscmh-fic-ver-1"></a>
<a id="rst-dtv-atscmh-fic-ver"></a>

### 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

<a id="rst-dtv-atscmh-parade-id-1"></a>
<a id="rst-dtv-atscmh-parade-id"></a>

### 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

<a id="rst-dtv-atscmh-nog-1"></a>
<a id="rst-dtv-atscmh-nog"></a>

### 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

<a id="rst-dtv-atscmh-tnog-1"></a>
<a id="rst-dtv-atscmh-tnog"></a>

### 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

<a id="rst-dtv-atscmh-sgn-1"></a>
<a id="rst-dtv-atscmh-sgn"></a>

### DTV_ATSCMH_SGN

Used only on ATSC-MH.

Start group number.

Possible values: 0, 1, 2, 3, ..., 14, 15

<a id="rst-dtv-atscmh-prc-1"></a>
<a id="rst-dtv-atscmh-prc"></a>

### DTV_ATSCMH_PRC

Used only on ATSC-MH.

Parade repetition cycle.

Possible values: 1, 2, 3, 4, 5, 6, 7, 8

<a id="rst-dtv-atscmh-rs-frame-mode-1"></a>
<a id="rst-dtv-atscmh-rs-frame-mode"></a>

### 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`.

<a id="rst-dtv-atscmh-rs-frame-ensemble-1"></a>
<a id="rst-dtv-atscmh-rs-frame-ensemble"></a>

### 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`.

<a id="rst-dtv-atscmh-rs-code-mode-pri-1"></a>
<a id="rst-dtv-atscmh-rs-code-mode-pri"></a>

### 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`.

<a id="rst-dtv-atscmh-rs-code-mode-sec-1"></a>
<a id="rst-dtv-atscmh-rs-code-mode-sec"></a>

### 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`.

<a id="rst-dtv-atscmh-sccc-block-mode-1"></a>
<a id="rst-dtv-atscmh-sccc-block-mode"></a>

### 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`.

<a id="rst-dtv-atscmh-sccc-code-mode-a-1"></a>
<a id="rst-dtv-atscmh-sccc-code-mode-a"></a>

### 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`.

<a id="rst-dtv-atscmh-sccc-code-mode-b-1"></a>
<a id="rst-dtv-atscmh-sccc-code-mode-b"></a>

### 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`.

<a id="rst-dtv-atscmh-sccc-code-mode-c-1"></a>
<a id="rst-dtv-atscmh-sccc-code-mode-c"></a>

### 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`.

<a id="rst-dtv-atscmh-sccc-code-mode-d-1"></a>
<a id="rst-dtv-atscmh-sccc-code-mode-d"></a>

### 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`.

<a id="rst-dtv-api-version-1"></a>
<a id="rst-dtv-api-version"></a>

## DTV_API_VERSION

Returns the major/minor version of the Digital TV API

<a id="rst-dtv-code-rate-hp-1"></a>
<a id="rst-dtv-code-rate-hp"></a>

## DTV_CODE_RATE_HP

Used on terrestrial transmissions.

The acceptable values are defined by `fe_transmit_mode`.

<a id="rst-dtv-code-rate-lp-1"></a>
<a id="rst-dtv-code-rate-lp"></a>

## DTV_CODE_RATE_LP

Used on terrestrial transmissions.

The acceptable values are defined by `fe_transmit_mode`.

<a id="rst-dtv-guard-interval-1"></a>
<a id="rst-dtv-guard-interval"></a>

## DTV_GUARD_INTERVAL

The acceptable values are defined by `fe_guard_interval`.

> [!NOTE]
>
> 1. If `DTV_GUARD_INTERVAL` is set the `GUARD_INTERVAL_AUTO` the hardware will try to find the correct guard interval (if capable) and will use TMCC to fill in the missing parameters.
>
> 2. Interval `GUARD_INTERVAL_1_64` is used only for DVB-C2.
>
> 3. Interval `GUARD_INTERVAL_1_128` is used for both DVB-C2 and DVB_T2.
>
> 4. Intervals `GUARD_INTERVAL_19_128` and `GUARD_INTERVAL_19_256` are used only for DVB-T2.
>
> 5. Intervals `GUARD_INTERVAL_PN420`, `GUARD_INTERVAL_PN595` and `GUARD_INTERVAL_PN945` are used only for DMTB at the present. On such standard, only those intervals and `GUARD_INTERVAL_AUTO` are valid.

<a id="rst-dtv-transmission-mode-1"></a>
<a id="rst-dtv-transmission-mode"></a>

## 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`.

> [!NOTE]
>
> 1. ISDB-T supports three carrier/symbol-size: 8K, 4K, 2K. It is called **mode** on such standard, and are numbered from 1 to 3:
>
>
>    <table>
>    <thead>
>    <tr>
>    <th>
>
>
>    Mode
>
>    </th>
>    <th>
>
>
>    FFT size
>
>    </th>
>    <th>
>
>
>    Transmission mode
>
>    </th>
>    </tr>
>    </thead>
>    <tbody>
>    <tr>
>    <td>
>
>
>    1
>
>    </td>
>    <td>
>
>
>    2K
>
>    </td>
>    <td>
>
>
>    `TRANSMISSION_MODE_2K`
>
>    </td>
>    </tr>
>    <tr>
>    <td>
>
>
>    2
>
>    </td>
>    <td>
>
>
>    4K
>
>    </td>
>    <td>
>
>
>    `TRANSMISSION_MODE_4K`
>
>    </td>
>    </tr>
>    <tr>
>    <td>
>
>
>    3
>
>    </td>
>    <td>
>
>
>    8K
>
>    </td>
>    <td>
>
>
>    `TRANSMISSION_MODE_8K`
>
>    </td>
>    </tr>
>    </tbody>
>    </table>
>
> 2. If `DTV_TRANSMISSION_MODE` is set the `TRANSMISSION_MODE_AUTO` the hardware will try to find the correct FFT-size (if capable) and will use TMCC to fill in the missing parameters.
>
> 3. DVB-T specifies 2K and 8K as valid sizes.
>
> 4. DVB-T2 specifies 1K, 2K, 4K, 8K, 16K and 32K.
>
> 5. DTMB specifies C1 and C3780.

<a id="rst-dtv-hierarchy-1"></a>
<a id="rst-dtv-hierarchy"></a>

## DTV_HIERARCHY

Used only on DVB-T and DVB-T2.

Frontend hierarchy.

The acceptable values are defined by `fe_hierarchy`.

<a id="rst-dtv-stream-id-1"></a>
<a id="rst-dtv-stream-id"></a>

## 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.

<a id="rst-dtv-dvbt2-plp-id-legacy-1"></a>
<a id="rst-dtv-dvbt2-plp-id-legacy"></a>

## DTV_DVBT2_PLP_ID_LEGACY

Obsolete, replaced with DTV_STREAM_ID.

<a id="rst-dtv-enum-delsys-1"></a>
<a id="rst-dtv-enum-delsys"></a>

## 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`.

<a id="rst-dtv-interleaving-1"></a>
<a id="rst-dtv-interleaving"></a>

## DTV_INTERLEAVING

Time interleaving to be used.

The acceptable values are defined by `fe_interleaving`.

<a id="rst-dtv-lna-1"></a>
<a id="rst-dtv-lna"></a>

## 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

<a id="rst-dtv-scrambling-sequence-index-1"></a>
<a id="rst-dtv-scrambling-sequence-index"></a>

## 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)_

> Reference for Frontend uAPI data types.

<a id="rst-frontend-uapi-data-types"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->


#### <a id="c-enum-fe_caps"></a>`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 inversion
- `FE_CAN_FEC_1_2`: Supports FEC 1/2
- `FE_CAN_FEC_2_3`: Supports FEC 2/3
- `FE_CAN_FEC_3_4`: Supports FEC 3/4
- `FE_CAN_FEC_4_5`: Supports FEC 4/5
- `FE_CAN_FEC_5_6`: Supports FEC 5/6
- `FE_CAN_FEC_6_7`: Supports FEC 6/7
- `FE_CAN_FEC_7_8`: Supports FEC 7/8
- `FE_CAN_FEC_8_9`: Supports FEC 8/9
- `FE_CAN_FEC_AUTO`: Can auto-detect FEC
- `FE_CAN_QPSK`: Supports QPSK modulation
- `FE_CAN_QAM_16`: Supports 16-QAM modulation
- `FE_CAN_QAM_32`: Supports 32-QAM modulation
- `FE_CAN_QAM_64`: Supports 64-QAM modulation
- `FE_CAN_QAM_128`: Supports 128-QAM modulation
- `FE_CAN_QAM_256`: Supports 256-QAM modulation
- `FE_CAN_QAM_AUTO`: Can auto-detect QAM modulation
- `FE_CAN_TRANSMISSION_MODE_AUTO`: Can auto-detect transmission mode
- `FE_CAN_BANDWIDTH_AUTO`: Can auto-detect bandwidth
- `FE_CAN_GUARD_INTERVAL_AUTO`: Can auto-detect guard interval
- `FE_CAN_HIERARCHY_AUTO`: Can auto-detect hierarchy
- `FE_CAN_8VSB`: Supports 8-VSB modulation
- `FE_CAN_16VSB`: Supporta 16-VSB modulation
- `FE_HAS_EXTENDED_CAPS`: Unused
- `FE_CAN_MULTISTREAM`: Supports multistream filtering
- `FE_CAN_TURBO_FEC`: Supports "turbo FEC" modulation
- `FE_CAN_2G_MODULATION`: Supports "2nd generation" modulation,
  e. g. DVB-S2, DVB-T2, DVB-C2
- `FE_NEEDS_BENDING`: Unused
- `FE_CAN_RECOVER`: Can recover from a cable unplug
  automatically
- `FE_CAN_MUTE_TS`: Can stop spurious TS data output

#### <a id="c-struct-dvb_frontend_info"></a>`struct dvb_frontend_info`

Frontend properties and capabilities

**Definition**

```c
struct dvb_frontend_info {
    char name[128];
    enum fe_type type;
    __u32 frequency_min;
    __u32 frequency_max;
    __u32 frequency_stepsize;
    __u32 frequency_tolerance;
    __u32 symbol_rate_min;
    __u32 symbol_rate_max;
    __u32 symbol_rate_tolerance;
    __u32 notifier_delay;
    enum fe_caps caps;
};
```

**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_DELSYS`
  instead.
- `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 in [`enum fe_caps`](#c-enum-fe_caps).

**Description**

#### <a id="c-struct-dvb_diseqc_master_cmd"></a>`struct dvb_diseqc_master_cmd`

DiSEqC master command

**Definition**

```c
struct dvb_diseqc_master_cmd {
    __u8 msg[6];
    __u8 msg_len;
};
```

**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.

#### <a id="c-struct-dvb_diseqc_slave_reply"></a>`struct dvb_diseqc_slave_reply`

DiSEqC received data

**Definition**

```c
struct dvb_diseqc_slave_reply {
    __u8 msg[4];
    __u8 msg_len;
    int timeout;
};
```

**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.

#### <a id="c-enum-fe_sec_voltage"></a>`enum fe_sec_voltage`

DC Voltage used to feed the LNBf

**Constants**

- `SEC_VOLTAGE_13`: Output 13V to the LNBf
- `SEC_VOLTAGE_18`: Output 18V to the LNBf
- `SEC_VOLTAGE_OFF`: Don't feed the LNBf with a DC voltage

#### <a id="c-enum-fe_sec_tone_mode"></a>`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 the `FE_DISEQC_*` ioctls are called).

#### <a id="c-enum-fe_sec_mini_cmd"></a>`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-A
- `SEC_MINI_B`: Sends a mini-DiSEqC 22kHz '1' Data Burst to select
  satellite-B

#### <a id="c-enum-fe_status"></a>`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 status
- `FE_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.

#### <a id="c-enum-fe_spectral_inversion"></a>`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.

#### <a id="c-enum-fe_code_rate"></a>`enum fe_code_rate`

Type of Forward Error Correction (FEC)

**Constants**

- `FEC_NONE`: No Forward Error Correction Code
- `FEC_1_2`: Forward Error Correction Code 1/2
- `FEC_2_3`: Forward Error Correction Code 2/3
- `FEC_3_4`: Forward Error Correction Code 3/4
- `FEC_4_5`: Forward Error Correction Code 4/5
- `FEC_5_6`: Forward Error Correction Code 5/6
- `FEC_6_7`: Forward Error Correction Code 6/7
- `FEC_7_8`: Forward Error Correction Code 7/8
- `FEC_8_9`: Forward Error Correction Code 8/9
- `FEC_AUTO`: Autodetect Error Correction Code
- `FEC_3_5`: Forward Error Correction Code 3/5
- `FEC_9_10`: Forward Error Correction Code 9/10
- `FEC_2_5`: Forward Error Correction Code 2/5
- `FEC_1_3`: Forward Error Correction Code 1/3
- `FEC_1_4`: Forward Error Correction Code 1/4
- `FEC_5_9`: Forward Error Correction Code 5/9
- `FEC_7_9`: Forward Error Correction Code 7/9
- `FEC_8_15`: Forward Error Correction Code 8/15
- `FEC_11_15`: Forward Error Correction Code 11/15
- `FEC_13_18`: Forward Error Correction Code 13/18
- `FEC_9_20`: Forward Error Correction Code 9/20
- `FEC_11_20`: Forward Error Correction Code 11/20
- `FEC_23_36`: Forward Error Correction Code 23/36
- `FEC_25_36`: Forward Error Correction Code 25/36
- `FEC_13_45`: Forward Error Correction Code 13/45
- `FEC_26_45`: Forward Error Correction Code 26/45
- `FEC_28_45`: Forward Error Correction Code 28/45
- `FEC_32_45`: Forward Error Correction Code 32/45
- `FEC_77_90`: Forward Error Correction Code 77/90
- `FEC_11_45`: Forward Error Correction Code 11/45
- `FEC_4_15`: Forward Error Correction Code 4/15
- `FEC_14_45`: Forward Error Correction Code 14/45
- `FEC_7_15`: Forward Error Correction Code 7/15

**Description**

Please note that not all FEC types are supported by a given standard.

#### <a id="c-enum-fe_modulation"></a>`enum fe_modulation`

Type of modulation/constellation

**Constants**

- `QPSK`: QPSK modulation
- `QAM_16`: 16-QAM modulation
- `QAM_32`: 32-QAM modulation
- `QAM_64`: 64-QAM modulation
- `QAM_128`: 128-QAM modulation
- `QAM_256`: 256-QAM modulation
- `QAM_AUTO`: Autodetect QAM modulation
- `VSB_8`: 8-VSB modulation
- `VSB_16`: 16-VSB modulation
- `PSK_8`: 8-PSK modulation
- `APSK_16`: 16-APSK modulation
- `APSK_32`: 32-APSK modulation
- `DQPSK`: DQPSK modulation
- `QAM_4_NR`: 4-QAM-NR modulation
- `QAM_1024`: 1024-QAM modulation
- `QAM_4096`: 4096-QAM modulation
- `APSK_8_L`: 8APSK-L modulation
- `APSK_16_L`: 16APSK-L modulation
- `APSK_32_L`: 32APSK-L modulation
- `APSK_64`: 64APSK modulation
- `APSK_64_L`: 64APSK-L modulation

**Description**

Please note that not all modulations are supported by a given standard.

#### <a id="c-enum-fe_transmit_mode"></a>`enum fe_transmit_mode`

Transmission mode

**Constants**

- `TRANSMISSION_MODE_2K`: Transmission mode 2K
- `TRANSMISSION_MODE_8K`: Transmission mode 8K
- `TRANSMISSION_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 4K
- `TRANSMISSION_MODE_1K`: Transmission mode 1K
- `TRANSMISSION_MODE_16K`: Transmission mode 16K
- `TRANSMISSION_MODE_32K`: Transmission mode 32K
- `TRANSMISSION_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.

#### <a id="c-enum-fe_guard_interval"></a>`enum fe_guard_interval`

Guard interval

**Constants**

- `GUARD_INTERVAL_1_32`: Guard interval 1/32
- `GUARD_INTERVAL_1_16`: Guard interval 1/16
- `GUARD_INTERVAL_1_8`: Guard interval 1/8
- `GUARD_INTERVAL_1_4`: Guard interval 1/4
- `GUARD_INTERVAL_AUTO`: Autodetect the guard interval
- `GUARD_INTERVAL_1_128`: Guard interval 1/128
- `GUARD_INTERVAL_19_128`: Guard interval 19/128
- `GUARD_INTERVAL_19_256`: Guard interval 19/256
- `GUARD_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.

#### <a id="c-enum-fe_hierarchy"></a>`enum fe_hierarchy`

Hierarchy

**Constants**

- `HIERARCHY_NONE`: No hierarchy
- `HIERARCHY_1`: Hierarchy 1
- `HIERARCHY_2`: Hierarchy 2
- `HIERARCHY_4`: Hierarchy 4
- `HIERARCHY_AUTO`: Autodetect hierarchy (if supported)

**Description**

Please note that not all hierarchy types are supported by a given standard.

#### <a id="c-enum-fe_interleaving"></a>`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.

#### <a id="c-enum-fe_pilot"></a>`enum fe_pilot`

Type of pilot tone

**Constants**

- `PILOT_ON`: Pilot tones enabled
- `PILOT_OFF`: Pilot tones disabled
- `PILOT_AUTO`: Autodetect pilot tones

#### <a id="c-enum-fe_rolloff"></a>`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**

#### <a id="c-enum-fe_delivery_system"></a>`enum fe_delivery_system`

Type of the delivery system

**Constants**

- `SYS_UNDEFINED`: Undefined standard. Generally, indicates an error
- `SYS_DVBC_ANNEX_A`: Cable TV: DVB-C following ITU-T J.83 Annex A spec
- `SYS_DVBC_ANNEX_B`: Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM)
- `SYS_DVBT`: Terrestrial TV: DVB-T
- `SYS_DSS`: Satellite TV: DSS (not fully supported)
- `SYS_DVBS`: Satellite TV: DVB-S
- `SYS_DVBS2`: Satellite TV: DVB-S2 and DVB-S2X
- `SYS_DVBH`: Terrestrial TV (mobile): DVB-H (standard deprecated)
- `SYS_ISDBT`: Terrestrial TV: ISDB-T
- `SYS_ISDBS`: Satellite TV: ISDB-S
- `SYS_ISDBC`: Cable TV: ISDB-C (no drivers yet)
- `SYS_ATSC`: Terrestrial TV: ATSC
- `SYS_ATSCMH`: Terrestrial TV (mobile): ATSC-M/H
- `SYS_DTMB`: Terrestrial TV: DTMB
- `SYS_CMMB`: Terrestrial TV (mobile): CMMB (not fully supported)
- `SYS_DAB`: Digital audio: DAB (not fully supported)
- `SYS_DVBT2`: Terrestrial TV: DVB-T2
- `SYS_TURBO`: Satellite TV: DVB-S Turbo
- `SYS_DVBC_ANNEX_C`: Cable TV: DVB-C following ITU-T J.83 Annex C spec
- `SYS_DVBC2`: Cable TV: DVB-C2

#### <a id="c-enum-atscmh_sccc_block_mode"></a>`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.

#### <a id="c-enum-atscmh_sccc_code_mode"></a>`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.

#### <a id="c-enum-atscmh_rs_frame_ensemble"></a>`enum atscmh_rs_frame_ensemble`

Reed Solomon(RS) frame ensemble.

**Constants**

- `ATSCMH_RSFRAME_ENS_PRI`: Primary Ensemble.
- `ATSCMH_RSFRAME_ENS_SEC`: Secondary Ensemble.

#### <a id="c-enum-atscmh_rs_frame_mode"></a>`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.

#### <a id="c-enum-atscmh_rs_code_mode"></a>`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.

#### <a id="c-enum-fecap_scale_params"></a>`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.

#### <a id="c-struct-dtv_stats"></a>`struct dtv_stats`

Used for reading a DTV status property

**Definition**

```c
struct dtv_stats {
    __u8 scale;
    union {
        __u64 uvalue;
        __s64 svalue;
    };
};
```

**Members**

- `scale`: Filled with enum fecap_scale_params - the scale in usage
  for that parameter
- `{unnamed_union}`: anonymous
- `uvalue`: unsigned integer value of the measure, used when **scale** is
  either `FE_SCALE_RELATIVE` or `FE_SCALE_COUNTER`.
- `svalue`: integer value of the measure, for `FE_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:

```text
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;
```

#### <a id="c-struct-dtv_fe_stats"></a>`struct dtv_fe_stats`

store Digital TV frontend statistics

**Definition**

```c
struct dtv_fe_stats {
    __u8 len;
    struct dtv_stats stat[MAX_DTV_STATS];
};
```

**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.

#### <a id="c-struct-dtv_property"></a>`struct dtv_property`

store one of frontend command and its value

**Definition**

```c
struct dtv_property {
    __u32 cmd;
    __u32 reserved[3];
    union {
        __u32 data;
        struct dtv_fe_stats st;
        struct {
            __u8 data[32];
            __u32 len;
            __u32 reserved1[3];
            void *reserved2;
        } buffer;
    } u;
    int result;
};
```

**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`: a [`struct dtv_fe_stats`](#c-struct-dtv_fe_stats) array 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.

#### <a id="c-struct-dtv_properties"></a>`struct dtv_properties`

a set of command/value pairs.

**Definition**

```c
struct dtv_properties {
    __u32 num;
    struct dtv_property *props;
};
```

**Members**

- `num`: amount of commands stored at the struct.
- `props`: a pointer to [`struct dtv_property`](#c-struct-dtv_property).

---

# Properties used on cable delivery systems

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> The DVB-C Annex-A is the widely used cable standard. Transmission uses QAM modulation.

<a id="rst-properties-used-on-cable-delivery-systems"></a>
<a id="rst-frontend-property-cable-systems"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<a id="rst-dvb-c-delivery-system"></a>
<a id="rst-dvbc-params"></a>

## 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:

- [DTV_API_VERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-api-version>)

- [DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system>)

- [DTV_TUNE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tune>)

- [DTV_CLEAR](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-clear>)

- [DTV_FREQUENCY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-frequency>)

- [DTV_MODULATION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-modulation>)

- [DTV_INVERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inversion>)

- [DTV_SYMBOL_RATE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-symbol-rate>)

- [DTV_INNER_FEC](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inner-fec>)

- [DTV_LNA](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-lna>)

In addition, the [DTV QoS statistics](</kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-frontend-stat-properties>) are also valid.

<a id="rst-dvb-c-annex-b-delivery-system"></a>
<a id="rst-dvbc-annex-b-params"></a>

## 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:

- [DTV_API_VERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-api-version>)

- [DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system>)

- [DTV_TUNE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tune>)

- [DTV_CLEAR](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-clear>)

- [DTV_FREQUENCY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-frequency>)

- [DTV_MODULATION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-modulation>)

- [DTV_INVERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inversion>)

- [DTV_LNA](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-lna>)

In addition, the [DTV QoS statistics](</kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-frontend-stat-properties>) are also valid.

---

# Properties used on satellite delivery systems

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> The following parameters are valid for DVB-S:

<a id="rst-properties-used-on-satellite-delivery-systems"></a>
<a id="rst-frontend-property-satellite-systems"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<a id="rst-dvb-s-delivery-system"></a>
<a id="rst-dvbs-params"></a>

## DVB-S delivery system

The following parameters are valid for DVB-S:

- [DTV_API_VERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-api-version>)

- [DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system>)

- [DTV_TUNE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tune>)

- [DTV_CLEAR](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-clear>)

- [DTV_FREQUENCY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-frequency>)

- [DTV_INVERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inversion>)

- [DTV_SYMBOL_RATE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-symbol-rate>)

- [DTV_INNER_FEC](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inner-fec>)

- [DTV_VOLTAGE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-voltage>)

- [DTV_TONE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tone>)

In addition, the [DTV QoS statistics](</kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-frontend-stat-properties>) are also valid.

Future implementations might add those two missing parameters:

- [DTV_DISEQC_MASTER](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-diseqc-master>)

- [DTV_DISEQC_SLAVE_REPLY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-diseqc-slave-reply>)

<a id="rst-dvb-s2-delivery-system"></a>
<a id="rst-dvbs2-params"></a>

## DVB-S2 delivery system

In addition to all parameters valid for DVB-S, DVB-S2 supports the following parameters:

- [DTV_MODULATION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-modulation>)

- [DTV_PILOT](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-pilot>)

- [DTV_ROLLOFF](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-rolloff>)

- [DTV_STREAM_ID](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-stream-id>)

- [DTV_SCRAMBLING_SEQUENCE_INDEX](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-scrambling-sequence-index>)

In addition, the [DTV QoS statistics](</kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-frontend-stat-properties>) are also valid.

<a id="rst-turbo-code-delivery-system"></a>
<a id="rst-turbo-params"></a>

## Turbo code delivery system

In addition to all parameters valid for DVB-S, turbo code supports the following parameters:

- [DTV_MODULATION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-modulation>)

<a id="rst-isdb-s-delivery-system"></a>
<a id="rst-isdbs-params"></a>

## ISDB-S delivery system

The following parameters are valid for ISDB-S:

- [DTV_API_VERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-api-version>)

- [DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system>)

- [DTV_TUNE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tune>)

- [DTV_CLEAR](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-clear>)

- [DTV_FREQUENCY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-frequency>)

- [DTV_INVERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inversion>)

- [DTV_SYMBOL_RATE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-symbol-rate>)

- [DTV_INNER_FEC](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inner-fec>)

- [DTV_VOLTAGE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-voltage>)

- [DTV_STREAM_ID](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-stream-id>)

---

# Properties used on terrestrial delivery systems

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> The following parameters are valid for DVB-T:

<a id="rst-properties-used-on-terrestrial-delivery-systems"></a>
<a id="rst-frontend-property-terrestrial-systems"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<a id="rst-dvb-t-delivery-system"></a>
<a id="rst-dvbt-params"></a>

## DVB-T delivery system

The following parameters are valid for DVB-T:

- [DTV_API_VERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-api-version>)

- [DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system>)

- [DTV_TUNE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tune>)

- [DTV_CLEAR](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-clear>)

- [DTV_FREQUENCY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-frequency>)

- [DTV_MODULATION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-modulation>)

- [DTV_BANDWIDTH_HZ](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-bandwidth-hz>)

- [DTV_INVERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inversion>)

- [DTV_CODE_RATE_HP](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-code-rate-hp>)

- [DTV_CODE_RATE_LP](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-code-rate-lp>)

- [DTV_GUARD_INTERVAL](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-guard-interval>)

- [DTV_TRANSMISSION_MODE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-transmission-mode>)

- [DTV_HIERARCHY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-hierarchy>)

- [DTV_LNA](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-lna>)

In addition, the [DTV QoS statistics](</kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-frontend-stat-properties>) are also valid.

<a id="rst-dvb-t2-delivery-system"></a>
<a id="rst-dvbt2-params"></a>

## 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:

- [DTV_API_VERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-api-version>)

- [DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system>)

- [DTV_TUNE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tune>)

- [DTV_CLEAR](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-clear>)

- [DTV_FREQUENCY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-frequency>)

- [DTV_MODULATION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-modulation>)

- [DTV_BANDWIDTH_HZ](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-bandwidth-hz>)

- [DTV_INVERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inversion>)

- [DTV_CODE_RATE_HP](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-code-rate-hp>)

- [DTV_CODE_RATE_LP](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-code-rate-lp>)

- [DTV_GUARD_INTERVAL](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-guard-interval>)

- [DTV_TRANSMISSION_MODE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-transmission-mode>)

- [DTV_HIERARCHY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-hierarchy>)

- [DTV_STREAM_ID](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-stream-id>)

- [DTV_LNA](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-lna>)

In addition, the [DTV QoS statistics](</kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-frontend-stat-properties>) are also valid.

<a id="rst-isdb-t-delivery-system"></a>
<a id="rst-isdbt"></a>

## 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:

- [DTV_API_VERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-api-version>)

- [DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system>)

- [DTV_TUNE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tune>)

- [DTV_CLEAR](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-clear>)

- [DTV_FREQUENCY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-frequency>)

- [DTV_BANDWIDTH_HZ](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-bandwidth-hz>)

- [DTV_INVERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inversion>)

- [DTV_GUARD_INTERVAL](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-guard-interval>)

- [DTV_TRANSMISSION_MODE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-transmission-mode>)

- [DTV_ISDBT_LAYER_ENABLED](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-enabled>)

- [DTV_ISDBT_PARTIAL_RECEPTION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-partial-reception>)

- [DTV_ISDBT_SOUND_BROADCASTING](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-sound-broadcasting>)

- [DTV_ISDBT_SB_SUBCHANNEL_ID](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-sb-subchannel-id>)

- [DTV_ISDBT_SB_SEGMENT_IDX](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-sb-segment-idx>)

- [DTV_ISDBT_SB_SEGMENT_COUNT](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-sb-segment-count>)

- [DTV_ISDBT_LAYERA_FEC](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-fec>)

- [DTV_ISDBT_LAYERA_MODULATION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-modulation>)

- [DTV_ISDBT_LAYERA_SEGMENT_COUNT](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-segment-count>)

- [DTV_ISDBT_LAYERA_TIME_INTERLEAVING](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-time-interleaving>)

- [DTV_ISDBT_LAYERB_FEC](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-fec>)

- [DTV_ISDBT_LAYERB_MODULATION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-modulation>)

- [DTV_ISDBT_LAYERB_SEGMENT_COUNT](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-segment-count>)

- [DTV_ISDBT_LAYERB_TIME_INTERLEAVING](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-time-interleaving>)

- [DTV_ISDBT_LAYERC_FEC](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-fec>)

- [DTV_ISDBT_LAYERC_MODULATION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-modulation>)

- [DTV_ISDBT_LAYERC_SEGMENT_COUNT](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-segment-count>)

- [DTV_ISDBT_LAYERC_TIME_INTERLEAVING](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-time-interleaving>)

In addition, the [DTV QoS statistics](</kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-frontend-stat-properties>) are also valid.

<a id="rst-atsc-delivery-system"></a>
<a id="rst-atsc-params"></a>

## ATSC delivery system

The following parameters are valid for ATSC:

- [DTV_API_VERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-api-version>)

- [DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system>)

- [DTV_TUNE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tune>)

- [DTV_CLEAR](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-clear>)

- [DTV_FREQUENCY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-frequency>)

- [DTV_MODULATION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-modulation>)

- [DTV_BANDWIDTH_HZ](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-bandwidth-hz>)

In addition, the [DTV QoS statistics](</kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-frontend-stat-properties>) are also valid.

<a id="rst-atsc-mh-delivery-system"></a>
<a id="rst-atscmh-params"></a>

## ATSC-MH delivery system

The following parameters are valid for ATSC-MH:

- [DTV_API_VERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-api-version>)

- [DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system>)

- [DTV_TUNE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tune>)

- [DTV_CLEAR](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-clear>)

- [DTV_FREQUENCY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-frequency>)

- [DTV_BANDWIDTH_HZ](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-bandwidth-hz>)

- [DTV_ATSCMH_FIC_VER](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-fic-ver>)

- [DTV_ATSCMH_PARADE_ID](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-parade-id>)

- [DTV_ATSCMH_NOG](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-nog>)

- [DTV_ATSCMH_TNOG](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-tnog>)

- [DTV_ATSCMH_SGN](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-sgn>)

- [DTV_ATSCMH_PRC](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-prc>)

- [DTV_ATSCMH_RS_FRAME_MODE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-rs-frame-mode>)

- [DTV_ATSCMH_RS_FRAME_ENSEMBLE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-rs-frame-ensemble>)

- [DTV_ATSCMH_RS_CODE_MODE_PRI](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-rs-code-mode-pri>)

- [DTV_ATSCMH_RS_CODE_MODE_SEC](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-rs-code-mode-sec>)

- [DTV_ATSCMH_SCCC_BLOCK_MODE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-sccc-block-mode>)

- [DTV_ATSCMH_SCCC_CODE_MODE_A](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-sccc-code-mode-a>)

- [DTV_ATSCMH_SCCC_CODE_MODE_B](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-sccc-code-mode-b>)

- [DTV_ATSCMH_SCCC_CODE_MODE_C](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-sccc-code-mode-c>)

- [DTV_ATSCMH_SCCC_CODE_MODE_D](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-sccc-code-mode-d>)

In addition, the [DTV QoS statistics](</kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-frontend-stat-properties>) are also valid.

<a id="rst-dtmb-delivery-system"></a>
<a id="rst-dtmb-params"></a>

## DTMB delivery system

The following parameters are valid for DTMB:

- [DTV_API_VERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-api-version>)

- [DTV_DELIVERY_SYSTEM](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system>)

- [DTV_TUNE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tune>)

- [DTV_CLEAR](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-clear>)

- [DTV_FREQUENCY](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-frequency>)

- [DTV_MODULATION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-modulation>)

- [DTV_BANDWIDTH_HZ](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-bandwidth-hz>)

- [DTV_INVERSION](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inversion>)

- [DTV_INNER_FEC](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inner-fec>)

- [DTV_GUARD_INTERVAL](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-guard-interval>)

- [DTV_TRANSMISSION_MODE](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-transmission-mode>)

- [DTV_INTERLEAVING](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-interleaving>)

- [DTV_LNA](</kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-lna>)

In addition, the [DTV QoS statistics](</kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-frontend-stat-properties>) 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.

<a id="rst-frontend-statistics-indicators"></a>
<a id="rst-frontend-stat-properties"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

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:

- `svalue` or `uvalue`, where `svalue` is for signed values of the measure (dB measures) and `uvalue` is 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.

<a id="rst-dtv-stat-signal-strength-1"></a>
<a id="rst-dtv-stat-signal-strength"></a>

## 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).

<a id="rst-dtv-stat-cnr-1"></a>
<a id="rst-dtv-stat-cnr"></a>

## 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).

<a id="rst-dtv-stat-pre-error-bit-count-1"></a>
<a id="rst-dtv-stat-pre-error-bit-count"></a>

## 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](<#rst-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.

<a id="rst-dtv-stat-pre-total-bit-count-1"></a>
<a id="rst-dtv-stat-pre-total-bit-count"></a>

## 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](<#rst-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](<#rst-dtv-stat-pre-error-bit-count>).

<a id="rst-dtv-stat-post-error-bit-count-1"></a>
<a id="rst-dtv-stat-post-error-bit-count"></a>

## 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](<#rst-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.

<a id="rst-dtv-stat-post-total-bit-count-1"></a>
<a id="rst-dtv-stat-post-total-bit-count"></a>

## 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](<#rst-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](<#rst-dtv-stat-post-error-bit-count>).

<a id="rst-dtv-stat-error-block-count-1"></a>
<a id="rst-dtv-stat-error-block-count"></a>

## 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.

<a id="rst-dtv-stat-total-block-count-1"></a>
<a id="rst-dtv-stat-total-block-count"></a>

## DTV-STAT_TOTAL_BLOCK_COUNT

Measures the total number of blocks received during the same period as [DTV_STAT_ERROR_BLOCK_COUNT](<#rst-dtv-stat-error-block-count>) measurement was taken.

It can be used to calculate the PER indicator, by dividing [DTV_STAT_ERROR_BLOCK_COUNT](<#rst-dtv-stat-error-block-count>) by [DTV-STAT_TOTAL_BLOCK_COUNT](<#rst-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](<#rst-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:

<a id="rst-digital-tv-frontend-api"></a>
<a id="rst-dvb-frontend"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

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) <a id="rst-footnote-reference-1"></a>[1](#rst-f1).

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.

> [!NOTE]
>
> Transmission via the internet (DVB-IP) and MMT (MPEG Media Transport) is not yet handled by this API but a future extension is possible.

<a id="rst-f1"></a>



**[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](<http://www.eutelsat.com/satellites/4_5_5.html>).

- [Querying frontend information](</kernel/userspace/userspace-api/media-dvb/query-dvb-frontend-info.md>)
- [Querying frontend status and statistics](</kernel/userspace/userspace-api/media-dvb/dvb-fe-read-status.md>)
- [dvbproperty](<https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/Documentation/userspace-api/media/dvb/dvbproperty.rst?id=9021cc14f7d98b4a1d2c932f52c5343d4d0f6b92>)
- [Frontend Function Calls](</kernel/userspace/userspace-api/media-dvb/frontend-fcalls.md>)

---

# Digital TV frontend close()

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> fe-close - Close a frontend device

<a id="rst-digital-tv-frontend-close"></a>
<a id="rst-frontend-f-close"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

fe-close - Close a frontend device

<a id="rst-synopsis"></a>

## Synopsis



```c
#include <unistd.h>
```





<a id="c-close"></a>

```c
int close( int fd )
```

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# Digital TV frontend open()

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> fe-open - Open a frontend device

<a id="rst-digital-tv-frontend-open"></a>
<a id="rst-frontend-f-open"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.fe -->

<a id="rst-name"></a>

## Name

fe-open - Open a frontend device

<a id="rst-synopsis"></a>

## Synopsis



```c
#include <fcntl.h>
```





<a id="c-open"></a>

```c
int open( const char *device_name, int flags )
```

<a id="rst-arguments"></a>

## Arguments

- **`device_name`**

  Device to be opened.

- **`flags`**

  Open flags. Access can either be `O_RDWR` or `O_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_NONBLOCK` flag is given, the system calls may return `EAGAIN` error code when no data is available or when the device driver is temporarily busy.

  Other flags have no effect.

<a id="rst-description"></a>

## 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](</kernel/userspace/userspace-api/media-dvb/fe-get-info.md#rst-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.

<a id="rst-return-value"></a>

## 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.

<!-- tabularcolumns: |p{2.5cm}|p{15.0cm}| -->


<table>
<tbody>
<tr>
<td>


`EPERM`

</td>
<td>


The caller has no permission to access the device.

</td>
</tr>
<tr>
<td>


`EBUSY`

</td>
<td>


The device driver is already in use.

</td>
</tr>
<tr>
<td>


`EMFILE`

</td>
<td>


The process already has the maximum number of files open.

</td>
</tr>
<tr>
<td>


`ENFILE`

</td>
<td>


The limit on the total number of files open on the system has been reached.

</td>
</tr>
</tbody>
</table>

The generic error codes are described at the [Generic Error Codes](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# Frontend Function Calls

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Reference for Frontend Function Calls.

<a id="rst-frontend-function-calls"></a>
<a id="rst-frontend-fcalls"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

- [Digital TV frontend open()](</kernel/userspace/userspace-api/media-dvb/frontend-f-open.md>)
- [Digital TV frontend close()](</kernel/userspace/userspace-api/media-dvb/frontend-f-close.md>)
- [ioctl FE_GET_INFO](</kernel/userspace/userspace-api/media-dvb/fe-get-info.md>)
- [ioctl FE_READ_STATUS](</kernel/userspace/userspace-api/media-dvb/fe-read-status.md>)
- [ioctl FE_SET_PROPERTY, FE_GET_PROPERTY](</kernel/userspace/userspace-api/media-dvb/fe-get-property.md>)
- [ioctl FE_DISEQC_RESET_OVERLOAD](</kernel/userspace/userspace-api/media-dvb/fe-diseqc-reset-overload.md>)
- [ioctl FE_DISEQC_SEND_MASTER_CMD](</kernel/userspace/userspace-api/media-dvb/fe-diseqc-send-master-cmd.md>)
- [ioctl FE_DISEQC_RECV_SLAVE_REPLY](</kernel/userspace/userspace-api/media-dvb/fe-diseqc-recv-slave-reply.md>)
- [ioctl FE_DISEQC_SEND_BURST](</kernel/userspace/userspace-api/media-dvb/fe-diseqc-send-burst.md>)
- [ioctl FE_SET_TONE](</kernel/userspace/userspace-api/media-dvb/fe-set-tone.md>)
- [ioctl FE_SET_VOLTAGE](</kernel/userspace/userspace-api/media-dvb/fe-set-voltage.md>)
- [ioctl FE_ENABLE_HIGH_LNB_VOLTAGE](</kernel/userspace/userspace-api/media-dvb/fe-enable-high-lnb-voltage.md>)
- [ioctl FE_SET_FRONTEND_TUNE_MODE](</kernel/userspace/userspace-api/media-dvb/fe-set-frontend-tune-mode.md>)

---

# Frontend Legacy Data Types

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> 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

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<a id="rst-frontend-legacy-data-types"></a>
<a id="rst-frontend-legacy-types"></a>

## Frontend Legacy Data Types

- [Frontend type](</kernel/userspace/userspace-api/media-dvb/fe-type-t.md>)
- [Frontend bandwidth](</kernel/userspace/userspace-api/media-dvb/fe-bandwidth-t.md>)
- [frontend parameters](</kernel/userspace/userspace-api/media-dvb/dvb-frontend-parameters.md>)
- [frontend events](</kernel/userspace/userspace-api/media-dvb/dvb-frontend-event.md>)

<a id="rst-frontend-legacy-function-calls"></a>
<a id="rst-frontend-legacy-fcalls"></a>

## 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

- [FE_READ_BER](</kernel/userspace/userspace-api/media-dvb/fe-read-ber.md>)
- [FE_READ_SNR](</kernel/userspace/userspace-api/media-dvb/fe-read-snr.md>)
- [FE_READ_SIGNAL_STRENGTH](</kernel/userspace/userspace-api/media-dvb/fe-read-signal-strength.md>)
- [FE_READ_UNCORRECTED_BLOCKS](</kernel/userspace/userspace-api/media-dvb/fe-read-uncorrected-blocks.md>)
- [FE_SET_FRONTEND](</kernel/userspace/userspace-api/media-dvb/fe-set-frontend.md>)
- [FE_GET_FRONTEND](</kernel/userspace/userspace-api/media-dvb/fe-get-frontend.md>)
- [FE_GET_EVENT](</kernel/userspace/userspace-api/media-dvb/fe-get-event.md>)
- [FE_DISHNETWORK_SEND_LEGACY_CMD](</kernel/userspace/userspace-api/media-dvb/fe-dishnetwork-send-legacy-cmd.md>)

---

# 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.

<a id="rst-digital-tv-frontend-legacy-api-a-k-a-dvbv3"></a>
<a id="rst-frontend-legacy-dvbv3-api"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

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.

- [Frontend Legacy Data Types](</kernel/userspace/userspace-api/media-dvb/frontend-legacy-api.md>)

---

# Digital TV uAPI symbols

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Frontend

<a id="rst-digital-tv-uapi-symbols"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<a id="rst-table-of-contents"></a>



<a id="rst-frontend"></a>

## Frontend


## Enumeration values

- [`BANDWIDTH_10_MHZ`](/kernel/userspace/userspace-api/media-dvb/fe-bandwidth-t.md#rst-bandwidth-10-mhz): `include/uapi/linux/dvb/frontend.h`, line 987
- [`BANDWIDTH_1_712_MHZ`](/kernel/userspace/userspace-api/media-dvb/fe-bandwidth-t.md#rst-bandwidth-1-712-mhz): `include/uapi/linux/dvb/frontend.h`, line 988
- [`BANDWIDTH_5_MHZ`](/kernel/userspace/userspace-api/media-dvb/fe-bandwidth-t.md#rst-bandwidth-5-mhz): `include/uapi/linux/dvb/frontend.h`, line 986
- [`BANDWIDTH_6_MHZ`](/kernel/userspace/userspace-api/media-dvb/fe-bandwidth-t.md#rst-bandwidth-6-mhz): `include/uapi/linux/dvb/frontend.h`, line 984
- [`BANDWIDTH_7_MHZ`](/kernel/userspace/userspace-api/media-dvb/fe-bandwidth-t.md#rst-bandwidth-7-mhz): `include/uapi/linux/dvb/frontend.h`, line 983
- [`BANDWIDTH_8_MHZ`](/kernel/userspace/userspace-api/media-dvb/fe-bandwidth-t.md#rst-bandwidth-8-mhz): `include/uapi/linux/dvb/frontend.h`, line 982
- [`BANDWIDTH_AUTO`](/kernel/userspace/userspace-api/media-dvb/fe-bandwidth-t.md#rst-bandwidth-auto): `include/uapi/linux/dvb/frontend.h`, line 985
- [`FE_ATSC`](/kernel/userspace/userspace-api/media-dvb/fe-type-t.md#rst-fe-atsc): `include/uapi/linux/dvb/frontend.h`, line 98
- [`FE_OFDM`](/kernel/userspace/userspace-api/media-dvb/fe-type-t.md#rst-fe-ofdm): `include/uapi/linux/dvb/frontend.h`, line 97
- [`FE_QAM`](/kernel/userspace/userspace-api/media-dvb/fe-type-t.md#rst-fe-qam): `include/uapi/linux/dvb/frontend.h`, line 96
- [`FE_QPSK`](/kernel/userspace/userspace-api/media-dvb/fe-type-t.md#rst-fe-qpsk): `include/uapi/linux/dvb/frontend.h`, line 95

## Enumerations

- [`atscmh_rs_code_mode`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-atscmh_rs_code_mode): `include/uapi/linux/dvb/frontend.h`, line 778
- [`atscmh_rs_frame_ensemble`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-atscmh_rs_frame_ensemble): `include/uapi/linux/dvb/frontend.h`, line 747
- [`atscmh_rs_frame_mode`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-atscmh_rs_frame_mode): `include/uapi/linux/dvb/frontend.h`, line 765
- [`atscmh_sccc_block_mode`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-atscmh_sccc_block_mode): `include/uapi/linux/dvb/frontend.h`, line 718
- [`atscmh_sccc_code_mode`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-atscmh_sccc_code_mode): `include/uapi/linux/dvb/frontend.h`, line 735
- [`fe_bandwidth`](/kernel/userspace/userspace-api/media-dvb/fe-bandwidth-t.md#c-fe_bandwidth): `include/uapi/linux/dvb/frontend.h`, line 981
- [`fe_caps`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_caps): `include/uapi/linux/dvb/frontend.h`, line 57
- [`fe_code_rate`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_code_rate): `include/uapi/linux/dvb/frontend.h`, line 306
- [`fe_delivery_system`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_delivery_system): `include/uapi/linux/dvb/frontend.h`, line 676
- [`fe_guard_interval`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_guard_interval): `include/uapi/linux/dvb/frontend.h`, line 449
- [`fe_hierarchy`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_hierarchy): `include/uapi/linux/dvb/frontend.h`, line 474
- [`fe_interleaving`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_interleaving): `include/uapi/linux/dvb/frontend.h`, line 491
- [`fe_modulation`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_modulation): `include/uapi/linux/dvb/frontend.h`, line 369
- [`fe_pilot`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_pilot): `include/uapi/linux/dvb/frontend.h`, line 602
- [`fe_rolloff`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_rolloff): `include/uapi/linux/dvb/frontend.h`, line 622
- [`fe_sec_mini_cmd`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_sec_mini_cmd): `include/uapi/linux/dvb/frontend.h`, line 218
- [`fe_sec_tone_mode`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_sec_tone_mode): `include/uapi/linux/dvb/frontend.h`, line 205
- [`fe_sec_voltage`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_sec_voltage): `include/uapi/linux/dvb/frontend.h`, line 193
- [`fe_spectral_inversion`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_spectral_inversion): `include/uapi/linux/dvb/frontend.h`, line 261
- [`fe_status`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_status): `include/uapi/linux/dvb/frontend.h`, line 237
- [`fe_transmit_mode`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_transmit_mode): `include/uapi/linux/dvb/frontend.h`, line 419
- [`fe_type`](/kernel/userspace/userspace-api/media-dvb/fe-type-t.md#c-fe_type): `include/uapi/linux/dvb/frontend.h`, line 94
- [`fecap_scale_params`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fecap_scale_params): `include/uapi/linux/dvb/frontend.h`, line 801

## IOCTL Commands

- [`FE_DISEQC_RECV_SLAVE_REPLY`](/kernel/userspace/userspace-api/media-dvb/fe-diseqc-recv-slave-reply.md#rst-fe-diseqc-recv-slave-reply): `include/uapi/linux/dvb/frontend.h`, line 941
- [`FE_DISEQC_RESET_OVERLOAD`](/kernel/userspace/userspace-api/media-dvb/fe-diseqc-reset-overload.md#rst-fe-diseqc-reset-overload): `include/uapi/linux/dvb/frontend.h`, line 939
- [`FE_DISEQC_SEND_BURST`](/kernel/userspace/userspace-api/media-dvb/fe-diseqc-send-burst.md#rst-fe-diseqc-send-burst): `include/uapi/linux/dvb/frontend.h`, line 942
- [`FE_DISEQC_SEND_MASTER_CMD`](/kernel/userspace/userspace-api/media-dvb/fe-diseqc-send-master-cmd.md#rst-fe-diseqc-send-master-cmd): `include/uapi/linux/dvb/frontend.h`, line 940
- [`FE_DISHNETWORK_SEND_LEGACY_CMD`](/kernel/userspace/userspace-api/media-dvb/fe-dishnetwork-send-legacy-cmd.md#rst-fe-dishnetwork-send-legacy-cmd): `include/uapi/linux/dvb/frontend.h`, line 957
- [`FE_ENABLE_HIGH_LNB_VOLTAGE`](/kernel/userspace/userspace-api/media-dvb/fe-enable-high-lnb-voltage.md#rst-fe-enable-high-lnb-voltage): `include/uapi/linux/dvb/frontend.h`, line 946
- [`FE_GET_EVENT`](/kernel/userspace/userspace-api/media-dvb/fe-get-event.md#rst-fe-get-event): `include/uapi/linux/dvb/frontend.h`, line 955
- [`FE_GET_FRONTEND`](/kernel/userspace/userspace-api/media-dvb/fe-get-frontend.md#rst-fe-get-frontend): `include/uapi/linux/dvb/frontend.h`, line 1056
- [`FE_GET_INFO`](/kernel/userspace/userspace-api/media-dvb/fe-get-info.md#rst-fe-get-info): `include/uapi/linux/dvb/frontend.h`, line 937
- [`FE_GET_PROPERTY`](/kernel/userspace/userspace-api/media-dvb/fe-get-property.md#rst-fe-get-property): `include/uapi/linux/dvb/frontend.h`, line 960
- [`FE_READ_BER`](/kernel/userspace/userspace-api/media-dvb/fe-read-ber.md#rst-fe-read-ber): `include/uapi/linux/dvb/frontend.h`, line 949
- [`FE_READ_SIGNAL_STRENGTH`](/kernel/userspace/userspace-api/media-dvb/fe-read-signal-strength.md#rst-fe-read-signal-strength): `include/uapi/linux/dvb/frontend.h`, line 950
- [`FE_READ_SNR`](/kernel/userspace/userspace-api/media-dvb/fe-read-snr.md#rst-fe-read-snr): `include/uapi/linux/dvb/frontend.h`, line 951
- [`FE_READ_STATUS`](/kernel/userspace/userspace-api/media-dvb/fe-read-status.md#rst-fe-read-status): `include/uapi/linux/dvb/frontend.h`, line 948
- [`FE_READ_UNCORRECTED_BLOCKS`](/kernel/userspace/userspace-api/media-dvb/fe-read-uncorrected-blocks.md#rst-fe-read-uncorrected-blocks): `include/uapi/linux/dvb/frontend.h`, line 952
- [`FE_SET_FRONTEND`](/kernel/userspace/userspace-api/media-dvb/fe-set-frontend.md#rst-fe-set-frontend): `include/uapi/linux/dvb/frontend.h`, line 1055
- [`FE_SET_FRONTEND_TUNE_MODE`](/kernel/userspace/userspace-api/media-dvb/fe-set-frontend-tune-mode.md#rst-fe-set-frontend-tune-mode): `include/uapi/linux/dvb/frontend.h`, line 954
- [`FE_SET_PROPERTY`](/kernel/userspace/userspace-api/media-dvb/fe-get-property.md#rst-fe-get-property): `include/uapi/linux/dvb/frontend.h`, line 959
- [`FE_SET_TONE`](/kernel/userspace/userspace-api/media-dvb/fe-set-tone.md#rst-fe-set-tone): `include/uapi/linux/dvb/frontend.h`, line 944
- [`FE_SET_VOLTAGE`](/kernel/userspace/userspace-api/media-dvb/fe-set-voltage.md#rst-fe-set-voltage): `include/uapi/linux/dvb/frontend.h`, line 945

## Macros and Definitions

- [`DTV_API_VERSION`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-api-version): `include/uapi/linux/dvb/frontend.h`, line 544
- [`DTV_ATSCMH_FIC_VER`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-fic-ver): `include/uapi/linux/dvb/frontend.h`, line 561
- [`DTV_ATSCMH_NOG`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-nog): `include/uapi/linux/dvb/frontend.h`, line 563
- [`DTV_ATSCMH_PARADE_ID`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-parade-id): `include/uapi/linux/dvb/frontend.h`, line 562
- [`DTV_ATSCMH_PRC`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-prc): `include/uapi/linux/dvb/frontend.h`, line 566
- [`DTV_ATSCMH_RS_CODE_MODE_PRI`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-rs-code-mode-pri): `include/uapi/linux/dvb/frontend.h`, line 569
- [`DTV_ATSCMH_RS_CODE_MODE_SEC`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-rs-code-mode-sec): `include/uapi/linux/dvb/frontend.h`, line 570
- [`DTV_ATSCMH_RS_FRAME_ENSEMBLE`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-rs-frame-ensemble): `include/uapi/linux/dvb/frontend.h`, line 568
- [`DTV_ATSCMH_RS_FRAME_MODE`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-rs-frame-mode): `include/uapi/linux/dvb/frontend.h`, line 567
- [`DTV_ATSCMH_SCCC_BLOCK_MODE`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-sccc-block-mode): `include/uapi/linux/dvb/frontend.h`, line 571
- [`DTV_ATSCMH_SCCC_CODE_MODE_A`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-sccc-code-mode-a): `include/uapi/linux/dvb/frontend.h`, line 572
- [`DTV_ATSCMH_SCCC_CODE_MODE_B`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-sccc-code-mode-b): `include/uapi/linux/dvb/frontend.h`, line 573
- [`DTV_ATSCMH_SCCC_CODE_MODE_C`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-sccc-code-mode-c): `include/uapi/linux/dvb/frontend.h`, line 574
- [`DTV_ATSCMH_SCCC_CODE_MODE_D`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-sccc-code-mode-d): `include/uapi/linux/dvb/frontend.h`, line 575
- [`DTV_ATSCMH_SGN`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-sgn): `include/uapi/linux/dvb/frontend.h`, line 565
- [`DTV_ATSCMH_TNOG`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-atscmh-tnog): `include/uapi/linux/dvb/frontend.h`, line 564
- [`DTV_BANDWIDTH_HZ`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-bandwidth-hz): `include/uapi/linux/dvb/frontend.h`, line 505
- [`DTV_CLEAR`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-clear): `include/uapi/linux/dvb/frontend.h`, line 502
- [`DTV_CODE_RATE_HP`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-code-rate-hp): `include/uapi/linux/dvb/frontend.h`, line 546
- [`DTV_CODE_RATE_LP`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-code-rate-lp): `include/uapi/linux/dvb/frontend.h`, line 547
- [`DTV_DELIVERY_SYSTEM`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-delivery-system): `include/uapi/linux/dvb/frontend.h`, line 519
- [`DTV_DISEQC_MASTER`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-diseqc-master): `include/uapi/linux/dvb/frontend.h`, line 507
- [`DTV_DISEQC_SLAVE_REPLY`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-diseqc-slave-reply): `include/uapi/linux/dvb/frontend.h`, line 514
- [`DTV_DVBT2_PLP_ID_LEGACY`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-dvbt2-plp-id-legacy): `include/uapi/linux/dvb/frontend.h`, line 556
- [`DTV_ENUM_DELSYS`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-enum-delsys): `include/uapi/linux/dvb/frontend.h`, line 558
- [`DTV_FE_CAPABILITY`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-fe-capability): `include/uapi/linux/dvb/frontend.h`, line 518
- [`DTV_FE_CAPABILITY_COUNT`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-fe-capability-count): `include/uapi/linux/dvb/frontend.h`, line 517
- [`DTV_FREQUENCY`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-frequency): `include/uapi/linux/dvb/frontend.h`, line 503
- [`DTV_GUARD_INTERVAL`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-guard-interval): `include/uapi/linux/dvb/frontend.h`, line 548
- [`DTV_HIERARCHY`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-hierarchy): `include/uapi/linux/dvb/frontend.h`, line 550
- [`DTV_INNER_FEC`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inner-fec): `include/uapi/linux/dvb/frontend.h`, line 509
- [`DTV_INTERLEAVING`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-interleaving): `include/uapi/linux/dvb/frontend.h`, line 577
- [`DTV_INVERSION`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-inversion): `include/uapi/linux/dvb/frontend.h`, line 506
- [`DTV_ISDBT_LAYERA_FEC`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-fec): `include/uapi/linux/dvb/frontend.h`, line 529
- [`DTV_ISDBT_LAYERA_MODULATION`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-modulation): `include/uapi/linux/dvb/frontend.h`, line 530
- [`DTV_ISDBT_LAYERA_SEGMENT_COUNT`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-segment-count): `include/uapi/linux/dvb/frontend.h`, line 531
- [`DTV_ISDBT_LAYERA_TIME_INTERLEAVING`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-time-interleaving): `include/uapi/linux/dvb/frontend.h`, line 532
- [`DTV_ISDBT_LAYERB_FEC`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-fec): `include/uapi/linux/dvb/frontend.h`, line 534
- [`DTV_ISDBT_LAYERB_MODULATION`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-modulation): `include/uapi/linux/dvb/frontend.h`, line 535
- [`DTV_ISDBT_LAYERB_SEGMENT_COUNT`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-segment-count): `include/uapi/linux/dvb/frontend.h`, line 536
- [`DTV_ISDBT_LAYERB_TIME_INTERLEAVING`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-time-interleaving): `include/uapi/linux/dvb/frontend.h`, line 537
- [`DTV_ISDBT_LAYERC_FEC`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-fec): `include/uapi/linux/dvb/frontend.h`, line 539
- [`DTV_ISDBT_LAYERC_MODULATION`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-modulation): `include/uapi/linux/dvb/frontend.h`, line 540
- [`DTV_ISDBT_LAYERC_SEGMENT_COUNT`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-segment-count): `include/uapi/linux/dvb/frontend.h`, line 541
- [`DTV_ISDBT_LAYERC_TIME_INTERLEAVING`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-time-interleaving): `include/uapi/linux/dvb/frontend.h`, line 542
- [`DTV_ISDBT_LAYER_ENABLED`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-layer-enabled): `include/uapi/linux/dvb/frontend.h`, line 552
- [`DTV_ISDBT_PARTIAL_RECEPTION`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-partial-reception): `include/uapi/linux/dvb/frontend.h`, line 522
- [`DTV_ISDBT_SB_SEGMENT_COUNT`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-sb-segment-count): `include/uapi/linux/dvb/frontend.h`, line 527
- [`DTV_ISDBT_SB_SEGMENT_IDX`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-sb-segment-idx): `include/uapi/linux/dvb/frontend.h`, line 526
- [`DTV_ISDBT_SB_SUBCHANNEL_ID`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-sb-subchannel-id): `include/uapi/linux/dvb/frontend.h`, line 525
- [`DTV_ISDBT_SOUND_BROADCASTING`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-isdbt-sound-broadcasting): `include/uapi/linux/dvb/frontend.h`, line 523
- [`DTV_LNA`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-lna): `include/uapi/linux/dvb/frontend.h`, line 578
- [`DTV_MODULATION`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-modulation): `include/uapi/linux/dvb/frontend.h`, line 504
- [`DTV_PILOT`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-pilot): `include/uapi/linux/dvb/frontend.h`, line 512
- [`DTV_ROLLOFF`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-rolloff): `include/uapi/linux/dvb/frontend.h`, line 513
- [`DTV_SCRAMBLING_SEQUENCE_INDEX`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-scrambling-sequence-index): `include/uapi/linux/dvb/frontend.h`, line 591
- [`DTV_STAT_CNR`](/kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-dtv-stat-cnr): `include/uapi/linux/dvb/frontend.h`, line 582
- [`DTV_STAT_ERROR_BLOCK_COUNT`](/kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-dtv-stat-error-block-count): `include/uapi/linux/dvb/frontend.h`, line 587
- [`DTV_STAT_POST_ERROR_BIT_COUNT`](/kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-dtv-stat-post-error-bit-count): `include/uapi/linux/dvb/frontend.h`, line 585
- [`DTV_STAT_POST_TOTAL_BIT_COUNT`](/kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-dtv-stat-post-total-bit-count): `include/uapi/linux/dvb/frontend.h`, line 586
- [`DTV_STAT_PRE_ERROR_BIT_COUNT`](/kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-dtv-stat-pre-error-bit-count): `include/uapi/linux/dvb/frontend.h`, line 583
- [`DTV_STAT_PRE_TOTAL_BIT_COUNT`](/kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-dtv-stat-pre-total-bit-count): `include/uapi/linux/dvb/frontend.h`, line 584
- [`DTV_STAT_SIGNAL_STRENGTH`](/kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-dtv-stat-signal-strength): `include/uapi/linux/dvb/frontend.h`, line 581
- [`DTV_STAT_TOTAL_BLOCK_COUNT`](/kernel/userspace/userspace-api/media-dvb/frontend-stat-properties.md#rst-dtv-stat-total-block-count): `include/uapi/linux/dvb/frontend.h`, line 588
- [`DTV_STREAM_ID`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-stream-id): `include/uapi/linux/dvb/frontend.h`, line 554
- [`DTV_SYMBOL_RATE`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-symbol-rate): `include/uapi/linux/dvb/frontend.h`, line 508
- [`DTV_TONE`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tone): `include/uapi/linux/dvb/frontend.h`, line 511
- [`DTV_TRANSMISSION_MODE`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-transmission-mode): `include/uapi/linux/dvb/frontend.h`, line 549
- [`DTV_TUNE`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-tune): `include/uapi/linux/dvb/frontend.h`, line 501
- [`DTV_UNDEFINED`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-undefined): `include/uapi/linux/dvb/frontend.h`, line 500
- [`DTV_VOLTAGE`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-voltage): `include/uapi/linux/dvb/frontend.h`, line 510
- [`FE_TUNE_MODE_ONESHOT`](/kernel/userspace/userspace-api/media-dvb/fe-set-frontend-tune-mode.md#rst-fe-set-frontend-tune-mode): `include/uapi/linux/dvb/frontend.h`, line 933
- [`LNA_AUTO`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-lna): `include/uapi/linux/dvb/frontend.h`, line 786
- [`NO_STREAM_ID_FILTER`](/kernel/userspace/userspace-api/media-dvb/fe-property-parameters.md#rst-dtv-stream-id): `include/uapi/linux/dvb/frontend.h`, line 785

## Structures

- [`dtv_fe_stats`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-struct-dtv_fe_stats): `include/uapi/linux/dvb/frontend.h`, line 874
- [`dtv_properties`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-struct-dtv_properties): `include/uapi/linux/dvb/frontend.h`, line 921
- [`dtv_property`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-struct-dtv_property): `include/uapi/linux/dvb/frontend.h`, line 896
- [`dtv_stats`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-struct-dtv_stats): `include/uapi/linux/dvb/frontend.h`, line 852
- [`dvb_diseqc_master_cmd`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-struct-dvb_diseqc_master_cmd): `include/uapi/linux/dvb/frontend.h`, line 158
- [`dvb_diseqc_slave_reply`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-struct-dvb_diseqc_slave_reply): `include/uapi/linux/dvb/frontend.h`, line 180
- [`dvb_frontend_event`](/kernel/userspace/userspace-api/media-dvb/dvb-frontend-event.md#c-dvb_frontend_event): `include/uapi/linux/dvb/frontend.h`, line 1048
- [`dvb_frontend_info`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-struct-dvb_frontend_info): `include/uapi/linux/dvb/frontend.h`, line 131
- [`dvb_frontend_parameters`](/kernel/userspace/userspace-api/media-dvb/dvb-frontend-parameters.md#c-dvb_frontend_parameters): `include/uapi/linux/dvb/frontend.h`, line 1036
- [`dvb_ofdm_parameters`](/kernel/userspace/userspace-api/media-dvb/dvb-frontend-parameters.md#c-dvb_ofdm_parameters): `include/uapi/linux/dvb/frontend.h`, line 1026
- [`dvb_qam_parameters`](/kernel/userspace/userspace-api/media-dvb/dvb-frontend-parameters.md#c-dvb_qam_parameters): `include/uapi/linux/dvb/frontend.h`, line 1016
- [`dvb_qpsk_parameters`](/kernel/userspace/userspace-api/media-dvb/dvb-frontend-parameters.md#c-dvb_qpsk_parameters): `include/uapi/linux/dvb/frontend.h`, line 1011
- [`dvb_vsb_parameters`](/kernel/userspace/userspace-api/media-dvb/dvb-frontend-parameters.md#c-dvb_vsb_parameters): `include/uapi/linux/dvb/frontend.h`, line 1022

## Type Definitions

- [`fe_bandwidth_t`](/kernel/userspace/userspace-api/media-dvb/fe-bandwidth-t.md#c-fe_bandwidth): `include/uapi/linux/dvb/frontend.h`, line 1002
- [`fe_caps_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_caps): `include/uapi/linux/dvb/frontend.h`, line 993
- [`fe_code_rate_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_code_rate): `include/uapi/linux/dvb/frontend.h`, line 999
- [`fe_delivery_system_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_delivery_system): `include/uapi/linux/dvb/frontend.h`, line 1007
- [`fe_guard_interval_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_guard_interval): `include/uapi/linux/dvb/frontend.h`, line 1003
- [`fe_hierarchy_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_hierarchy): `include/uapi/linux/dvb/frontend.h`, line 1004
- [`fe_modulation_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_modulation): `include/uapi/linux/dvb/frontend.h`, line 1000
- [`fe_pilot_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_pilot): `include/uapi/linux/dvb/frontend.h`, line 1005
- [`fe_rolloff_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_rolloff): `include/uapi/linux/dvb/frontend.h`, line 1006
- [`fe_sec_mini_cmd_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_sec_mini_cmd): `include/uapi/linux/dvb/frontend.h`, line 996
- [`fe_sec_tone_mode_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_sec_tone_mode): `include/uapi/linux/dvb/frontend.h`, line 995
- [`fe_sec_voltage_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_sec_voltage): `include/uapi/linux/dvb/frontend.h`, line 992
- [`fe_spectral_inversion_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_spectral_inversion): `include/uapi/linux/dvb/frontend.h`, line 998
- [`fe_status_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_status): `include/uapi/linux/dvb/frontend.h`, line 997
- [`fe_transmit_mode_t`](/kernel/userspace/userspace-api/media-dvb/frontend-header.md#c-enum-fe_transmit_mode): `include/uapi/linux/dvb/frontend.h`, line 1001
- [`fe_type_t`](/kernel/userspace/userspace-api/media-dvb/fe-type-t.md#c-fe_type): `include/uapi/linux/dvb/frontend.h`, line 994


<a id="rst-demux"></a>

## Demux


## Enumeration values

- [`DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_buffer_flags): `include/uapi/linux/dvb/dmx.h`, line 221
- [`DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_buffer_flags): `include/uapi/linux/dvb/dmx.h`, line 222
- [`DMX_BUFFER_FLAG_HAD_CRC32_DISCARD`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_buffer_flags): `include/uapi/linux/dvb/dmx.h`, line 218
- [`DMX_BUFFER_FLAG_TEI`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_buffer_flags): `include/uapi/linux/dvb/dmx.h`, line 219
- [`DMX_BUFFER_PKT_COUNTER_MISMATCH`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_buffer_flags): `include/uapi/linux/dvb/dmx.h`, line 220
- [`DMX_IN_DVR`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_input): `include/uapi/linux/dvb/dmx.h`, line 54
- [`DMX_IN_FRONTEND`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_input): `include/uapi/linux/dvb/dmx.h`, line 53
- [`DMX_OUT_DECODER`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_output): `include/uapi/linux/dvb/dmx.h`, line 39
- [`DMX_OUT_TAP`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_output): `include/uapi/linux/dvb/dmx.h`, line 40
- [`DMX_OUT_TSDEMUX_TAP`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_output): `include/uapi/linux/dvb/dmx.h`, line 42
- [`DMX_OUT_TS_TAP`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_output): `include/uapi/linux/dvb/dmx.h`, line 41
- [`DMX_PES_AUDIO0`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 89
- [`DMX_PES_AUDIO1`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 95
- [`DMX_PES_AUDIO2`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 101
- [`DMX_PES_AUDIO3`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 107
- [`DMX_PES_OTHER`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 113
- [`DMX_PES_PCR0`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 93
- [`DMX_PES_PCR1`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 99
- [`DMX_PES_PCR2`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 105
- [`DMX_PES_PCR3`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 111
- [`DMX_PES_SUBTITLE0`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 92
- [`DMX_PES_SUBTITLE1`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 98
- [`DMX_PES_SUBTITLE2`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 104
- [`DMX_PES_SUBTITLE3`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 110
- [`DMX_PES_TELETEXT0`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 91
- [`DMX_PES_TELETEXT1`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 97
- [`DMX_PES_TELETEXT2`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 103
- [`DMX_PES_TELETEXT3`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 109
- [`DMX_PES_VIDEO0`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 90
- [`DMX_PES_VIDEO1`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 96
- [`DMX_PES_VIDEO2`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 102
- [`DMX_PES_VIDEO3`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 108

## Enumerations

- [`dmx_buffer_flags`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_buffer_flags): `include/uapi/linux/dvb/dmx.h`, line 217
- [`dmx_input`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_input): `include/uapi/linux/dvb/dmx.h`, line 52
- [`dmx_output`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_output): `include/uapi/linux/dvb/dmx.h`, line 38
- [`dmx_ts_pes`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 88

## IOCTL Commands

- [`DMX_ADD_PID`](/kernel/userspace/userspace-api/media-dvb/dmx-add-pid.md#rst-dmx-add-pid): `include/uapi/linux/dvb/dmx.h`, line 296
- [`DMX_DQBUF`](/kernel/userspace/userspace-api/media-dvb/dmx-qbuf.md#rst-dmx-qbuf): `include/uapi/linux/dvb/dmx.h`, line 313
- [`DMX_EXPBUF`](/kernel/userspace/userspace-api/media-dvb/dmx-expbuf.md#rst-dmx-expbuf): `include/uapi/linux/dvb/dmx.h`, line 311
- [`DMX_GET_PES_PIDS`](/kernel/userspace/userspace-api/media-dvb/dmx-get-pes-pids.md#rst-dmx-get-pes-pids): `include/uapi/linux/dvb/dmx.h`, line 294
- [`DMX_GET_STC`](/kernel/userspace/userspace-api/media-dvb/dmx-get-stc.md#rst-dmx-get-stc): `include/uapi/linux/dvb/dmx.h`, line 295
- [`DMX_QBUF`](/kernel/userspace/userspace-api/media-dvb/dmx-qbuf.md#rst-dmx-qbuf): `include/uapi/linux/dvb/dmx.h`, line 312
- [`DMX_QUERYBUF`](/kernel/userspace/userspace-api/media-dvb/dmx-querybuf.md#rst-dmx-querybuf): `include/uapi/linux/dvb/dmx.h`, line 310
- [`DMX_REMOVE_PID`](/kernel/userspace/userspace-api/media-dvb/dmx-remove-pid.md#rst-dmx-remove-pid): `include/uapi/linux/dvb/dmx.h`, line 297
- [`DMX_REQBUFS`](/kernel/userspace/userspace-api/media-dvb/dmx-reqbufs.md#rst-dmx-reqbufs): `include/uapi/linux/dvb/dmx.h`, line 309
- [`DMX_SET_BUFFER_SIZE`](/kernel/userspace/userspace-api/media-dvb/dmx-set-buffer-size.md#rst-dmx-set-buffer-size): `include/uapi/linux/dvb/dmx.h`, line 293
- [`DMX_SET_FILTER`](/kernel/userspace/userspace-api/media-dvb/dmx-set-filter.md#rst-dmx-set-filter): `include/uapi/linux/dvb/dmx.h`, line 291
- [`DMX_SET_PES_FILTER`](/kernel/userspace/userspace-api/media-dvb/dmx-set-pes-filter.md#rst-dmx-set-pes-filter): `include/uapi/linux/dvb/dmx.h`, line 292
- [`DMX_START`](/kernel/userspace/userspace-api/media-dvb/dmx-start.md#rst-dmx-start): `include/uapi/linux/dvb/dmx.h`, line 289
- [`DMX_STOP`](/kernel/userspace/userspace-api/media-dvb/dmx-stop.md#rst-dmx-stop): `include/uapi/linux/dvb/dmx.h`, line 290

## Macros and Definitions

- [`DMX_CHECK_CRC`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-struct-dmx_sct_filter_params): `include/uapi/linux/dvb/dmx.h`, line 163
- [`DMX_IMMEDIATE_START`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-struct-dmx_sct_filter_params): `include/uapi/linux/dvb/dmx.h`, line 165
- [`DMX_ONESHOT`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-struct-dmx_sct_filter_params): `include/uapi/linux/dvb/dmx.h`, line 164

## Structures

- [`dmx_buffer`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-struct-dmx_buffer): `include/uapi/linux/dvb/dmx.h`, line 245
- [`dmx_exportbuffer`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-struct-dmx_exportbuffer): `include/uapi/linux/dvb/dmx.h`, line 283
- [`dmx_filter`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-struct-dmx_filter): `include/uapi/linux/dvb/dmx.h`, line 134
- [`dmx_pes_filter_params`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-struct-dmx_pes_filter_params): `include/uapi/linux/dvb/dmx.h`, line 178
- [`dmx_requestbuffers`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-struct-dmx_requestbuffers): `include/uapi/linux/dvb/dmx.h`, line 263
- [`dmx_sct_filter_params`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-struct-dmx_sct_filter_params): `include/uapi/linux/dvb/dmx.h`, line 158
- [`dmx_stc`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-struct-dmx_stc): `include/uapi/linux/dvb/dmx.h`, line 193

## Type Definitions

- [`dmx_filter_t`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-struct-dmx_filter): `include/uapi/linux/dvb/dmx.h`, line 305
- [`dmx_input_t`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_input): `include/uapi/linux/dvb/dmx.h`, line 303
- [`dmx_output_t`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_output): `include/uapi/linux/dvb/dmx.h`, line 302
- [`dmx_pes_type_t`](/kernel/userspace/userspace-api/media-dvb/dmx-types.md#c-enum-dmx_ts_pes): `include/uapi/linux/dvb/dmx.h`, line 304


<a id="rst-conditional-access"></a>

## Conditional Access


## IOCTL Commands

- [`CA_GET_CAP`](/kernel/userspace/userspace-api/media-dvb/ca-get-cap.md#rst-ca-get-cap): `include/uapi/linux/dvb/ca.h`, line 121
- [`CA_GET_DESCR_INFO`](/kernel/userspace/userspace-api/media-dvb/ca-get-descr-info.md#rst-ca-get-descr-info): `include/uapi/linux/dvb/ca.h`, line 123
- [`CA_GET_MSG`](/kernel/userspace/userspace-api/media-dvb/ca-get-msg.md#rst-ca-get-msg): `include/uapi/linux/dvb/ca.h`, line 124
- [`CA_GET_SLOT_INFO`](/kernel/userspace/userspace-api/media-dvb/ca-get-slot-info.md#rst-ca-get-slot-info): `include/uapi/linux/dvb/ca.h`, line 122
- [`CA_RESET`](/kernel/userspace/userspace-api/media-dvb/ca-reset.md#rst-ca-reset): `include/uapi/linux/dvb/ca.h`, line 120
- [`CA_SEND_MSG`](/kernel/userspace/userspace-api/media-dvb/ca-send-msg.md#rst-ca-send-msg): `include/uapi/linux/dvb/ca.h`, line 125
- [`CA_SET_DESCR`](/kernel/userspace/userspace-api/media-dvb/ca-set-descr.md#rst-ca-set-descr): `include/uapi/linux/dvb/ca.h`, line 126

## Macros and Definitions

- [`CA_CI`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_slot_info): `include/uapi/linux/dvb/ca.h`, line 39
- [`CA_CI_LINK`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_slot_info): `include/uapi/linux/dvb/ca.h`, line 40
- [`CA_CI_MODULE_PRESENT`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_slot_info): `include/uapi/linux/dvb/ca.h`, line 46
- [`CA_CI_MODULE_READY`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_slot_info): `include/uapi/linux/dvb/ca.h`, line 47
- [`CA_CI_PHYS`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_slot_info): `include/uapi/linux/dvb/ca.h`, line 41
- [`CA_DESCR`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_slot_info): `include/uapi/linux/dvb/ca.h`, line 42
- [`CA_DSS`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_descr_info): `include/uapi/linux/dvb/ca.h`, line 70
- [`CA_ECD`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_descr_info): `include/uapi/linux/dvb/ca.h`, line 68
- [`CA_NDS`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_descr_info): `include/uapi/linux/dvb/ca.h`, line 69
- [`CA_SC`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_slot_info): `include/uapi/linux/dvb/ca.h`, line 43

## Structures

- [`ca_caps`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_caps): `include/uapi/linux/dvb/ca.h`, line 83
- [`ca_descr`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_descr): `include/uapi/linux/dvb/ca.h`, line 114
- [`ca_descr_info`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_descr_info): `include/uapi/linux/dvb/ca.h`, line 65
- [`ca_msg`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_msg): `include/uapi/linux/dvb/ca.h`, line 100
- [`ca_slot_info`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_slot_info): `include/uapi/linux/dvb/ca.h`, line 36

## Type Definitions

- [`ca_caps_t`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_caps): `include/uapi/linux/dvb/ca.h`, line 133
- [`ca_descr_info_t`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_descr_info): `include/uapi/linux/dvb/ca.h`, line 132
- [`ca_descr_t`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_descr): `include/uapi/linux/dvb/ca.h`, line 135
- [`ca_msg_t`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_msg): `include/uapi/linux/dvb/ca.h`, line 134
- [`ca_slot_info_t`](/kernel/userspace/userspace-api/media-dvb/ca-data-types.md#c-struct-ca_slot_info): `include/uapi/linux/dvb/ca.h`, line 131


<a id="rst-network"></a>

## Network


## IOCTL Commands

- [`NET_ADD_IF`](/kernel/userspace/userspace-api/media-dvb/net-add-if.md#rst-net-add-if): `include/uapi/linux/dvb/net.h`, line 39
- [`NET_GET_IF`](/kernel/userspace/userspace-api/media-dvb/net-get-if.md#rst-net-get-if): `include/uapi/linux/dvb/net.h`, line 41
- [`NET_REMOVE_IF`](/kernel/userspace/userspace-api/media-dvb/net-remove-if.md#rst-net-remove-if): `include/uapi/linux/dvb/net.h`, line 40

## Macros and Definitions

- [`DVB_NET_FEEDTYPE_MPE`](/kernel/userspace/userspace-api/media-dvb/net-types.md#c-struct-dvb_net_if): `include/uapi/linux/dvb/net.h`, line 34
- [`DVB_NET_FEEDTYPE_ULE`](/kernel/userspace/userspace-api/media-dvb/net-types.md#c-struct-dvb_net_if): `include/uapi/linux/dvb/net.h`, line 35

## Structures

- [`dvb_net_if`](/kernel/userspace/userspace-api/media-dvb/net-types.md#c-struct-dvb_net_if): `include/uapi/linux/dvb/net.h`, line 30

---

# Introduction

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> 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…

<a id="rst-introduction"></a>
<a id="rst-dvb-introduction"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<a id="rst-what-you-need-to-know"></a>
<a id="rst-requisites"></a>

## 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](<http://www.dvb.org>) and/or [http://www.etsi.org](<http://www.etsi.org>).

- American standards (ATSC): [https://www.atsc.org/standards/](<https://www.atsc.org/standards/>)

- Japanese standards (ISDB): [http://www.dibeg.org/](<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++.

<a id="rst-history-1"></a>
<a id="rst-history"></a>

## 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](<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.

<a id="rst-overview-1"></a>
<a id="rst-overview"></a>

## Overview

<a id="rst-stb-components"></a>

![dvbstb.svg](/kernel/userspace/userspace-api/media-dvb/asset-33acbf158a50-dvbstb.svg)

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.

  > [!NOTE]
  >
  > Not every digital TV hardware provides conditional access hardware.

- **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.

  > [!NOTE]
  >
  > Modern hardware usually doesn't have a separate decoder hardware, as such functionality can be provided by the main CPU, by the graphics adapter of the system or by a signal processing hardware embedded on a Systems on a Chip (SoC) integrated circuit.
  >
  > It may also not be needed for certain usages (e.g. for data-only uses like "internet over satellite").

[stb_components](<#rst-stb-components>) shows a crude schematic of the control and data flow between those components.

<a id="rst-linux-digital-tv-devices"></a>
<a id="rst-dvb-devices"></a>

## 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.

<a id="rst-api-include-files"></a>
<a id="rst-include-files"></a>

## 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:



```c
#include <linux/dvb/ca.h>

#include <linux/dvb/dmx.h>

#include <linux/dvb/frontend.h>

#include <linux/dvb/net.h>
```

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.

<a id="rst-digital-tv-deprecated-apis"></a>
<a id="rst-legacy-dvb-apis"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

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.

> [!NOTE]
>
> The APIs described here doesn't necessarily reflect the current code implementation, as this section of the document was written for DVB version 1, while the code reflects DVB version 3 implementation.

- [Digital TV Frontend legacy API (a. k. a. DVBv3)](</kernel/userspace/userspace-api/media-dvb/frontend-legacy-dvbv3-api.md>)
- [Legacy DVB MPEG Decoder APIs](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md>)

---

# 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.

<a id="rst-dvb-audio-device"></a>
<a id="rst-dvb-audio"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later OR GPL-2.0 -->

<!-- c:namespace: dtv.legacy.audio -->

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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](</kernel/userspace/userspace-api/media-v4l/audio.md#rst-audio>) for new drivers\!

<a id="rst-audio-data-types"></a>

## Audio Data Types

This section describes the structures, data types and defines used when talking to the audio device.

---

<a id="rst-audio-stream-source-t"></a>

### audio_stream_source_t

<a id="rst-synopsis"></a>

#### Synopsis





<a id="c-enum-audio_stream_source_t"></a>

```c
audio_stream_source_t
```



```c
typedef enum {
AUDIO_SOURCE_DEMUX,
AUDIO_SOURCE_MEMORY
} audio_stream_source_t;
```

<a id="rst-constants"></a>

#### Constants


<table>
<tbody>
<tr>
<td>


`AUDIO_SOURCE_DEMUX`

</td>
<td colspan="2">


 Selects the demultiplexer (fed either by the frontend or the DVR device) as the source of the video stream.

</td>
</tr>
<tr>
<td>


`AUDIO_SOURCE_MEMORY`

</td>
<td colspan="2">


Selects the stream from the application that comes through the [write()](<#rst-write>) system call.

</td>
</tr>
</tbody>
</table>

<a id="rst-description"></a>

#### Description

The audio stream source is set through the [AUDIO_SELECT_SOURCE](<#rst-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`.

---

<a id="rst-audio-play-state-t"></a>

### audio_play_state_t

<a id="rst-synopsis-1"></a>

#### Synopsis





<a id="c-enum-audio_play_state_t"></a>

```c
audio_play_state_t
```



```c
typedef enum {
    AUDIO_STOPPED,
    AUDIO_PLAYING,
    AUDIO_PAUSED
} audio_play_state_t;
```

<a id="rst-constants-1"></a>

#### Constants


<table>
<tbody>
<tr>
<td>


`AUDIO_STOPPED`

</td>
<td>


Audio is stopped.

</td>
</tr>
<tr>
<td>


`AUDIO_PLAYING`

</td>
<td>


Audio is currently playing.

</td>
</tr>
<tr>
<td>


`AUDIO_PAUSE`

</td>
<td>


Audio is frozen.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-1"></a>

#### Description

This values can be returned by the [AUDIO_GET_STATUS](<#rst-audio-get-status>) call representing the state of audio playback.

---

<a id="rst-audio-channel-select-t"></a>

### audio_channel_select_t

<a id="rst-synopsis-2"></a>

#### Synopsis





<a id="c-enum-audio_channel_select_t"></a>

```c
audio_channel_select_t
```



```c
typedef enum {
    AUDIO_STEREO,
    AUDIO_MONO_LEFT,
    AUDIO_MONO_RIGHT,
    AUDIO_MONO,
    AUDIO_STEREO_SWAPPED
} audio_channel_select_t;
```

<a id="rst-constants-2"></a>

#### Constants


<table>
<tbody>
<tr>
<td>


`AUDIO_STEREO`

</td>
<td>


Stereo.

</td>
</tr>
<tr>
<td>


`AUDIO_MONO_LEFT`

</td>
<td>


Mono, select left stereo channel as source.

</td>
</tr>
<tr>
<td>


`AUDIO_MONO_RIGHT`

</td>
<td>


Mono, select right stereo channel as source.

</td>
</tr>
<tr>
<td>


`AUDIO_MONO`

</td>
<td>


Mono source only.

</td>
</tr>
<tr>
<td>


`AUDIO_STEREO_SWAPPED`

</td>
<td>


Stereo, swap L &amp; R.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-2"></a>

#### Description

The audio channel selected via [AUDIO_CHANNEL_SELECT](<#rst-audio-channel-select>) is determined by this value.

---

<a id="rst-audio-mixer-t"></a>

### audio_mixer_t

<a id="rst-synopsis-3"></a>

#### Synopsis





<a id="c-struct-audio_mixer"></a>

```c
audio_mixer
```



```c
typedef struct audio_mixer {
    unsigned int volume_left;
    unsigned int volume_right;
} audio_mixer_t;
```

<a id="rst-variables"></a>

#### Variables


<table>
<tbody>
<tr>
<td>


`unsigned int volume_left`

</td>
<td>


Volume left channel. Valid range: 0 ... 255

</td>
</tr>
<tr>
<td>


`unsigned int volume_right`

</td>
<td>


Volume right channel. Valid range: 0 ... 255

</td>
</tr>
</tbody>
</table>

<a id="rst-description-3"></a>

#### Description

This structure is used by the [AUDIO_SET_MIXER](<#rst-audio-set-mixer>) call to set the audio volume.

---

<a id="rst-audio-status"></a>

### audio_status

<a id="rst-synopsis-4"></a>

#### Synopsis





<a id="c-struct-audio_status"></a>

```c
audio_status
```



```c
typedef struct audio_status {
    int AV_sync_state;
    int mute_state;
    audio_play_state_t play_state;
    audio_stream_source_t stream_source;
    audio_channel_select_t channel_select;
    int bypass_mode;
    audio_mixer_t mixer_state;
} audio_status_t;
```

<a id="rst-variables-1"></a>

#### Variables


<table>
<tbody>
<tr>
<td rowspan="3">


 `int AV_sync_state`

</td>
<td colspan="2">


 Shows if A/V synchronization is ON or OFF.

</td>
</tr>
<tr>
<td>


TRUE  ( \!= 0 )

</td>
<td>


AV-sync ON.

</td>
</tr>
<tr>
<td>


FALSE ( == 0 )

</td>
<td>


AV-sync OFF.

</td>
</tr>
<tr>
<td rowspan="3">


 `int mute_state`

</td>
<td colspan="2">


 Indicates if audio is muted or not.

</td>
</tr>
<tr>
<td>


TRUE  ( \!= 0 )

</td>
<td>


mute audio

</td>
</tr>
<tr>
<td>


FALSE ( == 0 )

</td>
<td>


unmute audio

</td>
</tr>
<tr>
<td>


[audio_play_state_t](<#rst-audio-play-state-t>) `play_state`

</td>
<td colspan="2">


Current playback state.

</td>
</tr>
<tr>
<td>


[audio_stream_source_t](<#rst-audio-stream-source-t>) `stream_source`

</td>
<td colspan="2">


Current source of the data.

</td>
</tr>
<tr>
<td rowspan="3">


 `int bypass_mode`

</td>
<td colspan="2">


 Is the decoding of the current Audio stream in the DVB subsystem enabled or disabled.

</td>
</tr>
<tr>
<td>


TRUE  ( \!= 0 )

</td>
<td>


Bypass disabled.

</td>
</tr>
<tr>
<td>


FALSE ( == 0 )

</td>
<td>


Bypass enabled.

</td>
</tr>
<tr>
<td>


[audio_mixer_t](<#rst-audio-mixer-t>) `mixer_state`

</td>
<td colspan="2">


Current volume settings.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-4"></a>

#### Description

The [AUDIO_GET_STATUS](<#rst-audio-get-status>) call returns this structure as information about various states of the playback operation.

---

<a id="rst-audio-encodings"></a>

### audio encodings

<a id="rst-synopsis-5"></a>

#### Synopsis



```c
#define AUDIO_CAP_DTS    1
#define AUDIO_CAP_LPCM   2
#define AUDIO_CAP_MP1    4
#define AUDIO_CAP_MP2    8
#define AUDIO_CAP_MP3   16
#define AUDIO_CAP_AAC   32
#define AUDIO_CAP_OGG   64
#define AUDIO_CAP_SDDS 128
#define AUDIO_CAP_AC3  256
```

<a id="rst-constants-3"></a>

#### Constants


<table>
<tbody>
<tr>
<td>


`AUDIO_CAP_DTS`

</td>
<td colspan="2">


 The hardware accepts DTS audio tracks.

</td>
</tr>
<tr>
<td>


`AUDIO_CAP_LPCM`

</td>
<td colspan="2">


The hardware accepts uncompressed audio with Linear Pulse-Code Modulation (LPCM)

</td>
</tr>
<tr>
<td>


`AUDIO_CAP_MP1`

</td>
<td colspan="2">


The hardware accepts MPEG-1 Audio Layer 1.

</td>
</tr>
<tr>
<td>


`AUDIO_CAP_MP2`

</td>
<td colspan="2">


The hardware accepts MPEG-1 Audio Layer 2. Also known as MUSICAM.

</td>
</tr>
<tr>
<td>


`AUDIO_CAP_MP3`

</td>
<td colspan="2">


The hardware accepts MPEG-1 Audio Layer III. Commonly known as .mp3.

</td>
</tr>
<tr>
<td>


`AUDIO_CAP_AAC`

</td>
<td colspan="2">


The hardware accepts AAC (Advanced Audio Coding).

</td>
</tr>
<tr>
<td>


`AUDIO_CAP_OGG`

</td>
<td colspan="2">


The hardware accepts Vorbis audio tracks.

</td>
</tr>
<tr>
<td>


`AUDIO_CAP_SDDS`

</td>
<td colspan="2">


The hardware accepts Sony Dynamic Digital Sound (SDDS).

</td>
</tr>
<tr>
<td>


`AUDIO_CAP_AC3`

</td>
<td colspan="2">


The hardware accepts Dolby Digital ATSC A/52 audio. Also known as AC-3.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-5"></a>

#### Description

A call to [AUDIO_GET_CAPABILITIES](<#rst-audio-get-capabilities>) returns an unsigned integer with the following bits set according to the hardwares capabilities.

---

<a id="rst-audio-function-calls"></a>

## Audio Function Calls

<a id="rst-audio-stop"></a>

### AUDIO_STOP

<a id="rst-synopsis-6"></a>

#### Synopsis





<a id="c-AUDIO_STOP"></a>

```c
AUDIO_STOP
```



```c
int ioctl(int fd, int request = AUDIO_STOP)
```

<a id="rst-arguments"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


 Equals `AUDIO_STOP` for this command.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-6"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl call asks the Audio Device to stop playing the current stream.

<a id="rst-return-value"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-play"></a>

### AUDIO_PLAY

<a id="rst-synopsis-7"></a>

#### Synopsis





<a id="c-AUDIO_PLAY"></a>

```c
AUDIO_PLAY
```



```c
int  ioctl(int fd, int request = AUDIO_PLAY)
```

<a id="rst-arguments-1"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


 Equals `AUDIO_PLAY` for this command.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-7"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl call asks the Audio Device to start playing an audio stream from the selected source.

<a id="rst-return-value-1"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-pause"></a>

### AUDIO_PAUSE

<a id="rst-synopsis-8"></a>

#### Synopsis





<a id="c-AUDIO_PAUSE"></a>

```c
AUDIO_PAUSE
```



```c
int  ioctl(int fd, int request = AUDIO_PAUSE)
```

<a id="rst-arguments-2"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `AUDIO_PAUSE` for this command.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-8"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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](<#rst-audio-continue>) command.

<a id="rst-return-value-2"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-continue"></a>

### AUDIO_CONTINUE

<a id="rst-synopsis-9"></a>

#### Synopsis





<a id="c-AUDIO_CONTINUE"></a>

```c
AUDIO_CONTINUE
```



```c
int  ioctl(int fd, int request = AUDIO_CONTINUE)
```

<a id="rst-arguments-3"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `AUDIO_CONTINUE` for this command.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-9"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl restarts the decoding and playing process previously paused with [AUDIO_PAUSE](<#rst-audio-pause>) command.

<a id="rst-return-value-3"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-select-source"></a>

### AUDIO_SELECT_SOURCE

<a id="rst-synopsis-10"></a>

#### Synopsis





<a id="c-AUDIO_SELECT_SOURCE"></a>

```c
AUDIO_SELECT_SOURCE
```



```c
int ioctl(int fd, int request = AUDIO_SELECT_SOURCE,
audio_stream_source_t source)
```

<a id="rst-arguments-4"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `AUDIO_SELECT_SOURCE` for this command.

</td>
</tr>
<tr>
<td>


[audio_stream_source_t](<#rst-audio-stream-source-t>) `source`

</td>
<td colspan="2">


Indicates the source that shall be used for the Audio stream.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-10"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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.

<a id="rst-return-value-4"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-set-mute"></a>

### AUDIO_SET_MUTE

<a id="rst-synopsis-11"></a>

#### Synopsis





<a id="c-AUDIO_SET_MUTE"></a>

```c
AUDIO_SET_MUTE
```



```c
int  ioctl(int fd, int request = AUDIO_SET_MUTE, int state)
```

<a id="rst-arguments-5"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


 Equals `AUDIO_SET_MUTE` for this command.

</td>
</tr>
<tr>
<td rowspan="3">


 `int state`

</td>
<td colspan="2">


 Indicates if audio device shall mute or not.

</td>
</tr>
<tr>
<td>


TRUE  ( \!= 0 )

</td>
<td>


mute audio

</td>
</tr>
<tr>
<td>


FALSE ( == 0 )

</td>
<td>


unmute audio

</td>
</tr>
</tbody>
</table>

<a id="rst-description-11"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl is for DVB devices only. To control a V4L2 decoder use the V4L2 [ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD](</kernel/userspace/userspace-api/media-v4l/vidioc-decoder-cmd.md#rst-vidioc-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.

<a id="rst-return-value-5"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-set-av-sync"></a>

### AUDIO_SET_AV_SYNC

<a id="rst-synopsis-12"></a>

#### Synopsis





<a id="c-AUDIO_SET_AV_SYNC"></a>

```c
AUDIO_SET_AV_SYNC
```



```c
int  ioctl(int fd, int request = AUDIO_SET_AV_SYNC, int state)
```

<a id="rst-arguments-6"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


 Equals `AUDIO_AV_SYNC` for this command.

</td>
</tr>
<tr>
<td rowspan="3">


 `int state`

</td>
<td colspan="2">


 Tells the DVB subsystem if A/V synchronization shall be ON or OFF.

</td>
</tr>
<tr>
<td>


TRUE  ( \!= 0 )

</td>
<td>


AV-sync ON.

</td>
</tr>
<tr>
<td>


FALSE ( == 0 )

</td>
<td>


AV-sync OFF.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-12"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl call asks the Audio Device to turn ON or OFF A/V synchronization.

<a id="rst-return-value-6"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-set-bypass-mode"></a>

### AUDIO_SET_BYPASS_MODE

<a id="rst-synopsis-13"></a>

#### Synopsis





<a id="c-AUDIO_SET_BYPASS_MODE"></a>

```c
AUDIO_SET_BYPASS_MODE
```



```c
int ioctl(int fd, int request = AUDIO_SET_BYPASS_MODE, int mode)
```

<a id="rst-arguments-7"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


 Equals `AUDIO_SET_BYPASS_MODE` for this command.

</td>
</tr>
<tr>
<td rowspan="3">


 `int mode`

</td>
<td colspan="2">


 Enables or disables the decoding of the current Audio stream in the DVB subsystem.

</td>
</tr>
<tr>
<td>


TRUE  ( \!= 0 )

</td>
<td>


Disable bypass

</td>
</tr>
<tr>
<td>


FALSE ( == 0 )

</td>
<td>


Enable bypass

</td>
</tr>
</tbody>
</table>

<a id="rst-description-13"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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.

<a id="rst-return-value-7"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-channel-select"></a>

### AUDIO_CHANNEL_SELECT

<a id="rst-synopsis-14"></a>

#### Synopsis





<a id="c-AUDIO_CHANNEL_SELECT"></a>

```c
AUDIO_CHANNEL_SELECT
```



```c
int ioctl(int fd, int request = AUDIO_CHANNEL_SELECT,
audio_channel_select_t)
```

<a id="rst-arguments-8"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `AUDIO_CHANNEL_SELECT` for this command.

</td>
</tr>
<tr>
<td>


[audio_channel_select_t](<#rst-audio-channel-select-t>) `ch`

</td>
<td colspan="2">


Select the output format of the audio (mono left/right, stereo).

</td>
</tr>
</tbody>
</table>

<a id="rst-description-14"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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.

<a id="rst-return-value-8"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-get-status"></a>

### AUDIO_GET_STATUS

<a id="rst-synopsis-15"></a>

#### Synopsis





<a id="c-AUDIO_GET_STATUS"></a>

```c
AUDIO_GET_STATUS
```



```c
int ioctl(int fd, int request = AUDIO_GET_STATUS,
struct audio_status *status)
```

<a id="rst-arguments-9"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals AUDIO_GET_STATUS for this command.

</td>
</tr>
<tr>
<td>


`struct` [audio_status](<#rst-audio-status>) `*status`

</td>
<td colspan="2">


Returns the current state of Audio Device.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-15"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl call asks the Audio Device to return the current state of the Audio Device.

<a id="rst-return-value-9"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-get-capabilities"></a>

### AUDIO_GET_CAPABILITIES

<a id="rst-synopsis-16"></a>

#### Synopsis





<a id="c-AUDIO_GET_CAPABILITIES"></a>

```c
AUDIO_GET_CAPABILITIES
```



```c
int ioctl(int fd, int request = AUDIO_GET_CAPABILITIES,
unsigned int *cap)
```

<a id="rst-arguments-10"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `AUDIO_GET_CAPABILITIES` for this command.

</td>
</tr>
<tr>
<td>


`unsigned int *cap`

</td>
<td colspan="2">


Returns a bit array of supported sound formats. Bits are defined in [audio encodings](<#rst-audio-encodings>).

</td>
</tr>
</tbody>
</table>

<a id="rst-description-16"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl call asks the Audio Device to tell us about the decoding capabilities of the audio hardware.

<a id="rst-return-value-10"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-clear-buffer"></a>

### AUDIO_CLEAR_BUFFER

<a id="rst-synopsis-17"></a>

#### Synopsis





<a id="c-AUDIO_CLEAR_BUFFER"></a>

```c
AUDIO_CLEAR_BUFFER
```



```c
int  ioctl(int fd, int request = AUDIO_CLEAR_BUFFER)
```

<a id="rst-arguments-11"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `AUDIO_CLEAR_BUFFER` for this command.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-17"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl call asks the Audio Device to clear all software and hardware buffers of the audio decoder device.

<a id="rst-return-value-11"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-set-id"></a>

### AUDIO_SET_ID

<a id="rst-synopsis-18"></a>

#### Synopsis





<a id="c-AUDIO_SET_ID"></a>

```c
AUDIO_SET_ID
```



```c
int  ioctl(int fd, int request = AUDIO_SET_ID, int id)
```

<a id="rst-arguments-12"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `AUDIO_SET_ID` for this command.

</td>
</tr>
<tr>
<td>


`int id`

</td>
<td colspan="2">


Audio sub-stream id.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-18"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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](<#rst-audio-set-streamtype>), specifies the id just the sub-stream id of the audio stream and only the first 5 bits (&amp; 0x1F) are recognized.

<a id="rst-return-value-12"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-set-mixer"></a>

### AUDIO_SET_MIXER

<a id="rst-synopsis-19"></a>

#### Synopsis





<a id="c-AUDIO_SET_MIXER"></a>

```c
AUDIO_SET_MIXER
```



```c
int ioctl(int fd, int request = AUDIO_SET_MIXER, audio_mixer_t *mix)
```

<a id="rst-arguments-13"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `AUDIO_SET_MIXER` for this command.

</td>
</tr>
<tr>
<td>


`audio_mixer_t *mix`

</td>
<td colspan="2">


Mixer settings.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-19"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl lets you adjust the mixer settings of the audio decoder.

<a id="rst-return-value-13"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-audio-set-streamtype"></a>

### AUDIO_SET_STREAMTYPE

<a id="rst-synopsis-20"></a>

#### Synopsis





<a id="c-AUDIO_SET_STREAMTYPE"></a>

```c
AUDIO_SET_STREAMTYPE
```



```c
int  ioctl(fd, int request = AUDIO_SET_STREAMTYPE, int type)
```

<a id="rst-arguments-14"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `AUDIO_SET_STREAMTYPE` for this command.

</td>
</tr>
<tr>
<td>


`int type`

</td>
<td colspan="2">


Stream type.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-20"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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.

<a id="rst-return-value-14"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.


<table>
<tbody>
<tr>
<td>


`EINVAL`

</td>
<td>


Type is not a valid or supported stream type.

</td>
</tr>
</tbody>
</table>

---

<a id="rst-audio-bilingual-channel-select"></a>

### AUDIO_BILINGUAL_CHANNEL_SELECT

<a id="rst-synopsis-21"></a>

#### Synopsis





<a id="c-AUDIO_BILINGUAL_CHANNEL_SELECT"></a>

```c
AUDIO_BILINGUAL_CHANNEL_SELECT
```



```c
int ioctl(int fd, int request = AUDIO_BILINGUAL_CHANNEL_SELECT,
audio_channel_select_t)
```

<a id="rst-arguments-15"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `AUDIO_BILINGUAL_CHANNEL_SELECT` for this command.

</td>
</tr>
<tr>
<td>


`audio_channel_select_t ch`

</td>
<td colspan="2">


Select the output format of the audio (mono left/right, stereo).

</td>
</tr>
</tbody>
</table>

<a id="rst-description-21"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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.

<a id="rst-return-value-15"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-open"></a>

### open()

<a id="rst-synopsis-22"></a>

#### Synopsis



```c
#include <fcntl.h>
```





<a id="c-open"></a>

```c
int  open(const char *deviceName, int flags)
```

<a id="rst-arguments-16"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`const char *deviceName`

</td>
<td colspan="2">


Name of specific audio device.

</td>
</tr>
<tr>
<td rowspan="4">


 `int flags`

</td>
<td colspan="2">


 A bit-wise OR of the following flags:

</td>
</tr>
<tr>
<td>


`O_RDONLY`

</td>
<td>


read-only access

</td>
</tr>
<tr>
<td>


`O_RDWR`

</td>
<td>


read/write access

</td>
</tr>
<tr>
<td>


`O_NONBLOCK`

</td>
<td>


Open in non-blocking mode  
(blocking mode is the default)

</td>
</tr>
</tbody>
</table>

<a id="rst-description-22"></a>

#### 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](<#rst-audio-get-status>). All other call will return with an error code.

<a id="rst-return-value-16"></a>

#### Return Value


<table>
<tbody>
<tr>
<td>


`ENODEV`

</td>
<td>


Device driver not loaded/available.

</td>
</tr>
<tr>
<td>


`EBUSY`

</td>
<td>


Device or resource busy.

</td>
</tr>
<tr>
<td>


`EINVAL`

</td>
<td>


Invalid argument.

</td>
</tr>
</tbody>
</table>

---

<a id="rst-close"></a>

### close()

<a id="rst-synopsis-23"></a>

#### Synopsis





<a id="c-close"></a>

```c
int close(int fd)
```

<a id="rst-arguments-17"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
</tbody>
</table>

<a id="rst-description-23"></a>

#### Description

This system call closes a previously opened audio device.

<a id="rst-return-value-17"></a>

#### Return Value


<table>
<tbody>
<tr>
<td>


`EBADF`

</td>
<td>


Fd is not a valid open file descriptor.

</td>
</tr>
</tbody>
</table>

---

<a id="rst-write"></a>

### write()

<a id="rst-synopsis-24"></a>

#### Synopsis



```c
size_t write(int fd, const void *buf, size_t count)
```

<a id="rst-arguments-18"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`void *buf`

</td>
<td colspan="2">


Pointer to the buffer containing the PES data.

</td>
</tr>
<tr>
<td>


`size_t count`

</td>
<td colspan="2">


Size of buf.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-24"></a>

#### Description

This system call can only be used if `AUDIO_SOURCE_MEMORY` is selected in the ioctl call [AUDIO_SELECT_SOURCE](<#rst-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.

<a id="rst-return-value-18"></a>

#### Return Value


<table>
<tbody>
<tr>
<td>


`EPERM`

</td>
<td colspan="2">


 Mode `AUDIO_SOURCE_MEMORY` not selected.

</td>
</tr>
<tr>
<td>


`ENOMEM`

</td>
<td colspan="2">


Attempted to write more data than the internal buffer can hold.

</td>
</tr>
<tr>
<td>


`EBADF`

</td>
<td colspan="2">


Fd is not a valid open file descriptor.

</td>
</tr>
</tbody>
</table>

---

# Legacy DVB MPEG Decoder APIs

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> This API has originally been designed for DVB only and is therefore limited to the legacy_dvb_decoder_formats used in such digital TV-broadcastsystems.

<a id="rst-legacy-dvb-mpeg-decoder-apis"></a>
<a id="rst-legacy-dvb-decoder-api"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later OR GPL-2.0 -->

<a id="rst-general-notes"></a>
<a id="rst-legacy-dvb-decoder-notes"></a>

## General Notes

This API has originally been designed for DVB only and is therefore limited to the [Data Formats](<#rst-legacy-dvb-decoder-formats>) used in such digital TV-broadcastsystems.

To circumvent this limitations the more versatile [V4L2](</kernel/userspace/userspace-api/media-v4l/v4l2.md#rst-v4l2spec>) 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.

> [!NOTE]
>
> Do **not** use this API in new drivers\!
>
> For audio and video use the [V4L2](</kernel/userspace/userspace-api/media-v4l/v4l2.md#rst-v4l2spec>) and ALSA APIs.
>
> Pipelines should be set up using the [Media Controller API](</kernel/userspace/userspace-api/media-mediactl/media-controller.md#rst-media-controller>).

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.

<a id="rst-data-formats"></a>
<a id="rst-legacy-dvb-decoder-formats"></a>

## 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.

<a id="rst-table-of-contents"></a>

## Table of Contents

- [DVB Video Device](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-video.md>)
- [DVB Audio Device](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-audio.md>)
- [DVB OSD Device](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-osd.md>)

---

# 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…

<a id="rst-dvb-osd-device"></a>
<a id="rst-dvb-osd"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later OR GPL-2.0 -->

<!-- c:namespace: dtv.legacy.osd -->

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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](<#rst-osd-get-capability>) ioctl.

<a id="rst-osd-data-types"></a>

## OSD Data Types

<a id="rst-osd-command"></a>

### OSD_Command

<a id="rst-synopsis"></a>

#### Synopsis



```c
typedef enum {
    /* All functions return -2 on "not open" */
    OSD_Close = 1,
    OSD_Open,
    OSD_Show,
    OSD_Hide,
    OSD_Clear,
    OSD_Fill,
    OSD_SetColor,
    OSD_SetPalette,
    OSD_SetTrans,
    OSD_SetPixel,
    OSD_GetPixel,
    OSD_SetRow,
    OSD_SetBlock,
    OSD_FillRow,
    OSD_FillBlock,
    OSD_Line,
    OSD_Query,
    OSD_Test,
    OSD_Text,
    OSD_SetWindow,
    OSD_MoveWindow,
    OSD_OpenRaw,
} OSD_Command;
```

<a id="rst-commands"></a>

#### Commands

> [!NOTE]
>
> All functions return -2 on "not open"


<table>
<thead>
<tr>
<th>


Command

</th>
<th>


Used variables of `struct` [osd_cmd_t](<#rst-osd-cmd-t>).  
Usage\{variable\} if alternative use.

</th>
<th colspan="3">


 Description

</th>
</tr>
</thead>
<tbody>
<tr>
<td>


`OSD_Close`

</td>
<td>


- <!-- empty source list item -->

</td>
<td colspan="3">


Disables OSD and releases the buffers.  
Returns 0 on success.

</td>
</tr>
<tr>
<td>


`OSD_Open`

</td>
<td>


x0,y0,x1,y1,  
BitPerPixel\[2/4/8\]\{color&amp;0x0F\},  
mix\[0..15\]\{color&amp;0xF0\}

</td>
<td colspan="3">


Opens OSD with this size and bit depth  
Returns 0 on success,  
-1 on DRAM allocation error,  
-2 on "already open".

</td>
</tr>
<tr>
<td>


`OSD_Show`

</td>
<td>


- <!-- empty source list item -->

</td>
<td colspan="3">


Enables OSD mode.  
Returns 0 on success.

</td>
</tr>
<tr>
<td>


`OSD_Hide`

</td>
<td>


- <!-- empty source list item -->

</td>
<td colspan="3">


Disables OSD mode.  
Returns 0 on success.

</td>
</tr>
<tr>
<td>


`OSD_Clear`

</td>
<td>


- <!-- empty source list item -->

</td>
<td colspan="3">


Sets all pixel to color 0.  
Returns 0 on success.

</td>
</tr>
<tr>
<td>


`OSD_Fill`

</td>
<td>


color

</td>
<td colspan="3">


Sets all pixel to color &lt;color&gt;.  
Returns 0 on success.

</td>
</tr>
<tr>
<td>


`OSD_SetColor`

</td>
<td>


color,  
R\{x0\},G\{y0\},B\{x1\},  
opacity\{y1\}

</td>
<td colspan="3">


Set palette entry &lt;num&gt; to &lt;r,g,b&gt;, &lt;mix&gt; and &lt;trans&gt; apply  
R,G,B: 0..255  
R=Red, G=Green, B=Blue  
opacity=0:      pixel opacity 0% (only video pixel shows)  
opacity=1..254: pixel opacity as specified in header  
opacity=255:    pixel opacity 100% (only OSD pixel shows)  
Returns 0 on success, -1 on error.

</td>
</tr>
<tr>
<td>


`OSD_SetPalette`

</td>
<td>


firstcolor\{color\},  
lastcolor\{x0\},data

</td>
<td colspan="3">


Set a number of entries in the palette.  
Sets the entries "firstcolor" through "lastcolor" from the
array "data".  
Data has 4 byte for each color:  
R,G,B, and a opacity value: 0-&gt;transparent, 1..254-&gt;mix,
255-&gt;pixel

</td>
</tr>
<tr>
<td>


`OSD_SetTrans`

</td>
<td>


transparency\{color\}

</td>
<td colspan="3">


Sets transparency of mixed pixel (0..15).  
Returns 0 on success.

</td>
</tr>
<tr>
<td>


`OSD_SetPixel`

</td>
<td>


x0,y0,color

</td>
<td colspan="3">


Sets pixel &lt;x&gt;,&lt;y&gt; to color number &lt;color&gt;.  
Returns 0 on success, -1 on error.

</td>
</tr>
<tr>
<td>


`OSD_GetPixel`

</td>
<td>


x0,y0

</td>
<td colspan="3">


Returns color number of pixel &lt;x&gt;,&lt;y&gt;,  or -1.  
Command currently not supported by the AV7110\!

</td>
</tr>
<tr>
<td>


`OSD_SetRow`

</td>
<td>


x0,y0,x1,data

</td>
<td colspan="3">


Fills pixels x0,y through  x1,y with the content of data\[\].  
Returns 0 on success, -1 on clipping all pixel (no pixel
drawn).

</td>
</tr>
<tr>
<td>


`OSD_SetBlock`

</td>
<td>


x0,y0,x1,y1,  
increment\{color\},  
data

</td>
<td colspan="3">


Fills pixels x0,y0 through  x1,y1 with the content of data\[\].  
Inc contains the width of one line in the data block,  
inc&lt;=0 uses block width as line width.  
Returns 0 on success, -1 on clipping all pixel.

</td>
</tr>
<tr>
<td>


`OSD_FillRow`

</td>
<td>


x0,y0,x1,color

</td>
<td colspan="3">


Fills pixels x0,y through  x1,y with the color &lt;color&gt;.  
Returns 0 on success, -1 on clipping all pixel.

</td>
</tr>
<tr>
<td>


`OSD_FillBlock`

</td>
<td>


x0,y0,x1,y1,color

</td>
<td colspan="3">


Fills pixels x0,y0 through  x1,y1 with the color &lt;color&gt;.  
Returns 0 on success, -1 on clipping all pixel.

</td>
</tr>
<tr>
<td>


`OSD_Line`

</td>
<td>


x0,y0,x1,y1,color

</td>
<td colspan="3">


Draw a line from x0,y0 to x1,y1 with the color &lt;color&gt;.  
Returns 0 on success.

</td>
</tr>
<tr>
<td>


`OSD_Query`

</td>
<td>


x0,y0,x1,y1,  
xasp\{color\}; yasp=11

</td>
<td colspan="3">


Fills parameters with the picture dimensions and the pixel
aspect ratio.  
Returns 0 on success.  
Command currently not supported by the AV7110\!

</td>
</tr>
<tr>
<td>


`OSD_Test`

</td>
<td>


- <!-- empty source list item -->

</td>
<td colspan="3">


Draws a test picture.  
For debugging purposes only.  
Returns 0 on success.

</td>
</tr>
<tr>
<td>


`OSD_Text`

</td>
<td>


x0,y0,size,color,text

</td>
<td colspan="3">


Draws a text at position x0,y0 with the color &lt;color&gt;.

</td>
</tr>
<tr>
<td>


`OSD_SetWindow`

</td>
<td>


x0

</td>
<td colspan="3">


Set window with number 0&lt;x0&lt;8 as current.

</td>
</tr>
<tr>
<td>


`OSD_MoveWindow`

</td>
<td>


x0,y0

</td>
<td colspan="3">


Move current window to (x0, y0).

</td>
</tr>
<tr>
<td>


`OSD_OpenRaw`

</td>
<td>


x0,y0,x1,y1,  
[osd_raw_window_t](<#rst-osd-raw-window-t>) \{color\}

</td>
<td colspan="3">


Open other types of OSD windows.

</td>
</tr>
</tbody>
</table>

<a id="rst-description"></a>

#### Description

The `OSD_Command` data type is used with the [OSD_SEND_CMD](<#rst-osd-send-cmd>) ioctl to tell the driver which OSD_Command to execute.

---

<a id="rst-osd-cmd-t"></a>

### osd_cmd_t

<a id="rst-synopsis-1"></a>

#### Synopsis



```c
typedef struct osd_cmd_s {
    OSD_Command cmd;
    int x0;
    int y0;
    int x1;
    int y1;
    int color;
    void __user *data;
} osd_cmd_t;
```

<a id="rst-variables"></a>

#### Variables


<table>
<tbody>
<tr>
<td>


`OSD_Command cmd`

</td>
<td>


[OSD_Command](<#rst-osd-command>) to be executed.

</td>
</tr>
<tr>
<td>


`int x0`

</td>
<td>


First horizontal position.

</td>
</tr>
<tr>
<td>


`int y0`

</td>
<td>


First vertical position.

</td>
</tr>
<tr>
<td>


`int x1`

</td>
<td>


Second horizontal position.

</td>
</tr>
<tr>
<td>


`int y1`

</td>
<td>


Second vertical position.

</td>
</tr>
<tr>
<td>


`int color`

</td>
<td>


Number of the color in the palette.

</td>
</tr>
<tr>
<td>


`void __user *data`

</td>
<td>


Command specific Data.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-1"></a>

#### Description

The `osd_cmd_t` data type is used with the [OSD_SEND_CMD](<#rst-osd-send-cmd>) ioctl. It contains the data for the OSD_Command and the [OSD_Command](<#rst-osd-command>) itself. The structure has to be passed to the driver and the components may be modified by it.

---

<a id="rst-osd-raw-window-t"></a>

### osd_raw_window_t

<a id="rst-synopsis-2"></a>

#### Synopsis



```c
typedef enum {
    OSD_BITMAP1,
    OSD_BITMAP2,
    OSD_BITMAP4,
    OSD_BITMAP8,
    OSD_BITMAP1HR,
    OSD_BITMAP2HR,
    OSD_BITMAP4HR,
    OSD_BITMAP8HR,
    OSD_YCRCB422,
    OSD_YCRCB444,
    OSD_YCRCB444HR,
    OSD_VIDEOTSIZE,
    OSD_VIDEOHSIZE,
    OSD_VIDEOQSIZE,
    OSD_VIDEODSIZE,
    OSD_VIDEOTHSIZE,
    OSD_VIDEOTQSIZE,
    OSD_VIDEOTDSIZE,
    OSD_VIDEONSIZE,
    OSD_CURSOR
} osd_raw_window_t;
```

<a id="rst-constants"></a>

#### Constants


<table>
<tbody>
<tr>
<td>


`OSD_BITMAP1`

</td>
<td colspan="2">


 1 bit bitmap

</td>
</tr>
<tr>
<td>


`OSD_BITMAP2`

</td>
<td colspan="2">


2 bit bitmap

</td>
</tr>
<tr>
<td>


`OSD_BITMAP4`

</td>
<td colspan="2">


4 bit bitmap

</td>
</tr>
<tr>
<td>


`OSD_BITMAP8`

</td>
<td colspan="2">


8 bit bitmap

</td>
</tr>
<tr>
<td>


`OSD_BITMAP1HR`

</td>
<td colspan="2">


1 Bit bitmap half resolution

</td>
</tr>
<tr>
<td>


`OSD_BITMAP2HR`

</td>
<td colspan="2">


2 Bit bitmap half resolution

</td>
</tr>
<tr>
<td>


`OSD_BITMAP4HR`

</td>
<td colspan="2">


4 Bit bitmap half resolution

</td>
</tr>
<tr>
<td>


`OSD_BITMAP8HR`

</td>
<td colspan="2">


8 Bit bitmap half resolution

</td>
</tr>
<tr>
<td>


`OSD_YCRCB422`

</td>
<td colspan="2">


4:2:2 YCRCB Graphic Display

</td>
</tr>
<tr>
<td>


`OSD_YCRCB444`

</td>
<td colspan="2">


4:4:4 YCRCB Graphic Display

</td>
</tr>
<tr>
<td>


`OSD_YCRCB444HR`

</td>
<td colspan="2">


4:4:4 YCRCB graphic half resolution

</td>
</tr>
<tr>
<td>


`OSD_VIDEOTSIZE`

</td>
<td colspan="2">


True Size Normal MPEG Video Display

</td>
</tr>
<tr>
<td>


`OSD_VIDEOHSIZE`

</td>
<td colspan="2">


MPEG Video Display Half Resolution

</td>
</tr>
<tr>
<td>


`OSD_VIDEOQSIZE`

</td>
<td colspan="2">


MPEG Video Display Quarter Resolution

</td>
</tr>
<tr>
<td>


`OSD_VIDEODSIZE`

</td>
<td colspan="2">


MPEG Video Display Double Resolution

</td>
</tr>
<tr>
<td>


`OSD_VIDEOTHSIZE`

</td>
<td colspan="2">


True Size MPEG Video Display Half Resolution

</td>
</tr>
<tr>
<td>


`OSD_VIDEOTQSIZE`

</td>
<td colspan="2">


True Size MPEG Video Display Quarter Resolution

</td>
</tr>
<tr>
<td>


`OSD_VIDEOTDSIZE`

</td>
<td colspan="2">


True Size MPEG Video Display Double Resolution

</td>
</tr>
<tr>
<td>


`OSD_VIDEONSIZE`

</td>
<td colspan="2">


Full Size MPEG Video Display

</td>
</tr>
<tr>
<td>


`OSD_CURSOR`

</td>
<td colspan="2">


Cursor

</td>
</tr>
</tbody>
</table>

<a id="rst-description-2"></a>

#### Description

The `osd_raw_window_t` data type is used with the [OSD_Command](<#rst-osd-command>) OSD_OpenRaw to tell the driver which type of OSD to open.

---

<a id="rst-osd-cap-t"></a>

### osd_cap_t

<a id="rst-synopsis-3"></a>

#### Synopsis



```c
typedef struct osd_cap_s {
    int  cmd;
#define OSD_CAP_MEMSIZE         1
    long val;
} osd_cap_t;
```

<a id="rst-variables-1"></a>

#### Variables


<table>
<tbody>
<tr>
<td>


`int  cmd`

</td>
<td>


Capability to query.

</td>
</tr>
<tr>
<td>


`long val`

</td>
<td>


Used to store the Data.

</td>
</tr>
</tbody>
</table>

<a id="rst-supported-capabilities"></a>

#### Supported capabilities


<table>
<tbody>
<tr>
<td>


`OSD_CAP_MEMSIZE`

</td>
<td>


Memory size installed on the card.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-3"></a>

#### Description

This structure of data used with the [OSD_GET_CAPABILITY](<#rst-osd-get-capability>) call.

---

<a id="rst-osd-function-calls"></a>

## OSD Function Calls

<a id="rst-osd-send-cmd"></a>

### OSD_SEND_CMD

<a id="rst-synopsis-4"></a>

#### Synopsis





<a id="c-OSD_SEND_CMD"></a>

```c
OSD_SEND_CMD
```



```c
int ioctl(int fd, int request = OSD_SEND_CMD, enum osd_cmd_t *cmd)
```

<a id="rst-arguments"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Pointer to the location of the structure [osd_cmd_t](<#rst-osd-cmd-t>) for this command.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-4"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl sends the [OSD_Command](<#rst-osd-command>) to the card.

<a id="rst-return-value"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.


<table>
<tbody>
<tr>
<td>


`EINVAL`

</td>
<td>


Command is out of range.

</td>
</tr>
</tbody>
</table>

---

<a id="rst-osd-get-capability"></a>

### OSD_GET_CAPABILITY

<a id="rst-synopsis-5"></a>

#### Synopsis





<a id="c-OSD_GET_CAPABILITY"></a>

```c
OSD_GET_CAPABILITY
```



```c
int ioctl(int fd, int request = OSD_GET_CAPABILITY,
struct osd_cap_t *cap)
```

<a id="rst-arguments-1"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `OSD_GET_CAPABILITY` for this command.

</td>
</tr>
<tr>
<td>


`unsigned int *cap`

</td>
<td colspan="2">


Pointer to the location of the structure [osd_cap_t](<#rst-osd-cap-t>) for this command.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-5"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl is used to get the capabilities of the OSD of the AV7110 based DVB-decoder-card in use.

> [!NOTE]
>
> The structure osd_cap_t has to be setup by the user and passed to the driver.

<a id="rst-return-value-1"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.


<table>
<tbody>
<tr>
<td>


`EINVAL`

</td>
<td>


Unsupported capability.

</td>
</tr>
</tbody>
</table>

---

<a id="rst-open"></a>

### open()

<a id="rst-synopsis-6"></a>

#### Synopsis



```c
#include <fcntl.h>
```





<a id="c-open"></a>

```c
int open(const char *deviceName, int flags)
```

<a id="rst-arguments-2"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`const char *deviceName`

</td>
<td colspan="2">


Name of specific OSD device.

</td>
</tr>
<tr>
<td rowspan="4">


 `int flags`

</td>
<td colspan="2">


 A bit-wise OR of the following flags:

</td>
</tr>
<tr>
<td>


`O_RDONLY`

</td>
<td>


read-only access

</td>
</tr>
<tr>
<td>


`O_RDWR`

</td>
<td>


read/write access

</td>
</tr>
<tr>
<td>


`O_NONBLOCK`

</td>
<td>


Open in non-blocking mode  
(blocking mode is the default)

</td>
</tr>
</tbody>
</table>

<a id="rst-description-6"></a>

#### Description

This system call opens a named OSD device (e.g. `/dev/dvb/adapter?/osd0`) for subsequent use.

<a id="rst-return-value-2"></a>

#### Return Value


<table>
<tbody>
<tr>
<td>


`ENODEV`

</td>
<td>


Device driver not loaded/available.

</td>
</tr>
<tr>
<td>


`EINTERNAL`

</td>
<td>


Internal error.

</td>
</tr>
<tr>
<td>


`EBUSY`

</td>
<td>


Device or resource busy.

</td>
</tr>
<tr>
<td>


`EINVAL`

</td>
<td>


Invalid argument.

</td>
</tr>
</tbody>
</table>

---

<a id="rst-close"></a>

### close()

<a id="rst-synopsis-7"></a>

#### Synopsis





<a id="c-close"></a>

```c
int close(int fd)
```

<a id="rst-arguments-3"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>) .

</td>
</tr>
</tbody>
</table>

<a id="rst-description-7"></a>

#### Description

This system call closes a previously opened OSD device.

<a id="rst-return-value-3"></a>

#### Return Value


<table>
<tbody>
<tr>
<td>


`EBADF`

</td>
<td>


fd is not a valid open file descriptor.

</td>
</tr>
</tbody>
</table>

---

# 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.

<a id="rst-dvb-video-device"></a>
<a id="rst-dvb-video"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later OR GPL-2.0 -->

<!-- c:namespace: dtv.legacy.video -->

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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](</kernel/userspace/userspace-api/media-v4l/video.md#rst-video>) for new drivers\!

<a id="rst-video-data-types"></a>

## Video Data Types

<a id="rst-video-format-t"></a>

### video_format_t

<a id="rst-synopsis"></a>

#### Synopsis



```c
typedef enum {
    VIDEO_FORMAT_4_3,
    VIDEO_FORMAT_16_9,
    VIDEO_FORMAT_221_1
} video_format_t;
```

<a id="rst-constants"></a>

#### Constants


<table>
<tbody>
<tr>
<td>


`VIDEO_FORMAT_4_3`

</td>
<td>


Select 4:3 format.

</td>
</tr>
<tr>
<td>


`VIDEO_FORMAT_16_9`

</td>
<td>


Select 16:9 format.

</td>
</tr>
<tr>
<td>


`VIDEO_FORMAT_221_1`

</td>
<td>


Select 2.21:1 format.

</td>
</tr>
</tbody>
</table>

<a id="rst-description"></a>

#### Description

The `video_format_t` data type is used in the [VIDEO_SET_FORMAT](<#rst-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](<#rst-video-status>) returned by [VIDEO_GET_STATUS](<#rst-video-get-status>) and [video_event](<#rst-video-event>) returned by [VIDEO_GET_EVENT](<#rst-video-get-event>) which report about the display format of the current video stream.

---

<a id="rst-video-displayformat-t"></a>

### video_displayformat_t

<a id="rst-synopsis-1"></a>

#### Synopsis



```c
typedef enum {
    VIDEO_PAN_SCAN,
    VIDEO_LETTER_BOX,
    VIDEO_CENTER_CUT_OUT
} video_displayformat_t;
```

<a id="rst-constants-1"></a>

#### Constants


<table>
<tbody>
<tr>
<td>


`VIDEO_PAN_SCAN`

</td>
<td>


Use pan and scan format.

</td>
</tr>
<tr>
<td>


`VIDEO_LETTER_BOX`

</td>
<td>


Use letterbox format.

</td>
</tr>
<tr>
<td>


`VIDEO_CENTER_CUT_OUT`

</td>
<td>


Use center cut out format.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-1"></a>

#### 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](<#rst-video-set-display-format>) call which accepts this enum as argument.

---

<a id="rst-video-size-t"></a>

### video_size_t

<a id="rst-synopsis-2"></a>

#### Synopsis



```c
typedef struct {
    int w;
    int h;
    video_format_t aspect_ratio;
} video_size_t;
```

<a id="rst-variables"></a>

#### Variables


<table>
<tbody>
<tr>
<td>


`int w`

</td>
<td>


Video width in pixels.

</td>
</tr>
<tr>
<td>


`int h`

</td>
<td>


Video height in pixels.

</td>
</tr>
<tr>
<td>


[video_format_t](<#rst-video-format-t>) `aspect_ratio`

</td>
<td>


Aspect ratio.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-2"></a>

#### Description

Used in the struct [video_event](<#rst-video-event>). It stores the resolution and aspect ratio of the video.

---

<a id="rst-video-stream-source-t"></a>

### video_stream_source_t

<a id="rst-synopsis-3"></a>

#### Synopsis



```c
typedef enum {
    VIDEO_SOURCE_DEMUX,
    VIDEO_SOURCE_MEMORY
} video_stream_source_t;
```

<a id="rst-constants-2"></a>

#### Constants


<table>
<tbody>
<tr>
<td>


`VIDEO_SOURCE_DEMUX`

</td>
<td colspan="2">


 Select the demux as the main source.

</td>
</tr>
<tr>
<td>


`VIDEO_SOURCE_MEMORY`

</td>
<td colspan="2">


If this source is selected, the stream comes from the user through the write system call.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-3"></a>

#### Description

The video stream source is set through the [VIDEO_SELECT_SOURCE](<#rst-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()](<#rst-write>) system call.

---

<a id="rst-video-play-state-t"></a>

### video_play_state_t

<a id="rst-synopsis-4"></a>

#### Synopsis



```c
typedef enum {
    VIDEO_STOPPED,
    VIDEO_PLAYING,
    VIDEO_FREEZED
} video_play_state_t;
```

<a id="rst-constants-3"></a>

#### Constants


<table>
<tbody>
<tr>
<td>


`VIDEO_STOPPED`

</td>
<td>


Video is stopped.

</td>
</tr>
<tr>
<td>


`VIDEO_PLAYING`

</td>
<td>


Video is currently playing.

</td>
</tr>
<tr>
<td>


`VIDEO_FREEZED`

</td>
<td>


Video is frozen.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-4"></a>

#### Description

This values can be returned by the [VIDEO_GET_STATUS](<#rst-video-get-status>) call representing the state of video playback.

---

<a id="rst-struct-video-command"></a>

### struct video_command

<a id="rst-synopsis-5"></a>

#### Synopsis



```c
struct video_command {
    __u32 cmd;
    __u32 flags;
    union {
        struct {
            __u64 pts;
        } stop;

        struct {
            __s32 speed;
            __u32 format;
        } play;

        struct {
            __u32 data[16];
        } raw;
    };
};
```

<a id="rst-variables-1"></a>

#### Variables


<table>
<tbody>
<tr>
<td>


`__u32 cmd`

</td>
<td colspan="2">


[Decoder command](<#rst-decoder-command>)

</td>
</tr>
<tr>
<td>


`__u32 flags`

</td>
<td colspan="2">


Flags for the [Decoder command](<#rst-decoder-command>).

</td>
</tr>
<tr>
<td>


`struct stop`

</td>
<td>


`__u64 pts`

</td>
<td>


MPEG PTS

</td>
</tr>
<tr>
<td rowspan="6">


 `stuct play`

</td>
<td rowspan="5">


 `__s32 speed`

</td>
<td>


0 or 1000 specifies normal speed,

</td>
</tr>
<tr>
<td>


1:  specifies forward single stepping,

</td>
</tr>
<tr>
<td>


-1: specifies backward single stepping,

</td>
</tr>
<tr>
<td>


&gt;1: playback at speed / 1000 of the normal speed

</td>
</tr>
<tr>
<td>


&lt;-1: reverse playback at ( -speed / 1000 ) of the normal speed.

</td>
</tr>
<tr>
<td>


`__u32 format`

</td>
<td>


[Play input formats](<#rst-play-input-formats>)

</td>
</tr>
<tr>
<td>


`__u32 data[16]`

</td>
<td colspan="2">


Reserved

</td>
</tr>
</tbody>
</table>

<a id="rst-description-5"></a>

#### Description

The structure must be zeroed before use by the application. This ensures it can be extended safely in the future.

---

<a id="rst-predefined-decoder-commands-and-flags"></a>

### Predefined decoder commands and flags

<a id="rst-synopsis-6"></a>

#### Synopsis



```c
#define VIDEO_CMD_PLAY                      (0)
#define VIDEO_CMD_STOP                      (1)
#define VIDEO_CMD_FREEZE                    (2)
#define VIDEO_CMD_CONTINUE                  (3)

#define VIDEO_CMD_FREEZE_TO_BLACK      (1 << 0)

#define VIDEO_CMD_STOP_TO_BLACK        (1 << 0)
#define VIDEO_CMD_STOP_IMMEDIATELY     (1 << 1)

#define VIDEO_PLAY_FMT_NONE                 (0)
#define VIDEO_PLAY_FMT_GOP                  (1)

#define VIDEO_VSYNC_FIELD_UNKNOWN           (0)
#define VIDEO_VSYNC_FIELD_ODD               (1)
#define VIDEO_VSYNC_FIELD_EVEN              (2)
#define VIDEO_VSYNC_FIELD_PROGRESSIVE       (3)
```

<a id="rst-constants-4"></a>

#### Constants


<table>
<tbody>
<tr>
<td rowspan="4">


 <a id="rst-decoder-command"></a>

</td>
<td>


`VIDEO_CMD_PLAY`

</td>
<td>


Start playback.

</td>
</tr>
<tr>
<td>


`VIDEO_CMD_STOP`

</td>
<td>


Stop playback.

</td>
</tr>
<tr>
<td>


`VIDEO_CMD_FREEZE`

</td>
<td>


Freeze playback.

</td>
</tr>
<tr>
<td>


`VIDEO_CMD_CONTINUE`

</td>
<td>


Continue playback after freeze.

</td>
</tr>
<tr>
<td>


Flags for `VIDEO_CMD_FREEZE`

</td>
<td>


`VIDEO_CMD_FREEZE_TO_BLACK`

</td>
<td>


Show black picture on freeze.

</td>
</tr>
<tr>
<td rowspan="2">


 Flags for `VIDEO_CMD_STOP`

</td>
<td>


`VIDEO_CMD_STOP_TO_BLACK`

</td>
<td>


Show black picture on stop.

</td>
</tr>
<tr>
<td>


`VIDEO_CMD_STOP_IMMEDIATELY`

</td>
<td>


Stop immediately, without emptying buffers.

</td>
</tr>
<tr>
<td rowspan="2">


 <a id="rst-play-input-formats"></a>

</td>
<td>


`VIDEO_PLAY_FMT_NONE`

</td>
<td>


The decoder has no special format requirements

</td>
</tr>
<tr>
<td>


`VIDEO_PLAY_FMT_GOP`

</td>
<td>


The decoder requires full GOPs

</td>
</tr>
<tr>
<td rowspan="4">


 Field order

</td>
<td>


`VIDEO_VSYNC_FIELD_UNKNOWN`

</td>
<td>


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.

</td>
</tr>
<tr>
<td>


`VIDEO_VSYNC_FIELD_ODD`

</td>
<td>


Vsync is for an odd field.

</td>
</tr>
<tr>
<td>


`VIDEO_VSYNC_FIELD_EVEN`

</td>
<td>


Vsync is for an even field.

</td>
</tr>
<tr>
<td>


`VIDEO_VSYNC_FIELD_PROGRESSIVE`

</td>
<td>


progressive (i.e. non-interlaced)

</td>
</tr>
</tbody>
</table>

---

<a id="rst-video-event"></a>

### video_event

<a id="rst-synopsis-7"></a>

#### Synopsis



```c
struct video_event {
    __s32 type;
#define VIDEO_EVENT_SIZE_CHANGED        1
#define VIDEO_EVENT_FRAME_RATE_CHANGED  2
#define VIDEO_EVENT_DECODER_STOPPED     3
#define VIDEO_EVENT_VSYNC               4
    long timestamp;
    union {
        video_size_t size;
        unsigned int frame_rate;
        unsigned char vsync_field;
    } u;
};
```

<a id="rst-variables-2"></a>

#### Variables


<table>
<tbody>
<tr>
<td rowspan="5">


 `__s32 type`

</td>
<td colspan="2">


 Event type.

</td>
</tr>
<tr>
<td>


`VIDEO_EVENT_SIZE_CHANGED`

</td>
<td>


Size changed.

</td>
</tr>
<tr>
<td>


`VIDEO_EVENT_FRAME_RATE_CHANGED`

</td>
<td>


Framerate changed.

</td>
</tr>
<tr>
<td>


`VIDEO_EVENT_DECODER_STOPPED`

</td>
<td>


Decoder stopped.

</td>
</tr>
<tr>
<td>


`VIDEO_EVENT_VSYNC`

</td>
<td>


Vsync occurred.

</td>
</tr>
<tr>
<td>


`long timestamp`

</td>
<td colspan="2">


 MPEG PTS at occurrence.

</td>
</tr>
<tr>
<td rowspan="3">


 `union u`

</td>
<td>


[video_size_t](<#rst-video-size-t>) size

</td>
<td>


Resolution and aspect ratio of the video.

</td>
</tr>
<tr>
<td>


`unsigned int frame_rate`

</td>
<td>


in frames per 1000sec

</td>
</tr>
<tr>
<td>


`unsigned char vsync_field`

</td>
<td>


unknown / odd / even / progressive  
See: [Predefined decoder commands and flags](<#rst-predefined-decoder-commands-and-flags>)

</td>
</tr>
</tbody>
</table>

<a id="rst-description-6"></a>

#### Description

This is the structure of a video event as it is returned by the [VIDEO_GET_EVENT](<#rst-video-get-event>) call. See there for more details.

---

<a id="rst-video-status"></a>

### video_status

<a id="rst-synopsis-8"></a>

#### Synopsis

The [VIDEO_GET_STATUS](<#rst-video-get-status>) call returns the following structure informing about various states of the playback operation.



```c
struct video_status {
    int                    video_blank;
    video_play_state_t     play_state;
    video_stream_source_t  stream_source;
    video_format_t         video_format;
    video_displayformat_t  display_format;
};
```

<a id="rst-variables-3"></a>

#### Variables


<table>
<tbody>
<tr>
<td rowspan="3">


 `int video_blank`

</td>
<td colspan="2">


 Show blank video on freeze?

</td>
</tr>
<tr>
<td>


TRUE  ( \!= 0 )

</td>
<td>


Blank screen when freeze.

</td>
</tr>
<tr>
<td>


FALSE ( == 0 )

</td>
<td>


Show last decoded frame.

</td>
</tr>
<tr>
<td>


[video_play_state_t](<#rst-video-play-state-t>) `play_state`

</td>
<td colspan="2">


Current state of playback.

</td>
</tr>
<tr>
<td>


[video_stream_source_t](<#rst-video-stream-source-t>) `stream_source`

</td>
<td colspan="2">


Current source (demux/memory).

</td>
</tr>
<tr>
<td>


[video_format_t](<#rst-video-format-t>) `video_format`

</td>
<td colspan="2">


Current aspect ratio of stream.

</td>
</tr>
<tr>
<td>


[video_displayformat_t](<#rst-video-displayformat-t>) `display_format`

</td>
<td colspan="2">


Applied cropping mode.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-7"></a>

#### 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.

---

<a id="rst-video-still-picture"></a>

### video_still_picture

<a id="rst-synopsis-9"></a>

#### Synopsis



```c
struct video_still_picture {
char *iFrame;
int32_t size;
};
```

<a id="rst-variables-4"></a>

#### Variables


<table>
<tbody>
<tr>
<td>


`char *iFrame`

</td>
<td>


Pointer to a single iframe in memory.

</td>
</tr>
<tr>
<td>


`int32_t size`

</td>
<td>


Size of the iframe.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-8"></a>

#### Description

An I-frame displayed via the [VIDEO_STILLPICTURE](<#rst-video-stillpicture>) call is passed on within this structure.

---

<a id="rst-video-capabilities"></a>

### video capabilities

<a id="rst-synopsis-10"></a>

#### Synopsis



```c
#define VIDEO_CAP_MPEG1   1
#define VIDEO_CAP_MPEG2   2
#define VIDEO_CAP_SYS     4
#define VIDEO_CAP_PROG    8
```

<a id="rst-constants-5"></a>

#### Constants

Bit definitions for capabilities:


<table>
<tbody>
<tr>
<td>


`VIDEO_CAP_MPEG1`

</td>
<td colspan="2">


 The hardware can decode MPEG1.

</td>
</tr>
<tr>
<td>


`VIDEO_CAP_MPEG2`

</td>
<td colspan="2">


The hardware can decode MPEG2.

</td>
</tr>
<tr>
<td>


`VIDEO_CAP_SYS`

</td>
<td colspan="2">


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.

</td>
</tr>
<tr>
<td>


`VIDEO_CAP_PROG`

</td>
<td colspan="2">


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.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-9"></a>

#### Description

A call to [VIDEO_GET_CAPABILITIES](<#rst-video-get-capabilities>) returns an unsigned integer with the following bits set according to the hardware's capabilities.

---

<a id="rst-video-function-calls"></a>

## Video Function Calls

<a id="rst-video-stop"></a>

### VIDEO_STOP

<a id="rst-synopsis-11"></a>

#### Synopsis





<a id="c-VIDEO_STOP"></a>

```c
VIDEO_STOP
```



```c
int ioctl(fd, VIDEO_STOP, int mode)
```

<a id="rst-arguments"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


 Equals `VIDEO_STOP` for this command.

</td>
</tr>
<tr>
<td rowspan="3">


 `int mode`

</td>
<td colspan="2">


 Indicates how the screen shall be handled.

</td>
</tr>
<tr>
<td>


TRUE  ( \!= 0 )

</td>
<td>


Blank screen when stop.

</td>
</tr>
<tr>
<td>


FALSE ( == 0 )

</td>
<td>


Show last decoded frame.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-10"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl is for Digital TV devices only. To control a V4L2 decoder use the V4L2 [ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD](</kernel/userspace/userspace-api/media-v4l/vidioc-decoder-cmd.md#rst-vidioc-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.

<a id="rst-return-value"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-play"></a>

### VIDEO_PLAY

<a id="rst-synopsis-12"></a>

#### Synopsis





<a id="c-VIDEO_PLAY"></a>

```c
VIDEO_PLAY
```



```c
int ioctl(fd, VIDEO_PLAY)
```

<a id="rst-arguments-1"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_PLAY` for this command.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-11"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl is for Digital TV devices only. To control a V4L2 decoder use the V4L2 [ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD](</kernel/userspace/userspace-api/media-v4l/vidioc-decoder-cmd.md#rst-vidioc-decoder-cmd>) instead.

This ioctl call asks the Video Device to start playing a video stream from the selected source.

<a id="rst-return-value-1"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-freeze"></a>

### VIDEO_FREEZE

<a id="rst-synopsis-13"></a>

#### Synopsis





<a id="c-VIDEO_FREEZE"></a>

```c
VIDEO_FREEZE
```



```c
int ioctl(fd, VIDEO_FREEZE)
```

<a id="rst-arguments-2"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_FREEZE` for this command.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-12"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl is for Digital TV devices only. To control a V4L2 decoder use the V4L2 [ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD](</kernel/userspace/userspace-api/media-v4l/vidioc-decoder-cmd.md#rst-vidioc-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](<#rst-video-continue>) command. If VIDEO_SOURCE_MEMORY is selected in the ioctl call [VIDEO_SELECT_SOURCE](<#rst-video-select-source>), the Digital TV subsystem will not decode any more data until the ioctl call [VIDEO_CONTINUE](<#rst-video-continue>) or [VIDEO_PLAY](<#rst-video-play>) is performed.

<a id="rst-return-value-2"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-continue"></a>

### VIDEO_CONTINUE

<a id="rst-synopsis-14"></a>

#### Synopsis





<a id="c-VIDEO_CONTINUE"></a>

```c
VIDEO_CONTINUE
```



```c
int ioctl(fd, VIDEO_CONTINUE)
```

<a id="rst-arguments-3"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_CONTINUE` for this command.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-13"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl is for Digital TV devices only. To control a V4L2 decoder use the V4L2 [ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD](</kernel/userspace/userspace-api/media-v4l/vidioc-decoder-cmd.md#rst-vidioc-decoder-cmd>) instead.

This ioctl call restarts decoding and playing processes of the video stream which was played before a call to [VIDEO_FREEZE](<#rst-video-freeze>) was made.

<a id="rst-return-value-3"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-select-source"></a>

### VIDEO_SELECT_SOURCE

<a id="rst-synopsis-15"></a>

#### Synopsis





<a id="c-VIDEO_SELECT_SOURCE"></a>

```c
VIDEO_SELECT_SOURCE
```



```c
int ioctl(fd, VIDEO_SELECT_SOURCE, video_stream_source_t source)
```

<a id="rst-arguments-4"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_SELECT_SOURCE` for this command.

</td>
</tr>
<tr>
<td>


[video_stream_source_t](<#rst-video-stream-source-t>) `source`

</td>
<td colspan="2">


Indicates which source shall be used for the Video stream.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-14"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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](<#rst-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`.

<a id="rst-return-value-4"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-set-blank"></a>

### VIDEO_SET_BLANK

<a id="rst-synopsis-16"></a>

#### Synopsis





<a id="c-VIDEO_SET_BLANK"></a>

```c
VIDEO_SET_BLANK
```



```c
int ioctl(fd, VIDEO_SET_BLANK, int mode)
```

<a id="rst-arguments-5"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


 Equals `VIDEO_SET_BLANK` for this command.

</td>
</tr>
<tr>
<td rowspan="3">


 `int mode`

</td>
<td colspan="2">


 Indicates if the screen shall be blanked.

</td>
</tr>
<tr>
<td>


TRUE  ( \!= 0 )

</td>
<td>


Blank screen when stop.

</td>
</tr>
<tr>
<td>


FALSE ( == 0 )

</td>
<td>


Show last decoded frame.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-15"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl call asks the Video Device to blank out the picture.

<a id="rst-return-value-5"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-get-status"></a>

### VIDEO_GET_STATUS

<a id="rst-synopsis-17"></a>

#### Synopsis





<a id="c-VIDEO_GET_STATUS"></a>

```c
VIDEO_GET_STATUS
```



```c
int ioctl(fd, int request = VIDEO_GET_STATUS,
struct video_status *status)
```

<a id="rst-arguments-6"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_GET_STATUS` for this command.

</td>
</tr>
<tr>
<td>


`struct` [video_status](<#rst-video-status>) `*status`

</td>
<td colspan="2">


Returns the current status of the Video Device.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-16"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl call asks the Video Device to return the current status of the device.

<a id="rst-return-value-6"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-get-event"></a>

### VIDEO_GET_EVENT

<a id="rst-synopsis-18"></a>

#### Synopsis





<a id="c-VIDEO_GET_EVENT"></a>

```c
VIDEO_GET_EVENT
```



```c
int ioctl(fd, int request = VIDEO_GET_EVENT,
struct video_event *ev)
```

<a id="rst-arguments-7"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_GET_EVENT` for this command.

</td>
</tr>
<tr>
<td>


`struct` [video_event](<#rst-video-event>) `*ev`

</td>
<td colspan="2">


Points to the location where the event, if any, is to be stored.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-17"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl is for DVB devices only. To get events from a V4L2 decoder use the V4L2 [ioctl VIDIOC_DQEVENT](</kernel/userspace/userspace-api/media-v4l/vidioc-dqevent.md#rst-vidioc-dqevent>) ioctl instead.

This ioctl call returns an event of type [video_event](<#rst-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.

<a id="rst-return-value-7"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.


<table>
<tbody>
<tr>
<td>


`EWOULDBLOCK`

</td>
<td colspan="2">


 There is no event pending, and the device is in non-blocking mode.

</td>
</tr>
<tr>
<td>


`EOVERFLOW`

</td>
<td colspan="2">


Overflow in event queue - one or more events were lost.

</td>
</tr>
</tbody>
</table>

---

<a id="rst-video-set-display-format"></a>

### VIDEO_SET_DISPLAY_FORMAT

<a id="rst-synopsis-19"></a>

#### Synopsis





<a id="c-VIDEO_SET_DISPLAY_FORMAT"></a>

```c
VIDEO_SET_DISPLAY_FORMAT
```



```c
int ioctl(fd, int request = VIDEO_SET_DISPLAY_FORMAT,
video_display_format_t format)
```

<a id="rst-arguments-8"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_SET_DISPLAY_FORMAT` for this command.

</td>
</tr>
<tr>
<td>


[video_displayformat_t](<#rst-video-displayformat-t>) `format`

</td>
<td colspan="2">


Selects the video format to be used.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-18"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl call asks the Video Device to select the video format to be applied by the MPEG chip on the video.

<a id="rst-return-value-8"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-stillpicture"></a>

### VIDEO_STILLPICTURE

<a id="rst-synopsis-20"></a>

#### Synopsis





<a id="c-VIDEO_STILLPICTURE"></a>

```c
VIDEO_STILLPICTURE
```



```c
int ioctl(fd, int request = VIDEO_STILLPICTURE,
struct video_still_picture *sp)
```

<a id="rst-arguments-9"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_STILLPICTURE` for this command.

</td>
</tr>
<tr>
<td>


`struct` [video_still_picture](<#rst-video-still-picture>) `*sp`

</td>
<td colspan="2">


Pointer to the location where the struct with the I-frame and size is stored.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-19"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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](<#rst-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.

<a id="rst-return-value-9"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-fast-forward"></a>

### VIDEO_FAST_FORWARD

<a id="rst-synopsis-21"></a>

#### Synopsis





<a id="c-VIDEO_FAST_FORWARD"></a>

```c
VIDEO_FAST_FORWARD
```



```c
int ioctl(fd, int request = VIDEO_FAST_FORWARD, int nFrames)
```

<a id="rst-arguments-10"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_FAST_FORWARD` for this command.

</td>
</tr>
<tr>
<td>


`int nFrames`

</td>
<td colspan="2">


The number of frames to skip.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-20"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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.

<a id="rst-return-value-10"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.


<table>
<tbody>
<tr>
<td>


`EPERM`

</td>
<td>


Mode `VIDEO_SOURCE_MEMORY` not selected.

</td>
</tr>
</tbody>
</table>

---

<a id="rst-video-slowmotion"></a>

### VIDEO_SLOWMOTION

<a id="rst-synopsis-22"></a>

#### Synopsis





<a id="c-VIDEO_SLOWMOTION"></a>

```c
VIDEO_SLOWMOTION
```



```c
int ioctl(fd, int request = VIDEO_SLOWMOTION, int nFrames)
```

<a id="rst-arguments-11"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_SLOWMOTION` for this command.

</td>
</tr>
<tr>
<td>


`int nFrames`

</td>
<td colspan="2">


The number of times to repeat each frame.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-21"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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.

<a id="rst-return-value-11"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.


<table>
<tbody>
<tr>
<td>


`EPERM`

</td>
<td>


Mode `VIDEO_SOURCE_MEMORY` not selected.

</td>
</tr>
</tbody>
</table>

---

<a id="rst-video-get-capabilities"></a>

### VIDEO_GET_CAPABILITIES

<a id="rst-synopsis-23"></a>

#### Synopsis





<a id="c-VIDEO_GET_CAPABILITIES"></a>

```c
VIDEO_GET_CAPABILITIES
```



```c
int ioctl(fd, int request = VIDEO_GET_CAPABILITIES, unsigned int *cap)
```

<a id="rst-arguments-12"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_GET_CAPABILITIES` for this command.

</td>
</tr>
<tr>
<td>


`unsigned int *cap`

</td>
<td colspan="2">


Pointer to a location where to store the capability information.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-22"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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](<#rst-video-capabilities>).

<a id="rst-return-value-12"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-clear-buffer"></a>

### VIDEO_CLEAR_BUFFER

<a id="rst-synopsis-24"></a>

#### Synopsis





<a id="c-VIDEO_CLEAR_BUFFER"></a>

```c
VIDEO_CLEAR_BUFFER
```



```c
int ioctl(fd, int request = VIDEO_CLEAR_BUFFER)
```

<a id="rst-arguments-13"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_CLEAR_BUFFER` for this command.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-23"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl call clears all video buffers in the driver and in the decoder hardware.

<a id="rst-return-value-13"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-set-streamtype"></a>

### VIDEO_SET_STREAMTYPE

<a id="rst-synopsis-25"></a>

#### Synopsis





<a id="c-VIDEO_SET_STREAMTYPE"></a>

```c
VIDEO_SET_STREAMTYPE
```



```c
int ioctl(fd, int request = VIDEO_SET_STREAMTYPE, int type)
```

<a id="rst-arguments-14"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_SET_STREAMTYPE` for this command.

</td>
</tr>
<tr>
<td>


`int type`

</td>
<td colspan="2">


Stream type.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-24"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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:


<table>
<thead>
<tr>
<th>


Codec

</th>
<th>


Stream type

</th>
</tr>
</thead>
<tbody>
<tr>
<td>


MPEG2

</td>
<td>


0

</td>
</tr>
<tr>
<td>


MPEG4 h.264

</td>
<td>


1

</td>
</tr>
<tr>
<td>


VC1

</td>
<td>


3

</td>
</tr>
<tr>
<td>


MPEG4 Part2

</td>
<td>


4

</td>
</tr>
<tr>
<td>


VC1 SM

</td>
<td>


5

</td>
</tr>
<tr>
<td>


MPEG1

</td>
<td>


6

</td>
</tr>
<tr>
<td>


HEVC h.265

</td>
<td>


7  
DREAMBOX: 22

</td>
</tr>
<tr>
<td>


AVS

</td>
<td>


16

</td>
</tr>
<tr>
<td>


AVS2

</td>
<td>


40

</td>
</tr>
</tbody>
</table>

Not every decoder supports all stream types.

<a id="rst-return-value-14"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-set-format"></a>

### VIDEO_SET_FORMAT

<a id="rst-synopsis-26"></a>

#### Synopsis





<a id="c-VIDEO_SET_FORMAT"></a>

```c
VIDEO_SET_FORMAT
```



```c
int ioctl(fd, int request = VIDEO_SET_FORMAT, video_format_t format)
```

<a id="rst-arguments-15"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_SET_FORMAT` for this command.

</td>
</tr>
<tr>
<td>


[video_format_t](<#rst-video-format-t>) `format`

</td>
<td colspan="2">


Video format of TV as defined in section [video_format_t](<#rst-video-format-t>).

</td>
</tr>
</tbody>
</table>

<a id="rst-description-25"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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.

<a id="rst-return-value-15"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-get-size"></a>

### VIDEO_GET_SIZE

<a id="rst-synopsis-27"></a>

#### Synopsis





<a id="c-VIDEO_GET_SIZE"></a>

```c
VIDEO_GET_SIZE
```



```c
int ioctl(int fd, int request = VIDEO_GET_SIZE, video_size_t *size)
```

<a id="rst-arguments-16"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call, to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_GET_SIZE` for this command.

</td>
</tr>
<tr>
<td>


[video_size_t](<#rst-video-size-t>) `*size`

</td>
<td colspan="2">


Returns the size and aspect ratio.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-26"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

This ioctl returns the size and aspect ratio.

<a id="rst-return-value-16"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-get-pts"></a>

### VIDEO_GET_PTS

<a id="rst-synopsis-28"></a>

#### Synopsis





<a id="c-VIDEO_GET_PTS"></a>

```c
VIDEO_GET_PTS
```



```c
int ioctl(int fd, int request = VIDEO_GET_PTS, __u64 *pts)
```

<a id="rst-arguments-17"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_GET_PTS` for this command.

</td>
</tr>
<tr>
<td>


`__u64 *pts`

</td>
<td colspan="2">


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.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-27"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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.

<a id="rst-return-value-17"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-get-frame-count"></a>

### VIDEO_GET_FRAME_COUNT

<a id="rst-synopsis-29"></a>

#### Synopsis





<a id="c-VIDEO_GET_FRAME_COUNT"></a>

```c
VIDEO_GET_FRAME_COUNT
```



```c
int ioctl(int fd, VIDEO_GET_FRAME_COUNT, __u64 *pts)
```

<a id="rst-arguments-18"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_GET_FRAME_COUNT` for this command.

</td>
</tr>
<tr>
<td>


`__u64 *pts`

</td>
<td colspan="2">


Returns the number of frames displayed since the decoder was started.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-28"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

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.

<a id="rst-return-value-18"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-command"></a>

### VIDEO_COMMAND

<a id="rst-synopsis-30"></a>

#### Synopsis





<a id="c-VIDEO_COMMAND"></a>

```c
VIDEO_COMMAND
```



```c
int ioctl(int fd, int request = VIDEO_COMMAND,
struct video_command *cmd)
```

<a id="rst-arguments-19"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_COMMAND` for this command.

</td>
</tr>
<tr>
<td>


[struct video_command](<#rst-struct-video-command>) `*cmd`

</td>
<td colspan="2">


Commands the decoder.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-29"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

For V4L2 decoders this ioctl has been replaced by the [ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD](</kernel/userspace/userspace-api/media-v4l/vidioc-decoder-cmd.md#rst-vidioc-decoder-cmd>) ioctl.

This ioctl commands the decoder. The [struct video_command](<#rst-struct-video-command>) is a subset of the `v4l2_decoder_cmd` struct, so refer to the [ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD](</kernel/userspace/userspace-api/media-v4l/vidioc-decoder-cmd.md#rst-vidioc-decoder-cmd>) documentation for more information.

<a id="rst-return-value-19"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-video-try-command"></a>

### VIDEO_TRY_COMMAND

<a id="rst-synopsis-31"></a>

#### Synopsis





<a id="c-VIDEO_TRY_COMMAND"></a>

```c
VIDEO_TRY_COMMAND
```



```c
int ioctl(int fd, int request = VIDEO_TRY_COMMAND,
struct video_command *cmd)
```

<a id="rst-arguments-20"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`int request`

</td>
<td colspan="2">


Equals `VIDEO_TRY_COMMAND` for this command.

</td>
</tr>
<tr>
<td>


[struct video_command](<#rst-struct-video-command>) `*cmd`

</td>
<td colspan="2">


Try a decoder command.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-30"></a>

#### Description

> [!NOTE]
>
> Do **not** use in new drivers\! See: [General Notes](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-notes>)

For V4L2 decoders this ioctl has been replaced by the [VIDIOC_TRY_DECODER_CMD](</kernel/userspace/userspace-api/media-v4l/vidioc-decoder-cmd.md#rst-vidioc-decoder-cmd>) ioctl.

This ioctl tries a decoder command. The [struct video_command](<#rst-struct-video-command>) is a subset of the `v4l2_decoder_cmd` struct, so refer to the [VIDIOC_TRY_DECODER_CMD](</kernel/userspace/userspace-api/media-v4l/vidioc-decoder-cmd.md#rst-vidioc-decoder-cmd>) documentation for more information.

<a id="rst-return-value-20"></a>

#### 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

<a id="rst-open"></a>

### open()

<a id="rst-synopsis-32"></a>

#### Synopsis



```c
#include <fcntl.h>
```





<a id="c-open"></a>

```c
int open(const char *deviceName, int flags)
```

<a id="rst-arguments-21"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`const char *deviceName`

</td>
<td colspan="2">


Name of specific video device.

</td>
</tr>
<tr>
<td rowspan="4">


 `int flags`

</td>
<td colspan="2">


 A bit-wise OR of the following flags:

</td>
</tr>
<tr>
<td>


`O_RDONLY`

</td>
<td>


read-only access

</td>
</tr>
<tr>
<td>


`O_RDWR`

</td>
<td>


read/write access

</td>
</tr>
<tr>
<td>


`O_NONBLOCK`

</td>
<td>


Open in non-blocking mode  
(blocking mode is the default)

</td>
</tr>
</tbody>
</table>

<a id="rst-description-31"></a>

#### 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](<#rst-video-get-status>). All other call will return an error code.

<a id="rst-return-value-21"></a>

#### Return Value


<table>
<tbody>
<tr>
<td>


`ENODEV`

</td>
<td colspan="2">


 Device driver not loaded/available.

</td>
</tr>
<tr>
<td>


`EINTERNAL`

</td>
<td colspan="2">


Internal error.

</td>
</tr>
<tr>
<td>


`EBUSY`

</td>
<td colspan="2">


Device or resource busy.

</td>
</tr>
<tr>
<td>


`EINVAL`

</td>
<td colspan="2">


Invalid argument.

</td>
</tr>
</tbody>
</table>

---

<a id="rst-close"></a>

### close()

<a id="rst-synopsis-33"></a>

#### Synopsis





<a id="c-close"></a>

```c
int close(int fd)
```

<a id="rst-arguments-22"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
</tbody>
</table>

<a id="rst-description-32"></a>

#### Description

This system call closes a previously opened video device.

<a id="rst-return-value-22"></a>

#### Return Value


<table>
<tbody>
<tr>
<td>


`EBADF`

</td>
<td>


fd is not a valid open file descriptor.

</td>
</tr>
</tbody>
</table>

---

<a id="rst-write"></a>

### write()

<a id="rst-synopsis-34"></a>

#### Synopsis





<a id="c-write"></a>

```c
size_t write(int fd, const void *buf, size_t count)
```

<a id="rst-arguments-23"></a>

#### Arguments


<table>
<tbody>
<tr>
<td>


`int fd`

</td>
<td colspan="2">


 File descriptor returned by a previous call to [open()](<#rst-open>).

</td>
</tr>
<tr>
<td>


`void *buf`

</td>
<td colspan="2">


Pointer to the buffer containing the PES data.

</td>
</tr>
<tr>
<td>


`size_t count`

</td>
<td colspan="2">


Size of buf.

</td>
</tr>
</tbody>
</table>

<a id="rst-description-33"></a>

#### Description

This system call can only be used if VIDEO_SOURCE_MEMORY is selected in the ioctl call [VIDEO_SELECT_SOURCE](<#rst-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.

> [!NOTE]
>
> See: [DVB Data Formats](</kernel/userspace/userspace-api/media-dvb/legacy-dvb-decoder-api.md#rst-legacy-dvb-decoder-formats>)

<a id="rst-return-value-23"></a>

#### Return Value


<table>
<tbody>
<tr>
<td>


`EPERM`

</td>
<td colspan="2">


 Mode `VIDEO_SOURCE_MEMORY` not selected.

</td>
</tr>
<tr>
<td>


`ENOMEM`

</td>
<td colspan="2">


Attempted to write more data than the internal buffer can hold.

</td>
</tr>
<tr>
<td>


`EBADF`

</td>
<td colspan="2">


fd is not a valid open file descriptor.

</td>
</tr>
</tbody>
</table>

---

# ioctl NET_ADD_IF

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> NET_ADD_IF - Creates a new network interface for a given Packet ID.

<a id="rst-ioctl-net-add-if"></a>
<a id="rst-net-add-if"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.net -->

<a id="rst-name"></a>

## Name

NET_ADD_IF - Creates a new network interface for a given Packet ID.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-NET_ADD_IF"></a>

```c
NET_ADD_IF
```

`int ioctl(int fd, NET_ADD_IF, struct dvb_net_if *net_if)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`net_if`**

  pointer to struct `dvb_net_if`

<a id="rst-description"></a>

## 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.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl NET_GET_IF

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> NET_GET_IF - Read the configuration data of an interface created via - NET_ADD_IF <net>.

<a id="rst-ioctl-net-get-if"></a>
<a id="rst-net-get-if"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.net -->

<a id="rst-name"></a>

## Name

NET_GET_IF - Read the configuration data of an interface created via - [NET_ADD_IF](</kernel/userspace/userspace-api/media-dvb/net.md#rst-net>).

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-NET_GET_IF"></a>

```c
NET_GET_IF
```

`int ioctl(int fd, NET_GET_IF, struct dvb_net_if *net_if)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`net_if`**

  pointer to struct `dvb_net_if`

<a id="rst-description"></a>

## 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](</kernel/userspace/userspace-api/media-dvb/net.md#rst-net>), it will return -1 and fill the `errno` with `EINVAL` error code.

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# ioctl NET_REMOVE_IF

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> NET_REMOVE_IF - Removes a network interface.

<a id="rst-ioctl-net-remove-if"></a>
<a id="rst-net-remove-if"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: DTV.net -->

<a id="rst-name"></a>

## Name

NET_REMOVE_IF - Removes a network interface.

<a id="rst-synopsis"></a>

## Synopsis





<a id="c-NET_REMOVE_IF"></a>

```c
NET_REMOVE_IF
```

`int ioctl(int fd, NET_REMOVE_IF, int ifnum)`

<a id="rst-arguments"></a>

## Arguments

- **`fd`**

  File descriptor returned by `open()`.

- **`net_if`**

  number of the interface to be removed

<a id="rst-description"></a>

## Description

The NET_REMOVE_IF ioctl deletes an interface previously created via [NET_ADD_IF](</kernel/userspace/userspace-api/media-dvb/net.md#rst-net>).

<a id="rst-return-value"></a>

## 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](</kernel/userspace/userspace-api/media/gen-errors.md#rst-gen-errors-1>) chapter.

---

# Net Data Types

_Peios Kernel / Userspace interfaces / System and device interfaces / Digital television (DVB)_

> Reference for Net Data Types.

<a id="rst-net-data-types"></a>
<a id="rst-net-types"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->


#### <a id="c-struct-dvb_net_if"></a>`struct dvb_net_if`

describes a DVB network interface

**Definition**

```c
struct dvb_net_if {
        __u16 pid;
        __u16 if_num;
        __u8 feedtype;
    #define DVB_NET_FEEDTYPE_MPE 0;
    #define DVB_NET_FEEDTYPE_ULE 1;
};
```

**Members**

- `pid`: Packet ID (PID) of the MPEG-TS that contains data
- `if_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_MPE` for MPE encoding
- `DVB_NET_FEEDTYPE_ULE` for 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.

<a id="rst-digital-tv-network-api"></a>
<a id="rst-net"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

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:

- [Multi Protocol Encapsulation (MPE)](<http://en.wikipedia.org/wiki/Multiprotocol_Encapsulation>)

- [Ultra Lightweight Encapsulation (ULE)](<http://en.wikipedia.org/wiki/Unidirectional_Lightweight_Encapsulation>)

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.

<a id="rst-digital-tv-net-function-calls"></a>
<a id="rst-net-fcalls"></a>

## Digital TV net Function Calls

- [Net Data Types](</kernel/userspace/userspace-api/media-dvb/net-types.md>)
- [ioctl NET_ADD_IF](</kernel/userspace/userspace-api/media-dvb/net-add-if.md>)
- [ioctl NET_REMOVE_IF](</kernel/userspace/userspace-api/media-dvb/net-remove-if.md>)
- [ioctl NET_GET_IF](</kernel/userspace/userspace-api/media-dvb/net-get-if.md>)

---

# 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 FE_GET_INFO. This ioctl will enumerate the Digital TV API version and other characteristics about the frontend, and can be…

<a id="rst-querying-frontend-information"></a>
<a id="rst-query-dvb-frontend-info"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

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](</kernel/userspace/userspace-api/media-dvb/fe-get-info.md#rst-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.
