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