Merge tag 'metag-for-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan...
[sfrench/cifs-2.6.git] / Documentation / media / uapi / dvb / audio_data_types.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _audio_data_types:
4
5 ****************
6 Audio Data Types
7 ****************
8
9 This section describes the structures, data types and defines used when
10 talking to the audio device.
11
12
13 .. _audio-stream-source-t:
14
15 audio_stream_source_t
16 =====================
17
18 The audio stream source is set through the AUDIO_SELECT_SOURCE call
19 and can take the following values, depending on whether we are replaying
20 from an internal (demux) or external (user write) source.
21
22
23 .. code-block:: c
24
25     typedef enum {
26         AUDIO_SOURCE_DEMUX,
27         AUDIO_SOURCE_MEMORY
28     } audio_stream_source_t;
29
30 AUDIO_SOURCE_DEMUX selects the demultiplexer (fed either by the
31 frontend or the DVR device) as the source of the video stream. If
32 AUDIO_SOURCE_MEMORY is selected the stream comes from the application
33 through the ``write()`` system call.
34
35
36 .. _audio-play-state-t:
37
38 audio_play_state_t
39 ==================
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 .. _audio-channel-select-t:
55
56 audio_channel_select_t
57 ======================
58
59 The audio channel selected via AUDIO_CHANNEL_SELECT is determined by
60 the following values.
61
62
63 .. code-block:: c
64
65     typedef enum {
66         AUDIO_STEREO,
67         AUDIO_MONO_LEFT,
68         AUDIO_MONO_RIGHT,
69         AUDIO_MONO,
70         AUDIO_STEREO_SWAPPED
71     } audio_channel_select_t;
72
73
74 .. _audio-status:
75
76 struct audio_status
77 ===================
78
79 The AUDIO_GET_STATUS call returns the following structure informing
80 about various states of the playback operation.
81
82
83 .. code-block:: c
84
85     typedef struct audio_status {
86         boolean AV_sync_state;
87         boolean mute_state;
88         audio_play_state_t play_state;
89         audio_stream_source_t stream_source;
90         audio_channel_select_t channel_select;
91         boolean bypass_mode;
92         audio_mixer_t mixer_state;
93     } audio_status_t;
94
95
96 .. _audio-mixer:
97
98 struct audio_mixer
99 ==================
100
101 The following structure is used by the AUDIO_SET_MIXER call to set the
102 audio volume.
103
104
105 .. code-block:: c
106
107     typedef struct audio_mixer {
108         unsigned int volume_left;
109         unsigned int volume_right;
110     } audio_mixer_t;
111
112
113 .. _audio_encodings:
114
115 audio encodings
116 ===============
117
118 A call to AUDIO_GET_CAPABILITIES returns an unsigned integer with the
119 following bits set according to the hardwares capabilities.
120
121
122 .. code-block:: c
123
124      #define AUDIO_CAP_DTS    1
125      #define AUDIO_CAP_LPCM   2
126      #define AUDIO_CAP_MP1    4
127      #define AUDIO_CAP_MP2    8
128      #define AUDIO_CAP_MP3   16
129      #define AUDIO_CAP_AAC   32
130      #define AUDIO_CAP_OGG   64
131      #define AUDIO_CAP_SDDS 128
132      #define AUDIO_CAP_AC3  256
133
134
135 .. _audio-karaoke:
136
137 struct audio_karaoke
138 ====================
139
140 The ioctl AUDIO_SET_KARAOKE uses the following format:
141
142
143 .. code-block:: c
144
145     typedef
146     struct audio_karaoke {
147         int vocal1;
148         int vocal2;
149         int melody;
150     } audio_karaoke_t;
151
152 If Vocal1 or Vocal2 are non-zero, they get mixed into left and right t
153 at 70% each. If both, Vocal1 and Vocal2 are non-zero, Vocal1 gets mixed
154 into the left channel and Vocal2 into the right channel at 100% each. Ff
155 Melody is non-zero, the melody channel gets mixed into left and right.
156
157
158 .. _audio-attributes-t:
159
160 audio attributes
161 ================
162
163 The following attributes can be set by a call to AUDIO_SET_ATTRIBUTES:
164
165
166 .. code-block:: c
167
168      typedef uint16_t audio_attributes_t;
169      /*   bits: descr. */
170      /*   15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */
171      /*   12    multichannel extension */
172      /*   11-10 audio type (0=not spec, 1=language included) */
173      /*    9- 8 audio application mode (0=not spec, 1=karaoke, 2=surround) */
174      /*    7- 6 Quantization / DRC (mpeg audio: 1=DRC exists)(lpcm: 0=16bit,  */
175      /*    5- 4 Sample frequency fs (0=48kHz, 1=96kHz) */
176      /*    2- 0 number of audio channels (n+1 channels) */