intro.xml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <title>Introduction</title>
  2. <section id="requisites">
  3. <title>What you need to know</title>
  4. <para>The reader of this document is required to have some knowledge in
  5. the area of digital video broadcasting (DVB) and should be familiar with
  6. part I of the MPEG2 specification ISO/IEC 13818 (aka ITU-T H.222), i.e
  7. you should know what a program/transport stream (PS/TS) is and what is
  8. meant by a packetized elementary stream (PES) or an I-frame.</para>
  9. <para>Various DVB standards documents are available from
  10. <ulink url="http://www.dvb.org" /> and/or
  11. <ulink url="http://www.etsi.org" />.</para>
  12. <para>It is also necessary to know how to access unix/linux devices and
  13. how to use ioctl calls. This also includes the knowledge of C or C++.
  14. </para>
  15. </section>
  16. <section id="history">
  17. <title>History</title>
  18. <para>The first API for DVB cards we used at Convergence in late 1999
  19. was an extension of the Video4Linux API which was primarily developed
  20. for frame grabber cards. As such it was not really well suited to be
  21. used for DVB cards and their new features like recording MPEG streams
  22. and filtering several section and PES data streams at the same time.
  23. </para>
  24. <para>In early 2000, we were approached by Nokia with a proposal for a
  25. new standard Linux DVB API. As a commitment to the development of
  26. terminals based on open standards, Nokia and Convergence made it
  27. available to all Linux developers and published it on
  28. <ulink url="http://www.linuxtv.org/" /> in September 2000.
  29. Convergence is the maintainer of the Linux DVB API. Together with the
  30. LinuxTV community (i.e. you, the reader of this document), the Linux DVB
  31. API will be constantly reviewed and improved. With the Linux driver for
  32. the Siemens/Hauppauge DVB PCI card Convergence provides a first
  33. implementation of the Linux DVB API.</para>
  34. </section>
  35. <section id="overview">
  36. <title>Overview</title>
  37. <figure id="stb_components">
  38. <title>Components of a DVB card/STB</title>
  39. <mediaobject>
  40. <imageobject>
  41. <imagedata fileref="dvbstb.pdf" format="PS" />
  42. </imageobject>
  43. <imageobject>
  44. <imagedata fileref="dvbstb.png" format="PNG" />
  45. </imageobject>
  46. </mediaobject>
  47. </figure>
  48. <para>A DVB PCI card or DVB set-top-box (STB) usually consists of the
  49. following main hardware components: </para>
  50. <itemizedlist>
  51. <listitem>
  52. <para>Frontend consisting of tuner and DVB demodulator</para>
  53. <para>Here the raw signal reaches the DVB hardware from a satellite dish
  54. or antenna or directly from cable. The frontend down-converts and
  55. demodulates this signal into an MPEG transport stream (TS). In case of a
  56. satellite frontend, this includes a facility for satellite equipment
  57. control (SEC), which allows control of LNB polarization, multi feed
  58. switches or dish rotors.</para>
  59. </listitem>
  60. <listitem>
  61. <para>Conditional Access (CA) hardware like CI adapters and smartcard slots
  62. </para>
  63. <para>The complete TS is passed through the CA hardware. Programs to
  64. which the user has access (controlled by the smart card) are decoded in
  65. real time and re-inserted into the TS.</para>
  66. </listitem>
  67. <listitem>
  68. <para>Demultiplexer which filters the incoming DVB stream</para>
  69. <para>The demultiplexer splits the TS into its components like audio and
  70. video streams. Besides usually several of such audio and video streams
  71. it also contains data streams with information about the programs
  72. offered in this or other streams of the same provider.</para>
  73. </listitem>
  74. <listitem>
  75. <para>MPEG2 audio and video decoder</para>
  76. <para>The main targets of the demultiplexer are the MPEG2 audio and
  77. video decoders. After decoding they pass on the uncompressed audio and
  78. video to the computer screen or (through a PAL/NTSC encoder) to a TV
  79. set.</para>
  80. </listitem>
  81. </itemizedlist>
  82. <para><xref linkend="stb_components" /> shows a crude schematic of the control and data flow
  83. between those components.</para>
  84. <para>On a DVB PCI card not all of these have to be present since some
  85. functionality can be provided by the main CPU of the PC (e.g. MPEG
  86. picture and sound decoding) or is not needed (e.g. for data-only uses
  87. like &#8220;internet over satellite&#8221;). Also not every card or STB
  88. provides conditional access hardware.</para>
  89. </section>
  90. <section id="dvb_devices">
  91. <title>Linux DVB Devices</title>
  92. <para>The Linux DVB API lets you control these hardware components
  93. through currently six Unix-style character devices for video, audio,
  94. frontend, demux, CA and IP-over-DVB networking. The video and audio
  95. devices control the MPEG2 decoder hardware, the frontend device the
  96. tuner and the DVB demodulator. The demux device gives you control over
  97. the PES and section filters of the hardware. If the hardware does not
  98. support filtering these filters can be implemented in software. Finally,
  99. the CA device controls all the conditional access capabilities of the
  100. hardware. It can depend on the individual security requirements of the
  101. platform, if and how many of the CA functions are made available to the
  102. application through this device.</para>
  103. <para>All devices can be found in the <emphasis role="tt">/dev</emphasis>
  104. tree under <emphasis role="tt">/dev/dvb</emphasis>. The individual devices
  105. are called:</para>
  106. <itemizedlist>
  107. <listitem>
  108. <para><emphasis role="tt">/dev/dvb/adapterN/audioM</emphasis>,</para>
  109. </listitem>
  110. <listitem>
  111. <para><emphasis role="tt">/dev/dvb/adapterN/videoM</emphasis>,</para>
  112. </listitem>
  113. <listitem>
  114. <para><emphasis role="tt">/dev/dvb/adapterN/frontendM</emphasis>,</para>
  115. </listitem>
  116. <listitem>
  117. <para><emphasis role="tt">/dev/dvb/adapterN/netM</emphasis>,</para>
  118. </listitem>
  119. <listitem>
  120. <para><emphasis role="tt">/dev/dvb/adapterN/demuxM</emphasis>,</para>
  121. </listitem>
  122. <listitem>
  123. <para><emphasis role="tt">/dev/dvb/adapterN/caM</emphasis>,</para></listitem></itemizedlist>
  124. <para>where N enumerates the DVB PCI cards in a system starting
  125. from&#x00A0;0, and M enumerates the devices of each type within each
  126. adapter, starting from&#x00A0;0, too. We will omit the &#8220;<emphasis
  127. role="tt">/dev/dvb/adapterN/</emphasis>&#8221; in the further dicussion
  128. of these devices. The naming scheme for the devices is the same wheter
  129. devfs is used or not.</para>
  130. <para>More details about the data structures and function calls of all
  131. the devices are described in the following chapters.</para>
  132. </section>
  133. <section id="include_files">
  134. <title>API include files</title>
  135. <para>For each of the DVB devices a corresponding include file exists.
  136. The DVB API include files should be included in application sources with
  137. a partial path like:</para>
  138. <programlisting>
  139. #include &#x003C;linux/dvb/frontend.h&#x003E;
  140. </programlisting>
  141. <para>To enable applications to support different API version, an
  142. additional include file <emphasis
  143. role="tt">linux/dvb/version.h</emphasis> exists, which defines the
  144. constant <emphasis role="tt">DVB_API_VERSION</emphasis>. This document
  145. describes <emphasis role="tt">DVB_API_VERSION&#x00A0;3</emphasis>.
  146. </para>
  147. </section>