Commit | Line | Data |
---|---|---|
5377d91f MH |
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 | ||
836cf1db | 12 | .. c:type:: audio_stream_source |
5377d91f MH |
13 | |
14 | The audio stream source is set through the AUDIO_SELECT_SOURCE call | |
15 | and can take the following values, depending on whether we are replaying | |
16 | from an internal (demux) or external (user write) source. | |
17 | ||
18 | ||
19 | .. code-block:: c | |
20 | ||
21 | typedef enum { | |
0579e6e3 MCC |
22 | AUDIO_SOURCE_DEMUX, |
23 | AUDIO_SOURCE_MEMORY | |
5377d91f MH |
24 | } audio_stream_source_t; |
25 | ||
26 | AUDIO_SOURCE_DEMUX selects the demultiplexer (fed either by the | |
27 | frontend or the DVR device) as the source of the video stream. If | |
28 | AUDIO_SOURCE_MEMORY is selected the stream comes from the application | |
29 | through the ``write()`` system call. | |
30 | ||
31 | ||
836cf1db | 32 | .. c:type:: audio_play_state |
5377d91f MH |
33 | |
34 | The following values can be returned by the AUDIO_GET_STATUS call | |
35 | representing the state of audio playback. | |
36 | ||
37 | ||
38 | .. code-block:: c | |
39 | ||
40 | typedef enum { | |
0579e6e3 MCC |
41 | AUDIO_STOPPED, |
42 | AUDIO_PLAYING, | |
43 | AUDIO_PAUSED | |
5377d91f MH |
44 | } audio_play_state_t; |
45 | ||
46 | ||
836cf1db | 47 | .. c:type:: audio_channel_select |
5377d91f MH |
48 | |
49 | The audio channel selected via AUDIO_CHANNEL_SELECT is determined by | |
50 | the following values. | |
51 | ||
52 | ||
53 | .. code-block:: c | |
54 | ||
55 | typedef enum { | |
0579e6e3 MCC |
56 | AUDIO_STEREO, |
57 | AUDIO_MONO_LEFT, | |
58 | AUDIO_MONO_RIGHT, | |
59 | AUDIO_MONO, | |
60 | AUDIO_STEREO_SWAPPED | |
5377d91f MH |
61 | } audio_channel_select_t; |
62 | ||
63 | ||
e8be7e97 | 64 | .. c:type:: audio_status |
5377d91f | 65 | |
5377d91f MH |
66 | The AUDIO_GET_STATUS call returns the following structure informing |
67 | about various states of the playback operation. | |
68 | ||
69 | ||
70 | .. code-block:: c | |
71 | ||
72 | typedef struct audio_status { | |
0579e6e3 MCC |
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; | |
5377d91f MH |
80 | } audio_status_t; |
81 | ||
82 | ||
e8be7e97 | 83 | .. c:type:: audio_mixer |
5377d91f | 84 | |
5377d91f MH |
85 | The following structure is used by the AUDIO_SET_MIXER call to set the |
86 | audio volume. | |
87 | ||
88 | ||
89 | .. code-block:: c | |
90 | ||
91 | typedef struct audio_mixer { | |
0579e6e3 MCC |
92 | unsigned int volume_left; |
93 | unsigned int volume_right; | |
5377d91f MH |
94 | } audio_mixer_t; |
95 | ||
96 | ||
97 | .. _audio_encodings: | |
98 | ||
99 | audio encodings | |
100 | =============== | |
101 | ||
102 | A call to AUDIO_GET_CAPABILITIES returns an unsigned integer with the | |
103 | following 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 | ||
e8be7e97 | 118 | .. c:type:: audio_karaoke |
5377d91f | 119 | |
5377d91f MH |
120 | The ioctl AUDIO_SET_KARAOKE uses the following format: |
121 | ||
122 | ||
123 | .. code-block:: c | |
124 | ||
125 | typedef | |
126 | struct audio_karaoke { | |
0579e6e3 MCC |
127 | int vocal1; |
128 | int vocal2; | |
129 | int melody; | |
5377d91f MH |
130 | } audio_karaoke_t; |
131 | ||
132 | If Vocal1 or Vocal2 are non-zero, they get mixed into left and right t | |
133 | at 70% each. If both, Vocal1 and Vocal2 are non-zero, Vocal1 gets mixed | |
134 | into the left channel and Vocal2 into the right channel at 100% each. Ff | |
135 | Melody is non-zero, the melody channel gets mixed into left and right. | |
136 | ||
137 | ||
836cf1db | 138 | .. c:type:: audio_attributes |
5377d91f MH |
139 | |
140 | The following attributes can be set by a call to AUDIO_SET_ATTRIBUTES: | |
141 | ||
142 | ||
143 | .. code-block:: c | |
144 | ||
145 | typedef uint16_t audio_attributes_t; | |
146 | /* bits: descr. */ | |
147 | /* 15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */ | |
148 | /* 12 multichannel extension */ | |
149 | /* 11-10 audio type (0=not spec, 1=language included) */ | |
150 | /* 9- 8 audio application mode (0=not spec, 1=karaoke, 2=surround) */ | |
151 | /* 7- 6 Quantization / DRC (mpeg audio: 1=DRC exists)(lpcm: 0=16bit, */ | |
152 | /* 5- 4 Sample frequency fs (0=48kHz, 1=96kHz) */ | |
153 | /* 2- 0 number of audio channels (n+1 channels) */ |