^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) .. _dvb_introdution:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) Introduction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) ************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) .. _requisites:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) What you need to know
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) =====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) The reader of this document is required to have some knowledge in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) area of digital video broadcasting (Digital TV) and should be familiar with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) part I of the MPEG2 specification ISO/IEC 13818 (aka ITU-T H.222), i.e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) you should know what a program/transport stream (PS/TS) is and what is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) meant by a packetized elementary stream (PES) or an I-frame.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) Various Digital TV standards documents are available for download at:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) - European standards (DVB): http://www.dvb.org and/or http://www.etsi.org.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) - American standards (ATSC): https://www.atsc.org/standards/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) - Japanese standards (ISDB): http://www.dibeg.org/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) It is also necessary to know how to access Linux devices and how to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) use ioctl calls. This also includes the knowledge of C or C++.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) .. _history:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) History
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) =======
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) The first API for Digital TV cards we used at Convergence in late 1999 was an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) extension of the Video4Linux API which was primarily developed for frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) grabber cards. As such it was not really well suited to be used for Digital
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) TV cards and their new features like recording MPEG streams and filtering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) several section and PES data streams at the same time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) In early 2000, Convergence was approached by Nokia with a proposal for a new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) standard Linux Digital TV API. As a commitment to the development of terminals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) based on open standards, Nokia and Convergence made it available to all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) Linux developers and published it on https://linuxtv.org in September
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 2000. With the Linux driver for the Siemens/Hauppauge DVB PCI card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) Convergence provided a first implementation of the Linux Digital TV API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) Convergence was the maintainer of the Linux Digital TV API in the early
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) days.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) Now, the API is maintained by the LinuxTV community (i.e. you, the reader
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) of this document). The Linux Digital TV API is constantly reviewed and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) improved together with the improvements at the subsystem's core at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) Kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) .. _overview:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) Overview
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) .. _stb_components:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) .. kernel-figure:: dvbstb.svg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) :alt: dvbstb.svg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) :align: center
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) Components of a Digital TV card/STB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) A Digital TV card or set-top-box (STB) usually consists of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) following main hardware components:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) Frontend consisting of tuner and digital TV demodulator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) Here the raw signal reaches the digital TV hardware from a satellite dish or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) antenna or directly from cable. The frontend down-converts and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) demodulates this signal into an MPEG transport stream (TS). In case
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) of a satellite frontend, this includes a facility for satellite
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) equipment control (SEC), which allows control of LNB polarization,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) multi feed switches or dish rotors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) Conditional Access (CA) hardware like CI adapters and smartcard slots
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) The complete TS is passed through the CA hardware. Programs to which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) the user has access (controlled by the smart card) are decoded in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) real time and re-inserted into the TS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) Not every digital TV hardware provides conditional access hardware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) Demultiplexer which filters the incoming Digital TV MPEG-TS stream
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) The demultiplexer splits the TS into its components like audio and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) video streams. Besides usually several of such audio and video
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) streams it also contains data streams with information about the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) programs offered in this or other streams of the same provider.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) Audio and video decoder
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) The main targets of the demultiplexer are audio and video
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) decoders. After decoding, they pass on the uncompressed audio and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) video to the computer screen or to a TV set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) Modern hardware usually doesn't have a separate decoder hardware, as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) such functionality can be provided by the main CPU, by the graphics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) adapter of the system or by a signal processing hardware embedded on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) a Systems on a Chip (SoC) integrated circuit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) It may also not be needed for certain usages (e.g. for data-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) uses like “internet over satellite”).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) :ref:`stb_components` shows a crude schematic of the control and data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) flow between those components.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) .. _dvb_devices:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) Linux Digital TV Devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) ========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) The Linux Digital TV API lets you control these hardware components through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) currently six Unix-style character devices for video, audio, frontend,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) demux, CA and IP-over-DVB networking. The video and audio devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) control the MPEG2 decoder hardware, the frontend device the tuner and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) the Digital TV demodulator. The demux device gives you control over the PES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) and section filters of the hardware. If the hardware does not support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) filtering these filters can be implemented in software. Finally, the CA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) device controls all the conditional access capabilities of the hardware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) It can depend on the individual security requirements of the platform,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) if and how many of the CA functions are made available to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) application through this device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) All devices can be found in the ``/dev`` tree under ``/dev/dvb``. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) individual devices are called:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) - ``/dev/dvb/adapterN/audioM``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) - ``/dev/dvb/adapterN/videoM``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) - ``/dev/dvb/adapterN/frontendM``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) - ``/dev/dvb/adapterN/netM``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) - ``/dev/dvb/adapterN/demuxM``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) - ``/dev/dvb/adapterN/dvrM``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) - ``/dev/dvb/adapterN/caM``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) where ``N`` enumerates the Digital TV cards in a system starting from 0, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) ``M`` enumerates the devices of each type within each adapter, starting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) from 0, too. We will omit the “``/dev/dvb/adapterN/``\ ” in the further
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) discussion of these devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) More details about the data structures and function calls of all the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) devices are described in the following chapters.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) .. _include_files:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) API include files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) For each of the Digital TV devices a corresponding include file exists. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) Digital TV API include files should be included in application sources with a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) partial path like:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) .. code-block:: c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) #include <linux/dvb/ca.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) #include <linux/dvb/dmx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) #include <linux/dvb/frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) #include <linux/dvb/net.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) To enable applications to support different API version, an additional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) include file ``linux/dvb/version.h`` exists, which defines the constant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) ``DVB_API_VERSION``. This document describes ``DVB_API_VERSION 5.10``.