legacy_dvb_audio.rst 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later OR GPL-2.0
  2. .. c:namespace:: dtv.legacy.audio
  3. .. _dvb_audio:
  4. ================
  5. DVB Audio Device
  6. ================
  7. .. attention:: Do **not** use in new drivers!
  8. See: :ref:`legacy_dvb_decoder_notes`
  9. The DVB audio device controls the MPEG2 audio decoder of the DVB
  10. hardware. It can be accessed through ``/dev/dvb/adapter?/audio?``. Data
  11. types and ioctl definitions can be accessed by including
  12. ``linux/dvb/audio.h`` in your application.
  13. Please note that most DVB cards don’t have their own MPEG decoder, which
  14. results in the omission of the audio and video device.
  15. These ioctls were also used by V4L2 to control MPEG decoders implemented
  16. in V4L2. The use of these ioctls for that purpose has been made obsolete
  17. and proper V4L2 ioctls or controls have been created to replace that
  18. functionality. Use :ref:`V4L2 ioctls<audio>` for new drivers!
  19. Audio Data Types
  20. ================
  21. This section describes the structures, data types and defines used when
  22. talking to the audio device.
  23. -----
  24. audio_stream_source_t
  25. ---------------------
  26. Synopsis
  27. ~~~~~~~~
  28. .. c:enum:: audio_stream_source_t
  29. .. code-block:: c
  30. typedef enum {
  31. AUDIO_SOURCE_DEMUX,
  32. AUDIO_SOURCE_MEMORY
  33. } audio_stream_source_t;
  34. Constants
  35. ~~~~~~~~~
  36. .. flat-table::
  37. :header-rows: 0
  38. :stub-columns: 0
  39. - ..
  40. - ``AUDIO_SOURCE_DEMUX``
  41. - :cspan:`1` Selects the demultiplexer (fed either by the frontend
  42. or the DVR device) as the source of the video stream.
  43. - ..
  44. - ``AUDIO_SOURCE_MEMORY``
  45. - Selects the stream from the application that comes through
  46. the `write()`_ system call.
  47. Description
  48. ~~~~~~~~~~~
  49. The audio stream source is set through the `AUDIO_SELECT_SOURCE`_ call
  50. and can take the following values, depending on whether we are replaying
  51. from an internal (demux) or external (user write) source.
  52. The data fed to the decoder is also controlled by the PID-filter.
  53. Output selection: :c:type:`dmx_output` ``DMX_OUT_DECODER``.
  54. -----
  55. audio_play_state_t
  56. ------------------
  57. Synopsis
  58. ~~~~~~~~
  59. .. c:enum:: audio_play_state_t
  60. .. code-block:: c
  61. typedef enum {
  62. AUDIO_STOPPED,
  63. AUDIO_PLAYING,
  64. AUDIO_PAUSED
  65. } audio_play_state_t;
  66. Constants
  67. ~~~~~~~~~
  68. .. flat-table::
  69. :header-rows: 0
  70. :stub-columns: 0
  71. - ..
  72. - ``AUDIO_STOPPED``
  73. - Audio is stopped.
  74. - ..
  75. - ``AUDIO_PLAYING``
  76. - Audio is currently playing.
  77. - ..
  78. - ``AUDIO_PAUSE``
  79. - Audio is frozen.
  80. Description
  81. ~~~~~~~~~~~
  82. This values can be returned by the `AUDIO_GET_STATUS`_ call
  83. representing the state of audio playback.
  84. -----
  85. audio_channel_select_t
  86. ----------------------
  87. Synopsis
  88. ~~~~~~~~
  89. .. c:enum:: audio_channel_select_t
  90. .. code-block:: c
  91. typedef enum {
  92. AUDIO_STEREO,
  93. AUDIO_MONO_LEFT,
  94. AUDIO_MONO_RIGHT,
  95. AUDIO_MONO,
  96. AUDIO_STEREO_SWAPPED
  97. } audio_channel_select_t;
  98. Constants
  99. ~~~~~~~~~
  100. .. flat-table::
  101. :header-rows: 0
  102. :stub-columns: 0
  103. - ..
  104. - ``AUDIO_STEREO``
  105. - Stereo.
  106. - ..
  107. - ``AUDIO_MONO_LEFT``
  108. - Mono, select left stereo channel as source.
  109. - ..
  110. - ``AUDIO_MONO_RIGHT``
  111. - Mono, select right stereo channel as source.
  112. - ..
  113. - ``AUDIO_MONO``
  114. - Mono source only.
  115. - ..
  116. - ``AUDIO_STEREO_SWAPPED``
  117. - Stereo, swap L & R.
  118. Description
  119. ~~~~~~~~~~~
  120. The audio channel selected via `AUDIO_CHANNEL_SELECT`_ is determined by
  121. this values.
  122. -----
  123. audio_mixer_t
  124. -------------
  125. Synopsis
  126. ~~~~~~~~
  127. .. c:struct:: audio_mixer
  128. .. code-block:: c
  129. typedef struct audio_mixer {
  130. unsigned int volume_left;
  131. unsigned int volume_right;
  132. } audio_mixer_t;
  133. Variables
  134. ~~~~~~~~~
  135. .. flat-table::
  136. :header-rows: 0
  137. :stub-columns: 0
  138. - ..
  139. - ``unsigned int volume_left``
  140. - Volume left channel.
  141. Valid range: 0 ... 255
  142. - ..
  143. - ``unsigned int volume_right``
  144. - Volume right channel.
  145. Valid range: 0 ... 255
  146. Description
  147. ~~~~~~~~~~~
  148. This structure is used by the `AUDIO_SET_MIXER`_ call to set the
  149. audio volume.
  150. -----
  151. audio_status
  152. ------------
  153. Synopsis
  154. ~~~~~~~~
  155. .. c:struct:: audio_status
  156. .. code-block:: c
  157. typedef struct audio_status {
  158. int AV_sync_state;
  159. int mute_state;
  160. audio_play_state_t play_state;
  161. audio_stream_source_t stream_source;
  162. audio_channel_select_t channel_select;
  163. int bypass_mode;
  164. audio_mixer_t mixer_state;
  165. } audio_status_t;
  166. Variables
  167. ~~~~~~~~~
  168. .. flat-table::
  169. :header-rows: 0
  170. :stub-columns: 0
  171. - ..
  172. - :rspan:`2` ``int AV_sync_state``
  173. - :cspan:`1` Shows if A/V synchronization is ON or OFF.
  174. - ..
  175. - TRUE ( != 0 )
  176. - AV-sync ON.
  177. - ..
  178. - FALSE ( == 0 )
  179. - AV-sync OFF.
  180. - ..
  181. - :rspan:`2` ``int mute_state``
  182. - :cspan:`1` Indicates if audio is muted or not.
  183. - ..
  184. - TRUE ( != 0 )
  185. - mute audio
  186. - ..
  187. - FALSE ( == 0 )
  188. - unmute audio
  189. - ..
  190. - `audio_play_state_t`_ ``play_state``
  191. - Current playback state.
  192. - ..
  193. - `audio_stream_source_t`_ ``stream_source``
  194. - Current source of the data.
  195. - ..
  196. - :rspan:`2` ``int bypass_mode``
  197. - :cspan:`1` Is the decoding of the current Audio stream in
  198. the DVB subsystem enabled or disabled.
  199. - ..
  200. - TRUE ( != 0 )
  201. - Bypass disabled.
  202. - ..
  203. - FALSE ( == 0 )
  204. - Bypass enabled.
  205. - ..
  206. - `audio_mixer_t`_ ``mixer_state``
  207. - Current volume settings.
  208. Description
  209. ~~~~~~~~~~~
  210. The `AUDIO_GET_STATUS`_ call returns this structure as information
  211. about various states of the playback operation.
  212. -----
  213. audio encodings
  214. ---------------
  215. Synopsis
  216. ~~~~~~~~
  217. .. code-block:: c
  218. #define AUDIO_CAP_DTS 1
  219. #define AUDIO_CAP_LPCM 2
  220. #define AUDIO_CAP_MP1 4
  221. #define AUDIO_CAP_MP2 8
  222. #define AUDIO_CAP_MP3 16
  223. #define AUDIO_CAP_AAC 32
  224. #define AUDIO_CAP_OGG 64
  225. #define AUDIO_CAP_SDDS 128
  226. #define AUDIO_CAP_AC3 256
  227. Constants
  228. ~~~~~~~~~
  229. .. flat-table::
  230. :header-rows: 0
  231. :stub-columns: 0
  232. - ..
  233. - ``AUDIO_CAP_DTS``
  234. - :cspan:`1` The hardware accepts DTS audio tracks.
  235. - ..
  236. - ``AUDIO_CAP_LPCM``
  237. - The hardware accepts uncompressed audio with
  238. Linear Pulse-Code Modulation (LPCM)
  239. - ..
  240. - ``AUDIO_CAP_MP1``
  241. - The hardware accepts MPEG-1 Audio Layer 1.
  242. - ..
  243. - ``AUDIO_CAP_MP2``
  244. - The hardware accepts MPEG-1 Audio Layer 2.
  245. Also known as MUSICAM.
  246. - ..
  247. - ``AUDIO_CAP_MP3``
  248. - The hardware accepts MPEG-1 Audio Layer III.
  249. Commomly known as .mp3.
  250. - ..
  251. - ``AUDIO_CAP_AAC``
  252. - The hardware accepts AAC (Advanced Audio Coding).
  253. - ..
  254. - ``AUDIO_CAP_OGG``
  255. - The hardware accepts Vorbis audio tracks.
  256. - ..
  257. - ``AUDIO_CAP_SDDS``
  258. - The hardware accepts Sony Dynamic Digital Sound (SDDS).
  259. - ..
  260. - ``AUDIO_CAP_AC3``
  261. - The hardware accepts Dolby Digital ATSC A/52 audio.
  262. Also known as AC-3.
  263. Description
  264. ~~~~~~~~~~~
  265. A call to `AUDIO_GET_CAPABILITIES`_ returns an unsigned integer with the
  266. following bits set according to the hardwares capabilities.
  267. -----
  268. Audio Function Calls
  269. ====================
  270. AUDIO_STOP
  271. ----------
  272. Synopsis
  273. ~~~~~~~~
  274. .. c:macro:: AUDIO_STOP
  275. .. code-block:: c
  276. int ioctl(int fd, int request = AUDIO_STOP)
  277. Arguments
  278. ~~~~~~~~~
  279. .. flat-table::
  280. :header-rows: 0
  281. :stub-columns: 0
  282. - ..
  283. - ``int fd``
  284. - File descriptor returned by a previous call to `open()`_.
  285. - ..
  286. - ``int request``
  287. - :cspan:`1` Equals ``AUDIO_STOP`` for this command.
  288. Description
  289. ~~~~~~~~~~~
  290. .. attention:: Do **not** use in new drivers!
  291. See: :ref:`legacy_dvb_decoder_notes`
  292. This ioctl call asks the Audio Device to stop playing the current
  293. stream.
  294. Return Value
  295. ~~~~~~~~~~~~
  296. On success 0 is returned, on error -1 and the ``errno`` variable is set
  297. appropriately. The generic error codes are described at the
  298. :ref:`Generic Error Codes <gen-errors>` chapter.
  299. -----
  300. AUDIO_PLAY
  301. ----------
  302. Synopsis
  303. ~~~~~~~~
  304. .. c:macro:: AUDIO_PLAY
  305. .. code-block:: c
  306. int ioctl(int fd, int request = AUDIO_PLAY)
  307. Arguments
  308. ~~~~~~~~~
  309. .. flat-table::
  310. :header-rows: 0
  311. :stub-columns: 0
  312. - ..
  313. - ``int fd``
  314. - File descriptor returned by a previous call to `open()`_.
  315. - ..
  316. - ``int request``
  317. - :cspan:`1` Equals ``AUDIO_PLAY`` for this command.
  318. Description
  319. ~~~~~~~~~~~
  320. .. attention:: Do **not** use in new drivers!
  321. See: :ref:`legacy_dvb_decoder_notes`
  322. This ioctl call asks the Audio Device to start playing an audio stream
  323. from the selected source.
  324. Return Value
  325. ~~~~~~~~~~~~
  326. On success 0 is returned, on error -1 and the ``errno`` variable is set
  327. appropriately. The generic error codes are described at the
  328. :ref:`Generic Error Codes <gen-errors>` chapter.
  329. -----
  330. AUDIO_PAUSE
  331. -----------
  332. Synopsis
  333. ~~~~~~~~
  334. .. c:macro:: AUDIO_PAUSE
  335. .. code-block:: c
  336. int ioctl(int fd, int request = AUDIO_PAUSE)
  337. Arguments
  338. ~~~~~~~~~
  339. .. flat-table::
  340. :header-rows: 0
  341. :stub-columns: 0
  342. - ..
  343. - ``int fd``
  344. - :cspan:`1` File descriptor returned by a previous call
  345. to `open()`_.
  346. - ..
  347. - ``int request``
  348. - Equals ``AUDIO_PAUSE`` for this command.
  349. Description
  350. ~~~~~~~~~~~
  351. .. attention:: Do **not** use in new drivers!
  352. See: :ref:`legacy_dvb_decoder_notes`
  353. This ioctl call suspends the audio stream being played. Decoding and
  354. playing are paused. It is then possible to restart again decoding and
  355. playing process of the audio stream using `AUDIO_CONTINUE`_ command.
  356. Return Value
  357. ~~~~~~~~~~~~
  358. On success 0 is returned, on error -1 and the ``errno`` variable is set
  359. appropriately. The generic error codes are described at the
  360. :ref:`Generic Error Codes <gen-errors>` chapter.
  361. -----
  362. AUDIO_CONTINUE
  363. --------------
  364. Synopsis
  365. ~~~~~~~~
  366. .. c:macro:: AUDIO_CONTINUE
  367. .. code-block:: c
  368. int ioctl(int fd, int request = AUDIO_CONTINUE)
  369. Arguments
  370. ~~~~~~~~~
  371. .. flat-table::
  372. :header-rows: 0
  373. :stub-columns: 0
  374. - ..
  375. - ``int fd``
  376. - :cspan:`1` File descriptor returned by a previous call
  377. to `open()`_.
  378. - ..
  379. - ``int request``
  380. - Equals ``AUDIO_CONTINUE`` for this command.
  381. Description
  382. ~~~~~~~~~~~
  383. .. attention:: Do **not** use in new drivers!
  384. See: :ref:`legacy_dvb_decoder_notes`
  385. This ioctl restarts the decoding and playing process previously paused
  386. with `AUDIO_PAUSE`_ command.
  387. Return Value
  388. ~~~~~~~~~~~~
  389. On success 0 is returned, on error -1 and the ``errno`` variable is set
  390. appropriately. The generic error codes are described at the
  391. :ref:`Generic Error Codes <gen-errors>` chapter.
  392. -----
  393. AUDIO_SELECT_SOURCE
  394. -------------------
  395. Synopsis
  396. ~~~~~~~~
  397. .. c:macro:: AUDIO_SELECT_SOURCE
  398. .. code-block:: c
  399. int ioctl(int fd, int request = AUDIO_SELECT_SOURCE,
  400. audio_stream_source_t source)
  401. Arguments
  402. ~~~~~~~~~
  403. .. flat-table::
  404. :header-rows: 0
  405. :stub-columns: 0
  406. - ..
  407. - ``int fd``
  408. - :cspan:`1` File descriptor returned by a previous call
  409. to `open()`_.
  410. - ..
  411. - ``int request``
  412. - Equals ``AUDIO_SELECT_SOURCE`` for this command.
  413. - ..
  414. - `audio_stream_source_t`_ ``source``
  415. - Indicates the source that shall be used for the Audio stream.
  416. Description
  417. ~~~~~~~~~~~
  418. .. attention:: Do **not** use in new drivers!
  419. See: :ref:`legacy_dvb_decoder_notes`
  420. This ioctl call informs the audio device which source shall be used for
  421. the input data. The possible sources are demux or memory. If
  422. ``AUDIO_SOURCE_MEMORY`` is selected, the data is fed to the Audio Device
  423. through the write command. If ``AUDIO_SOURCE_DEMUX`` is selected, the data
  424. is directly transferred from the onboard demux-device to the decoder.
  425. Note: This only supports DVB-devices with one demux and one decoder so far.
  426. Return Value
  427. ~~~~~~~~~~~~
  428. On success 0 is returned, on error -1 and the ``errno`` variable is set
  429. appropriately. The generic error codes are described at the
  430. :ref:`Generic Error Codes <gen-errors>` chapter.
  431. -----
  432. AUDIO_SET_MUTE
  433. --------------
  434. Synopsis
  435. ~~~~~~~~
  436. .. c:macro:: AUDIO_SET_MUTE
  437. .. code-block:: c
  438. int ioctl(int fd, int request = AUDIO_SET_MUTE, int state)
  439. Arguments
  440. ~~~~~~~~~
  441. .. flat-table::
  442. :header-rows: 0
  443. :stub-columns: 0
  444. - ..
  445. - ``int fd``
  446. - :cspan:`1` File descriptor returned by a previous call
  447. to `open()`_.
  448. - ..
  449. - ``int request``
  450. - :cspan:`1` Equals ``AUDIO_SET_MUTE`` for this command.
  451. - ..
  452. - :rspan:`2` ``int state``
  453. - :cspan:`1` Indicates if audio device shall mute or not.
  454. - ..
  455. - TRUE ( != 0 )
  456. - mute audio
  457. - ..
  458. - FALSE ( == 0 )
  459. - unmute audio
  460. Description
  461. ~~~~~~~~~~~
  462. .. attention:: Do **not** use in new drivers!
  463. See: :ref:`legacy_dvb_decoder_notes`
  464. This ioctl is for DVB devices only. To control a V4L2 decoder use the
  465. V4L2 :ref:`VIDIOC_DECODER_CMD` with the
  466. ``V4L2_DEC_CMD_START_MUTE_AUDIO`` flag instead.
  467. This ioctl call asks the audio device to mute the stream that is
  468. currently being played.
  469. Return Value
  470. ~~~~~~~~~~~~
  471. On success 0 is returned, on error -1 and the ``errno`` variable is set
  472. appropriately. The generic error codes are described at the
  473. :ref:`Generic Error Codes <gen-errors>` chapter.
  474. -----
  475. AUDIO_SET_AV_SYNC
  476. -----------------
  477. Synopsis
  478. ~~~~~~~~
  479. .. c:macro:: AUDIO_SET_AV_SYNC
  480. .. code-block:: c
  481. int ioctl(int fd, int request = AUDIO_SET_AV_SYNC, int state)
  482. Arguments
  483. ~~~~~~~~~
  484. .. flat-table::
  485. :header-rows: 0
  486. :stub-columns: 0
  487. - ..
  488. - ``int fd``
  489. - :cspan:`1` File descriptor returned by a previous call
  490. to `open()`_.
  491. - ..
  492. - ``int request``
  493. - :cspan:`1` Equals ``AUDIO_AV_SYNC`` for this command.
  494. - ..
  495. - :rspan:`2` ``int state``
  496. - :cspan:`1` Tells the DVB subsystem if A/V synchronization
  497. shall be ON or OFF.
  498. - ..
  499. - TRUE ( != 0 )
  500. - AV-sync ON.
  501. - ..
  502. - FALSE ( == 0 )
  503. - AV-sync OFF.
  504. Description
  505. ~~~~~~~~~~~
  506. .. attention:: Do **not** use in new drivers!
  507. See: :ref:`legacy_dvb_decoder_notes`
  508. This ioctl call asks the Audio Device to turn ON or OFF A/V
  509. synchronization.
  510. Return Value
  511. ~~~~~~~~~~~~
  512. On success 0 is returned, on error -1 and the ``errno`` variable is set
  513. appropriately. The generic error codes are described at the
  514. :ref:`Generic Error Codes <gen-errors>` chapter.
  515. -----
  516. AUDIO_SET_BYPASS_MODE
  517. ---------------------
  518. Synopsis
  519. ~~~~~~~~
  520. .. c:macro:: AUDIO_SET_BYPASS_MODE
  521. .. code-block:: c
  522. int ioctl(int fd, int request = AUDIO_SET_BYPASS_MODE, int mode)
  523. Arguments
  524. ~~~~~~~~~
  525. .. flat-table::
  526. :header-rows: 0
  527. :stub-columns: 0
  528. - ..
  529. - ``int fd``
  530. - :cspan:`1` File descriptor returned by a previous call
  531. to `open()`_.
  532. - ..
  533. - ``int request``
  534. - :cspan:`1` Equals ``AUDIO_SET_BYPASS_MODE`` for this command.
  535. - ..
  536. - :rspan:`2` ``int mode``
  537. - :cspan:`1` Enables or disables the decoding of the current
  538. Audio stream in the DVB subsystem.
  539. - ..
  540. - TRUE ( != 0 )
  541. - Disable bypass
  542. - ..
  543. - FALSE ( == 0 )
  544. - Enable bypass
  545. Description
  546. ~~~~~~~~~~~
  547. .. attention:: Do **not** use in new drivers!
  548. See: :ref:`legacy_dvb_decoder_notes`
  549. This ioctl call asks the Audio Device to bypass the Audio decoder and
  550. forward the stream without decoding. This mode shall be used if streams
  551. that can’t be handled by the DVB system shall be decoded. Dolby
  552. DigitalTM streams are automatically forwarded by the DVB subsystem if
  553. the hardware can handle it.
  554. Return Value
  555. ~~~~~~~~~~~~
  556. On success 0 is returned, on error -1 and the ``errno`` variable is set
  557. appropriately. The generic error codes are described at the
  558. :ref:`Generic Error Codes <gen-errors>` chapter.
  559. -----
  560. AUDIO_CHANNEL_SELECT
  561. --------------------
  562. Synopsis
  563. ~~~~~~~~
  564. .. c:macro:: AUDIO_CHANNEL_SELECT
  565. .. code-block:: c
  566. int ioctl(int fd, int request = AUDIO_CHANNEL_SELECT,
  567. audio_channel_select_t)
  568. Arguments
  569. ~~~~~~~~~
  570. .. flat-table::
  571. :header-rows: 0
  572. :stub-columns: 0
  573. - ..
  574. - ``int fd``
  575. - :cspan:`1` File descriptor returned by a previous call
  576. to `open()`_.
  577. - ..
  578. - ``int request``
  579. - Equals ``AUDIO_CHANNEL_SELECT`` for this command.
  580. - ..
  581. - `audio_channel_select_t`_ ``ch``
  582. - Select the output format of the audio (mono left/right, stereo).
  583. Description
  584. ~~~~~~~~~~~
  585. .. attention:: Do **not** use in new drivers!
  586. See: :ref:`legacy_dvb_decoder_notes`
  587. This ioctl is for DVB devices only. To control a V4L2 decoder use the
  588. V4L2 ``V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK`` control instead.
  589. This ioctl call asks the Audio Device to select the requested channel if
  590. possible.
  591. Return Value
  592. ~~~~~~~~~~~~
  593. On success 0 is returned, on error -1 and the ``errno`` variable is set
  594. appropriately. The generic error codes are described at the
  595. :ref:`Generic Error Codes <gen-errors>` chapter.
  596. -----
  597. AUDIO_GET_STATUS
  598. ----------------
  599. Synopsis
  600. ~~~~~~~~
  601. .. c:macro:: AUDIO_GET_STATUS
  602. .. code-block:: c
  603. int ioctl(int fd, int request = AUDIO_GET_STATUS,
  604. struct audio_status *status)
  605. Arguments
  606. ~~~~~~~~~
  607. .. flat-table::
  608. :header-rows: 0
  609. :stub-columns: 0
  610. - ..
  611. - ``int fd``
  612. - :cspan:`1` File descriptor returned by a previous call
  613. to `open()`_.
  614. - ..
  615. - ``int request``
  616. - Equals AUDIO_GET_STATUS for this command.
  617. - ..
  618. - ``struct`` `audio_status`_ ``*status``
  619. - Returns the current state of Audio Device.
  620. Description
  621. ~~~~~~~~~~~
  622. .. attention:: Do **not** use in new drivers!
  623. See: :ref:`legacy_dvb_decoder_notes`
  624. This ioctl call asks the Audio Device to return the current state of the
  625. Audio Device.
  626. Return Value
  627. ~~~~~~~~~~~~
  628. On success 0 is returned, on error -1 and the ``errno`` variable is set
  629. appropriately. The generic error codes are described at the
  630. :ref:`Generic Error Codes <gen-errors>` chapter.
  631. -----
  632. AUDIO_GET_CAPABILITIES
  633. ----------------------
  634. Synopsis
  635. ~~~~~~~~
  636. .. c:macro:: AUDIO_GET_CAPABILITIES
  637. .. code-block:: c
  638. int ioctl(int fd, int request = AUDIO_GET_CAPABILITIES,
  639. unsigned int *cap)
  640. Arguments
  641. ~~~~~~~~~
  642. .. flat-table::
  643. :header-rows: 0
  644. :stub-columns: 0
  645. - ..
  646. - ``int fd``
  647. - :cspan:`1` File descriptor returned by a previous call
  648. to `open()`_.
  649. - ..
  650. - ``int request``
  651. - Equals ``AUDIO_GET_CAPABILITIES`` for this command.
  652. - ..
  653. - ``unsigned int *cap``
  654. - Returns a bit array of supported sound formats.
  655. Bits are defined in `audio encodings`_.
  656. Description
  657. ~~~~~~~~~~~
  658. .. attention:: Do **not** use in new drivers!
  659. See: :ref:`legacy_dvb_decoder_notes`
  660. This ioctl call asks the Audio Device to tell us about the decoding
  661. capabilities of the audio hardware.
  662. Return Value
  663. ~~~~~~~~~~~~
  664. On success 0 is returned, on error -1 and the ``errno`` variable is set
  665. appropriately. The generic error codes are described at the
  666. :ref:`Generic Error Codes <gen-errors>` chapter.
  667. -----
  668. AUDIO_CLEAR_BUFFER
  669. ------------------
  670. Synopsis
  671. ~~~~~~~~
  672. .. c:macro:: AUDIO_CLEAR_BUFFER
  673. .. code-block:: c
  674. int ioctl(int fd, int request = AUDIO_CLEAR_BUFFER)
  675. Arguments
  676. ~~~~~~~~~
  677. .. flat-table::
  678. :header-rows: 0
  679. :stub-columns: 0
  680. - ..
  681. - ``int fd``
  682. - :cspan:`1` File descriptor returned by a previous call
  683. to `open()`_.
  684. - ..
  685. - ``int request``
  686. - Equals ``AUDIO_CLEAR_BUFFER`` for this command.
  687. Description
  688. ~~~~~~~~~~~
  689. .. attention:: Do **not** use in new drivers!
  690. See: :ref:`legacy_dvb_decoder_notes`
  691. This ioctl call asks the Audio Device to clear all software and hardware
  692. buffers of the audio decoder device.
  693. Return Value
  694. ~~~~~~~~~~~~
  695. On success 0 is returned, on error -1 and the ``errno`` variable is set
  696. appropriately. The generic error codes are described at the
  697. :ref:`Generic Error Codes <gen-errors>` chapter.
  698. -----
  699. AUDIO_SET_ID
  700. ------------
  701. Synopsis
  702. ~~~~~~~~
  703. .. c:macro:: AUDIO_SET_ID
  704. .. code-block:: c
  705. int ioctl(int fd, int request = AUDIO_SET_ID, int id)
  706. Arguments
  707. ~~~~~~~~~
  708. .. flat-table::
  709. :header-rows: 0
  710. :stub-columns: 0
  711. - ..
  712. - ``int fd``
  713. - :cspan:`1` File descriptor returned by a previous call
  714. to `open()`_.
  715. - ..
  716. - ``int request``
  717. - Equals ``AUDIO_SET_ID`` for this command.
  718. - ..
  719. - ``int id``
  720. - Audio sub-stream id.
  721. Description
  722. ~~~~~~~~~~~
  723. .. attention:: Do **not** use in new drivers!
  724. See: :ref:`legacy_dvb_decoder_notes`
  725. This ioctl selects which sub-stream is to be decoded if a program or
  726. system stream is sent to the video device.
  727. If no audio stream type is set the id has to be in range [0xC0,0xDF]
  728. for MPEG sound, in [0x80,0x87] for AC3 and in [0xA0,0xA7] for LPCM.
  729. See ITU-T H.222.0 | ISO/IEC 13818-1 for further description.
  730. If the stream type is set with `AUDIO_SET_STREAMTYPE`_, specifies the
  731. id just the sub-stream id of the audio stream and only the first 5 bits
  732. (& 0x1F) are recognized.
  733. Return Value
  734. ~~~~~~~~~~~~
  735. On success 0 is returned, on error -1 and the ``errno`` variable is set
  736. appropriately. The generic error codes are described at the
  737. :ref:`Generic Error Codes <gen-errors>` chapter.
  738. -----
  739. AUDIO_SET_MIXER
  740. ---------------
  741. Synopsis
  742. ~~~~~~~~
  743. .. c:macro:: AUDIO_SET_MIXER
  744. .. code-block:: c
  745. int ioctl(int fd, int request = AUDIO_SET_MIXER, audio_mixer_t *mix)
  746. Arguments
  747. ~~~~~~~~~
  748. .. flat-table::
  749. :header-rows: 0
  750. :stub-columns: 0
  751. - ..
  752. - ``int fd``
  753. - :cspan:`1` File descriptor returned by a previous call
  754. to `open()`_.
  755. - ..
  756. - ``int request``
  757. - Equals ``AUDIO_SET_MIXER`` for this command.
  758. - ..
  759. - ``audio_mixer_t *mix``
  760. - Mixer settings.
  761. Description
  762. ~~~~~~~~~~~
  763. .. attention:: Do **not** use in new drivers!
  764. See: :ref:`legacy_dvb_decoder_notes`
  765. This ioctl lets you adjust the mixer settings of the audio decoder.
  766. Return Value
  767. ~~~~~~~~~~~~
  768. On success 0 is returned, on error -1 and the ``errno`` variable is set
  769. appropriately. The generic error codes are described at the
  770. :ref:`Generic Error Codes <gen-errors>` chapter.
  771. -----
  772. AUDIO_SET_STREAMTYPE
  773. --------------------
  774. Synopsis
  775. ~~~~~~~~
  776. .. c:macro:: AUDIO_SET_STREAMTYPE
  777. .. code-block:: c
  778. int ioctl(fd, int request = AUDIO_SET_STREAMTYPE, int type)
  779. Arguments
  780. ~~~~~~~~~
  781. .. flat-table::
  782. :header-rows: 0
  783. :stub-columns: 0
  784. - ..
  785. - ``int fd``
  786. - :cspan:`1` File descriptor returned by a previous call
  787. to `open()`_.
  788. - ..
  789. - ``int request``
  790. - Equals ``AUDIO_SET_STREAMTYPE`` for this command.
  791. - ..
  792. - ``int type``
  793. - Stream type.
  794. Description
  795. ~~~~~~~~~~~
  796. .. attention:: Do **not** use in new drivers!
  797. See: :ref:`legacy_dvb_decoder_notes`
  798. This ioctl tells the driver which kind of audio stream to expect. This
  799. is useful if the stream offers several audio sub-streams like LPCM and
  800. AC3.
  801. Stream types defined in ITU-T H.222.0 | ISO/IEC 13818-1 are used.
  802. Return Value
  803. ~~~~~~~~~~~~
  804. On success 0 is returned, on error -1 and the ``errno`` variable is set
  805. appropriately. The generic error codes are described at the
  806. :ref:`Generic Error Codes <gen-errors>` chapter.
  807. .. flat-table::
  808. :header-rows: 0
  809. :stub-columns: 0
  810. - ..
  811. - ``EINVAL``
  812. - Type is not a valid or supported stream type.
  813. -----
  814. AUDIO_BILINGUAL_CHANNEL_SELECT
  815. ------------------------------
  816. Synopsis
  817. ~~~~~~~~
  818. .. c:macro:: AUDIO_BILINGUAL_CHANNEL_SELECT
  819. .. code-block:: c
  820. int ioctl(int fd, int request = AUDIO_BILINGUAL_CHANNEL_SELECT,
  821. audio_channel_select_t)
  822. Arguments
  823. ~~~~~~~~~
  824. .. flat-table::
  825. :header-rows: 0
  826. :stub-columns: 0
  827. - ..
  828. - ``int fd``
  829. - :cspan:`1` File descriptor returned by a previous call
  830. to `open()`_.
  831. - ..
  832. - ``int request``
  833. - Equals ``AUDIO_BILINGUAL_CHANNEL_SELECT`` for this command.
  834. - ..
  835. - ``audio_channel_select_t ch``
  836. - Select the output format of the audio (mono left/right, stereo).
  837. Description
  838. ~~~~~~~~~~~
  839. .. attention:: Do **not** use in new drivers!
  840. See: :ref:`legacy_dvb_decoder_notes`
  841. This ioctl has been replaced by the V4L2
  842. ``V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK`` control
  843. for MPEG decoders controlled through V4L2.
  844. This ioctl call asks the Audio Device to select the requested channel
  845. for bilingual streams if possible.
  846. Return Value
  847. ~~~~~~~~~~~~
  848. On success 0 is returned, on error -1 and the ``errno`` variable is set
  849. appropriately. The generic error codes are described at the
  850. :ref:`Generic Error Codes <gen-errors>` chapter.
  851. -----
  852. open()
  853. ------
  854. Synopsis
  855. ~~~~~~~~
  856. .. code-block:: c
  857. #include <fcntl.h>
  858. .. c:function:: int open(const char *deviceName, int flags)
  859. Arguments
  860. ~~~~~~~~~
  861. .. flat-table::
  862. :header-rows: 0
  863. :stub-columns: 0
  864. - ..
  865. - ``const char *deviceName``
  866. - Name of specific audio device.
  867. - ..
  868. - :rspan:`3` ``int flags``
  869. - :cspan:`1` A bit-wise OR of the following flags:
  870. - ..
  871. - ``O_RDONLY``
  872. - read-only access
  873. - ..
  874. - ``O_RDWR``
  875. - read/write access
  876. - ..
  877. - ``O_NONBLOCK``
  878. - | Open in non-blocking mode
  879. | (blocking mode is the default)
  880. Description
  881. ~~~~~~~~~~~
  882. This system call opens a named audio device (e.g.
  883. ``/dev/dvb/adapter0/audio0``) for subsequent use. When an open() call has
  884. succeeded, the device will be ready for use. The significance of
  885. blocking or non-blocking mode is described in the documentation for
  886. functions where there is a difference. It does not affect the semantics
  887. of the open() call itself. A device opened in blocking mode can later be
  888. put into non-blocking mode (and vice versa) using the F_SETFL command
  889. of the fcntl system call. This is a standard system call, documented in
  890. the Linux manual page for fcntl. Only one user can open the Audio Device
  891. in O_RDWR mode. All other attempts to open the device in this mode will
  892. fail, and an error code will be returned. If the Audio Device is opened
  893. in O_RDONLY mode, the only ioctl call that can be used is
  894. `AUDIO_GET_STATUS`_. All other call will return with an error code.
  895. Return Value
  896. ~~~~~~~~~~~~
  897. .. flat-table::
  898. :header-rows: 0
  899. :stub-columns: 0
  900. - ..
  901. - ``ENODEV``
  902. - Device driver not loaded/available.
  903. - ..
  904. - ``EBUSY``
  905. - Device or resource busy.
  906. - ..
  907. - ``EINVAL``
  908. - Invalid argument.
  909. -----
  910. close()
  911. -------
  912. Synopsis
  913. ~~~~~~~~
  914. .. c:function:: int close(int fd)
  915. Arguments
  916. ~~~~~~~~~
  917. .. flat-table::
  918. :header-rows: 0
  919. :stub-columns: 0
  920. - ..
  921. - ``int fd``
  922. - :cspan:`1` File descriptor returned by a previous call
  923. to `open()`_.
  924. Description
  925. ~~~~~~~~~~~
  926. This system call closes a previously opened audio device.
  927. Return Value
  928. ~~~~~~~~~~~~
  929. .. flat-table::
  930. :header-rows: 0
  931. :stub-columns: 0
  932. - ..
  933. - ``EBADF``
  934. - Fd is not a valid open file descriptor.
  935. -----
  936. write()
  937. -------
  938. Synopsis
  939. ~~~~~~~~
  940. .. code-block:: c
  941. size_t write(int fd, const void *buf, size_t count)
  942. Arguments
  943. ~~~~~~~~~
  944. .. flat-table::
  945. :header-rows: 0
  946. :stub-columns: 0
  947. - ..
  948. - ``int fd``
  949. - :cspan:`1` File descriptor returned by a previous call
  950. to `open()`_.
  951. - ..
  952. - ``void *buf``
  953. - Pointer to the buffer containing the PES data.
  954. - ..
  955. - ``size_t count``
  956. - Size of buf.
  957. Description
  958. ~~~~~~~~~~~
  959. This system call can only be used if ``AUDIO_SOURCE_MEMORY`` is selected
  960. in the ioctl call `AUDIO_SELECT_SOURCE`_. The data provided shall be in
  961. PES format. If ``O_NONBLOCK`` is not specified the function will block
  962. until buffer space is available. The amount of data to be transferred is
  963. implied by count.
  964. Return Value
  965. ~~~~~~~~~~~~
  966. .. flat-table::
  967. :header-rows: 0
  968. :stub-columns: 0
  969. - ..
  970. - ``EPERM``
  971. - :cspan:`1` Mode ``AUDIO_SOURCE_MEMORY`` not selected.
  972. - ..
  973. - ``ENOMEM``
  974. - Attempted to write more data than the internal buffer can hold.
  975. - ..
  976. - ``EBADF``
  977. - Fd is not a valid open file descriptor.