1 /* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
5 * * Redistributions of source code must retain the above copyright
6 * notice, this list of conditions and the following disclaimer.
7 * * Redistributions in binary form must reproduce the above copyright
8 * notice, this list of conditions and the following disclaimer in the
9 * documentation and/or other materials provided with the distribution.
10 * * Neither the name of Code Aurora nor
11 * the names of its contributors may be used to endorse or promote
12 * products derived from this software without specific prior written
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #ifndef __ADSP_AUDIO_MEDIA_FORMAT_H
30 #define __ADSP_AUDIO_MEDIA_FORMAT_H
34 /* Supported audio media formats */
36 /* format block in shmem */
37 #define ADSP_AUDIO_FORMAT_SHAREDMEMORY 0x01091a78
38 /* adsp_audio_format_raw_pcm type */
39 #define ADSP_AUDIO_FORMAT_PCM 0x0103d2fd
40 /* adsp_audio_format_raw_pcm type */
41 #define ADSP_AUDIO_FORMAT_DTMF 0x01087725
42 /* adsp_audio_format_adpcm type */
43 #define ADSP_AUDIO_FORMAT_ADPCM 0x0103d2ff
44 /* Yamaha PCM format */
45 #define ADSP_AUDIO_FORMAT_YADPCM 0x0108dc07
47 #define ADSP_AUDIO_FORMAT_MP3 0x0103d308
49 #define ADSP_AUDIO_FORMAT_MPEG4_AAC 0x010422f1
50 /* AMR-NB audio in FS format */
51 #define ADSP_AUDIO_FORMAT_AMRNB_FS 0x0105c16c
52 /* AMR-WB audio in FS format */
53 #define ADSP_AUDIO_FORMAT_AMRWB_FS 0x0105c16e
54 /* QCELP 13k, IS733 */
55 #define ADSP_AUDIO_FORMAT_V13K_FS 0x01080b8a
57 #define ADSP_AUDIO_FORMAT_EVRC_FS 0x01080b89
59 #define ADSP_AUDIO_FORMAT_EVRCB_FS 0x0108f2a3
60 /* MIDI command stream */
61 #define ADSP_AUDIO_FORMAT_MIDI 0x0103d300
63 #define ADSP_AUDIO_FORMAT_SBC 0x0108c4d8
64 /* Version 10 Professional */
65 #define ADSP_AUDIO_FORMAT_WMA_V10PRO 0x0108aa92
66 /* Version 9 Starndard */
67 #define ADSP_AUDIO_FORMAT_WMA_V9 0x0108d430
68 /* AMR WideBand Plus */
69 #define ADSP_AUDIO_FORMAT_AMR_WB_PLUS 0x0108f3da
71 #define ADSP_AUDIO_FORMAT_AC3_DECODER 0x0108d5f9
74 /* Not yet supported audio media formats */
79 #define ADSP_AUDIO_FORMAT_MPEG2_AAC 0x0103d309
80 /* 3GPP TS 26.101 Sec 4.0 */
81 #define ADSP_AUDIO_FORMAT_AMRNB_IF1 0x0103d305
82 /* 3GPP TS 26.101 Annex A */
83 #define ADSP_AUDIO_FORMAT_AMRNB_IF2 0x01057b31
85 #define ADSP_AUDIO_FORMAT_AMRWB_IF1 0x0103d306
87 #define ADSP_AUDIO_FORMAT_AMRWB_IF2 0x0105c16d
89 #define ADSP_AUDIO_FORMAT_G711 0x0106201d
91 #define ADSP_AUDIO_FORMAT_V8K_FS 0x01081d29
93 #define ADSP_AUDIO_FORMAT_WMA_V1 0x01055b2b
94 /* Version 2, 7 & 8 codec */
95 #define ADSP_AUDIO_FORMAT_WMA_V8 0x01055b2c
96 /* Version 9 Professional codec */
97 #define ADSP_AUDIO_FORMAT_WMA_V9PRO 0x01055b2d
98 /* Version 9 Voice codec */
99 #define ADSP_AUDIO_FORMAT_WMA_SP1 0x01055b2e
100 /* Version 9 Lossless codec */
101 #define ADSP_AUDIO_FORMAT_WMA_LOSSLESS 0x01055b2f
102 /* Real Media content, low-bitrate */
103 #define ADSP_AUDIO_FORMAT_RA_SIPR 0x01042a0f
104 /* Real Media content */
105 #define ADSP_AUDIO_FORMAT_RA_COOK 0x01042a0e
108 /* For all of the audio formats, unless specified otherwise, */
109 /* the following apply: */
110 /* Format block bits are arranged in bytes and words in little-endian */
111 /* order, i.e., least-significant bit first and least-significant */
116 /* AAC Format Block. */
118 /* AAC format block consist of a format identifier followed by */
119 /* AudioSpecificConfig formatted according to ISO/IEC 14496-3 */
121 /* The following AAC format identifiers are supported */
122 #define ADSP_AUDIO_AAC_ADTS 0x010619cf
123 #define ADSP_AUDIO_AAC_MPEG4_ADTS 0x010619d0
124 #define ADSP_AUDIO_AAC_LOAS 0x010619d1
125 #define ADSP_AUDIO_AAC_ADIF 0x010619d2
126 #define ADSP_AUDIO_AAC_RAW 0x010619d3
127 #define ADSP_AUDIO_AAC_FRAMED_RAW 0x0108c1fb
130 #define ADSP_AUDIO_COMPANDING_ALAW 0x10619cd
131 #define ADSP_AUDIO_COMPANDING_MLAW 0x10619ce
133 /* Maxmum number of bytes allowed in a format block */
134 #define ADSP_AUDIO_FORMAT_DATA_MAX 16
137 struct adsp_audio_no_payload_format
{
138 /* Media Format Code (must always be first element) */
141 /* no payload for this format type */
142 } __attribute__ ((packed
));
145 /* For convenience, to be used as a standard format block */
146 /* for various media types that don't need a unique format block */
147 /* ie. PCM, DTMF, etc. */
148 struct adsp_audio_standard_format
{
149 /* Media Format Code (must always be first element) */
158 } __attribute__ ((packed
));
162 /* ADPCM format block */
163 struct adsp_audio_adpcm_format
{
164 /* Media Format Code (must always be first element) */
174 } __attribute__ ((packed
));
177 /* MIDI format block */
178 struct adsp_audio_midi_format
{
179 /* Media Format Code (must always be first element) */
186 } __attribute__ ((packed
));
189 /* G711 format block */
190 struct adsp_audio_g711_format
{
191 /* Media Format Code (must always be first element) */
196 } __attribute__ ((packed
));
199 struct adsp_audio_wma_pro_format
{
200 /* Media Format Code (must always be first element) */
207 u32 avg_bytes_per_sec
;
209 u16 valid_bits_per_sample
;
212 u16 advanced_encode_opt
;
213 u32 advanced_encode_opt2
;
214 u32 drc_peak_reference
;
216 u32 drc_average_reference
;
217 u32 drc_average_target
;
218 } __attribute__ ((packed
));
221 struct adsp_audio_amrwb_plus_format
{
222 /* Media Format Code (must always be first element) */
231 u32 amr_frame_format
;
233 } __attribute__ ((packed
));
236 /* Binary Byte Stream Format */
237 /* Binary format type that defines a byte stream, */
238 /* can be used to specify any format (ie. AAC) */
239 struct adsp_audio_binary_format
{
240 /* Media Format Code (must always be first element) */
244 /* number of bytes set in byte stream */
246 /* Byte stream binary data */
247 u8 data
[ADSP_AUDIO_FORMAT_DATA_MAX
];
248 } __attribute__ ((packed
));
251 struct adsp_audio_shared_memory_format
{
252 /* Media Format Code (must always be first element) */
255 /* Number of bytes in shared memory */
257 /* Phyisical address to data in shared memory */
259 } __attribute__ ((packed
));
262 /* Union of all format types */
263 union adsp_audio_format
{
264 /* Basic format block with no payload */
265 struct adsp_audio_no_payload_format no_payload
;
266 /* Generic format block PCM, DTMF */
267 struct adsp_audio_standard_format standard
;
268 /* ADPCM format block */
269 struct adsp_audio_adpcm_format adpcm
;
270 /* MIDI format block */
271 struct adsp_audio_midi_format midi
;
272 /* G711 format block */
273 struct adsp_audio_g711_format g711
;
274 /* WmaPro format block */
275 struct adsp_audio_wma_pro_format wma_pro
;
276 /* WmaPro format block */
277 struct adsp_audio_amrwb_plus_format amrwb_plus
;
278 /* binary (byte stream) format block, used for AAC */
279 struct adsp_audio_binary_format binary
;
280 /* format block in shared memory */
281 struct adsp_audio_shared_memory_format shared_mem
;