Merge tag 'for-4.21/block-20190102' of git://git.kernel.dk/linux-block
[sfrench/cifs-2.6.git] / Documentation / media / uapi / dvb / audio_data_types.rst
1 .. Permission is granted to copy, distribute and/or modify this
2 .. document under the terms of the GNU Free Documentation License,
3 .. Version 1.1 or any later version published by the Free Software
4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
5 .. and no Back-Cover Texts. A copy of the license is included at
6 .. Documentation/media/uapi/fdl-appendix.rst.
7 ..
8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10 .. _audio_data_types:
11
12 ****************
13 Audio Data Types
14 ****************
15
16 This section describes the structures, data types and defines used when
17 talking to the audio device.
18
19 .. c:type:: audio_stream_source
20
21 The audio stream source is set through the AUDIO_SELECT_SOURCE call
22 and can take the following values, depending on whether we are replaying
23 from an internal (demux) or external (user write) source.
24
25
26 .. code-block:: c
27
28     typedef enum {
29         AUDIO_SOURCE_DEMUX,
30         AUDIO_SOURCE_MEMORY
31     } audio_stream_source_t;
32
33 AUDIO_SOURCE_DEMUX selects the demultiplexer (fed either by the
34 frontend or the DVR device) as the source of the video stream. If
35 AUDIO_SOURCE_MEMORY is selected the stream comes from the application
36 through the ``write()`` system call.
37
38
39 .. c:type:: audio_play_state
40
41 The following values can be returned by the AUDIO_GET_STATUS call
42 representing the state of audio playback.
43
44
45 .. code-block:: c
46
47     typedef enum {
48         AUDIO_STOPPED,
49         AUDIO_PLAYING,
50         AUDIO_PAUSED
51     } audio_play_state_t;
52
53
54 .. c:type:: audio_channel_select
55
56 The audio channel selected via AUDIO_CHANNEL_SELECT is determined by
57 the following values.
58
59
60 .. code-block:: c
61
62     typedef enum {
63         AUDIO_STEREO,
64         AUDIO_MONO_LEFT,
65         AUDIO_MONO_RIGHT,
66         AUDIO_MONO,
67         AUDIO_STEREO_SWAPPED
68     } audio_channel_select_t;
69
70
71 .. c:type:: audio_status
72
73 The AUDIO_GET_STATUS call returns the following structure informing
74 about various states of the playback operation.
75
76
77 .. code-block:: c
78
79     typedef struct audio_status {
80         boolean AV_sync_state;
81         boolean mute_state;
82         audio_play_state_t play_state;
83         audio_stream_source_t stream_source;
84         audio_channel_select_t channel_select;
85         boolean bypass_mode;
86         audio_mixer_t mixer_state;
87     } audio_status_t;
88
89
90 .. c:type:: audio_mixer
91
92 The following structure is used by the AUDIO_SET_MIXER call to set the
93 audio volume.
94
95
96 .. code-block:: c
97
98     typedef struct audio_mixer {
99         unsigned int volume_left;
100         unsigned int volume_right;
101     } audio_mixer_t;
102
103
104 .. _audio_encodings:
105
106 audio encodings
107 ===============
108
109 A call to AUDIO_GET_CAPABILITIES returns an unsigned integer with the
110 following bits set according to the hardwares capabilities.
111
112
113 .. code-block:: c
114
115      #define AUDIO_CAP_DTS    1
116      #define AUDIO_CAP_LPCM   2
117      #define AUDIO_CAP_MP1    4
118      #define AUDIO_CAP_MP2    8
119      #define AUDIO_CAP_MP3   16
120      #define AUDIO_CAP_AAC   32
121      #define AUDIO_CAP_OGG   64
122      #define AUDIO_CAP_SDDS 128
123      #define AUDIO_CAP_AC3  256