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