blob: fbae687414ce4b3e864a299ad6f8bac7d73a4d50 [file] [log] [blame]
Markus Heiser5377d912016-06-30 15:18:56 +02001.. -*- coding: utf-8; mode: rst -*-
2
3.. _dvb_introdution:
4
5************
6Introduction
7************
8
9
10.. _requisites:
11
12What you need to know
13=====================
14
15The reader of this document is required to have some knowledge in the
Mauro Carvalho Chehab89aba6a2017-08-30 05:15:40 -040016area of digital video broadcasting (Digital TV) and should be familiar with
Markus Heiser5377d912016-06-30 15:18:56 +020017part I of the MPEG2 specification ISO/IEC 13818 (aka ITU-T H.222), i.e
18you should know what a program/transport stream (PS/TS) is and what is
19meant by a packetized elementary stream (PES) or an I-frame.
20
Mauro Carvalho Chehab3e202f22017-08-30 05:19:25 -040021Various Digital TV standards documents are available for download at:
Markus Heiser5377d912016-06-30 15:18:56 +020022
Mauro Carvalho Chehab3e202f22017-08-30 05:19:25 -040023- European standards (DVB): http://www.dvb.org and/or http://www.etsi.org.
24- American standards (ATSC): https://www.atsc.org/standards/
25- Japanese standards (ISDB): http://www.dibeg.org/
26
27It is also necessary to know how to access Linux devices and how to
Markus Heiser5377d912016-06-30 15:18:56 +020028use ioctl calls. This also includes the knowledge of C or C++.
29
30
31.. _history:
32
33History
34=======
35
Mauro Carvalho Chehab699f19e2017-09-01 12:28:16 -040036The first API for Digital TV cards we used at Convergence in late 1999 was an
Markus Heiser5377d912016-06-30 15:18:56 +020037extension of the Video4Linux API which was primarily developed for frame
Mauro Carvalho Chehab699f19e2017-09-01 12:28:16 -040038grabber cards. As such it was not really well suited to be used for Digital
39TV cards and their new features like recording MPEG streams and filtering
Markus Heiser5377d912016-06-30 15:18:56 +020040several section and PES data streams at the same time.
41
Mauro Carvalho Chehab9a9bf232017-08-30 05:20:45 -040042In early 2000, Convergence was approached by Nokia with a proposal for a new
Mauro Carvalho Chehab699f19e2017-09-01 12:28:16 -040043standard Linux Digital TV API. As a commitment to the development of terminals
Markus Heiser5377d912016-06-30 15:18:56 +020044based on open standards, Nokia and Convergence made it available to all
45Linux developers and published it on https://linuxtv.org in September
Mauro Carvalho Chehab9a9bf232017-08-30 05:20:45 -0400462000. With the Linux driver for the Siemens/Hauppauge DVB PCI card,
Mauro Carvalho Chehab699f19e2017-09-01 12:28:16 -040047Convergence provided a first implementation of the Linux Digital TV API.
48Convergence was the maintainer of the Linux Digital TV API in the early
Mauro Carvalho Chehab9a9bf232017-08-30 05:20:45 -040049days.
50
51Now, the API is maintained by the LinuxTV community (i.e. you, the reader
52of this document). The Linux Digital TV API is constantly reviewed and
53improved together with the improvements at the subsystem's core at the
54Kernel.
Markus Heiser5377d912016-06-30 15:18:56 +020055
56
57.. _overview:
58
59Overview
60========
61
62
63.. _stb_components:
64
Mauro Carvalho Chehab8fa1bb52017-03-09 15:14:52 -030065.. kernel-figure:: dvbstb.svg
66 :alt: dvbstb.svg
67 :align: center
Markus Heiser5377d912016-06-30 15:18:56 +020068
Mauro Carvalho Chehab89aba6a2017-08-30 05:15:40 -040069 Components of a Digital TV card/STB
Markus Heiser5377d912016-06-30 15:18:56 +020070
Mauro Carvalho Chehab89aba6a2017-08-30 05:15:40 -040071A Digital TV card or set-top-box (STB) usually consists of the
Markus Heiser5377d912016-06-30 15:18:56 +020072following main hardware components:
73
Mauro Carvalho Chehab192f8bc2017-08-30 05:25:20 -040074Frontend consisting of tuner and digital TV demodulator
Mauro Carvalho Chehab89aba6a2017-08-30 05:15:40 -040075 Here the raw signal reaches the digital TV hardware from a satellite dish or
Markus Heiser5377d912016-06-30 15:18:56 +020076 antenna or directly from cable. The frontend down-converts and
77 demodulates this signal into an MPEG transport stream (TS). In case
78 of a satellite frontend, this includes a facility for satellite
79 equipment control (SEC), which allows control of LNB polarization,
80 multi feed switches or dish rotors.
81
Mauro Carvalho Chehab192f8bc2017-08-30 05:25:20 -040082Conditional Access (CA) hardware like CI adapters and smartcard slots
Markus Heiser5377d912016-06-30 15:18:56 +020083 The complete TS is passed through the CA hardware. Programs to which
84 the user has access (controlled by the smart card) are decoded in
85 real time and re-inserted into the TS.
86
Mauro Carvalho Chehab192f8bc2017-08-30 05:25:20 -040087 .. note::
Markus Heiser5377d912016-06-30 15:18:56 +020088
Mauro Carvalho Chehab192f8bc2017-08-30 05:25:20 -040089 Not every digital TV hardware provides conditional access hardware.
90
Mauro Carvalho Chehab699f19e2017-09-01 12:28:16 -040091Demultiplexer which filters the incoming Digital TV MPEG-TS stream
Markus Heiser5377d912016-06-30 15:18:56 +020092 The demultiplexer splits the TS into its components like audio and
93 video streams. Besides usually several of such audio and video
94 streams it also contains data streams with information about the
95 programs offered in this or other streams of the same provider.
96
Mauro Carvalho Chehab192f8bc2017-08-30 05:25:20 -040097MPEG2 audio and video decoder
Markus Heiser5377d912016-06-30 15:18:56 +020098 The main targets of the demultiplexer are the MPEG2 audio and video
99 decoders. After decoding they pass on the uncompressed audio and
100 video to the computer screen or (through a PAL/NTSC encoder) to a TV
101 set.
102
Mauro Carvalho Chehab192f8bc2017-08-30 05:25:20 -0400103 .. note::
104
105 Modern hardware usually doesn't have a separate decoder hardware, as
106 such functionality can be provided by the main CPU, by the graphics
107 adapter of the system or by a signal processing hardware embedded on
108 a Systems on a Chip (SoC) integrated circuit.
109
110 It may also not be needed for certain usages (e.g. for data-only
111 uses like internet over satellite”).
112
Markus Heiser5377d912016-06-30 15:18:56 +0200113:ref:`stb_components` shows a crude schematic of the control and data
114flow between those components.
115
Markus Heiser5377d912016-06-30 15:18:56 +0200116
117
118.. _dvb_devices:
119
Mauro Carvalho Chehab89aba6a2017-08-30 05:15:40 -0400120Linux Digital TV Devices
121========================
Markus Heiser5377d912016-06-30 15:18:56 +0200122
Mauro Carvalho Chehab89aba6a2017-08-30 05:15:40 -0400123The Linux Digital TV API lets you control these hardware components through
Markus Heiser5377d912016-06-30 15:18:56 +0200124currently six Unix-style character devices for video, audio, frontend,
125demux, CA and IP-over-DVB networking. The video and audio devices
126control the MPEG2 decoder hardware, the frontend device the tuner and
Mauro Carvalho Chehab699f19e2017-09-01 12:28:16 -0400127the Digital TV demodulator. The demux device gives you control over the PES
128and section filters of the hardware. If the hardware does not support
Markus Heiser5377d912016-06-30 15:18:56 +0200129filtering these filters can be implemented in software. Finally, the CA
130device controls all the conditional access capabilities of the hardware.
131It can depend on the individual security requirements of the platform,
132if and how many of the CA functions are made available to the
133application through this device.
134
135All devices can be found in the ``/dev`` tree under ``/dev/dvb``. The
136individual devices are called:
137
138- ``/dev/dvb/adapterN/audioM``,
139
140- ``/dev/dvb/adapterN/videoM``,
141
142- ``/dev/dvb/adapterN/frontendM``,
143
144- ``/dev/dvb/adapterN/netM``,
145
146- ``/dev/dvb/adapterN/demuxM``,
147
148- ``/dev/dvb/adapterN/dvrM``,
149
150- ``/dev/dvb/adapterN/caM``,
151
Mauro Carvalho Chehab89aba6a2017-08-30 05:15:40 -0400152where ``N`` enumerates the Digital TV cards in a system starting from 0, and
153``M`` enumerates the devices of each type within each adapter, starting
Mauro Carvalho Chehabe5707c92017-08-26 06:07:09 -0400154from 0, too. We will omit the ``/dev/dvb/adapterN/``\ in the further
Markus Heiser5377d912016-06-30 15:18:56 +0200155discussion of these devices.
156
157More details about the data structures and function calls of all the
158devices are described in the following chapters.
159
160
161.. _include_files:
162
163API include files
164=================
165
Mauro Carvalho Chehab89aba6a2017-08-30 05:15:40 -0400166For each of the Digital TV devices a corresponding include file exists. The
167Digital TV API include files should be included in application sources with a
Markus Heiser5377d912016-06-30 15:18:56 +0200168partial path like:
169
170
171.. code-block:: c
172
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300173 #include <linux/dvb/ca.h>
Markus Heiser5377d912016-06-30 15:18:56 +0200174
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300175 #include <linux/dvb/dmx.h>
Markus Heiser5377d912016-06-30 15:18:56 +0200176
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300177 #include <linux/dvb/frontend.h>
Markus Heiser5377d912016-06-30 15:18:56 +0200178
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300179 #include <linux/dvb/net.h>
Markus Heiser5377d912016-06-30 15:18:56 +0200180
Markus Heiser5377d912016-06-30 15:18:56 +0200181
182To enable applications to support different API version, an additional
183include file ``linux/dvb/version.h`` exists, which defines the constant
184``DVB_API_VERSION``. This document describes ``DVB_API_VERSION 5.10``.