1/*
2 * audio_parser.h, helper parser for audio codec data
3 *
4 * Copyright (c) 2009-2010 Wind River Systems, Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#ifndef __WRS_OMXIL_AUDIO_PARSER
20#define ___WRS_OMXIL_AUDIO_PARSER
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/*
27 * MP3
28 */
29
30#define MP3_HEADER_VERSION_25           0x0
31#define MP3_HEADER_VERSION_2            0x2
32#define MP3_HEADER_VERSION_1            0x3
33
34#define MP3_HEADER_LAYER_3              0x1
35#define MP3_HEADER_LAYER_2              0x2
36#define MP3_HEADER_LAYER_1              0x3
37
38#define MP3_HEADER_CRC_PROTECTED        0x0
39#define MP3_HEADER_NOT_PROTECTED        0x1
40
41#define MP3_HEADER_STEREO               0x0
42#define MP3_HEADER_JOINT_STEREO         0x1
43#define MP3_HEADER_DUAL_CHANNEL         0x2
44#define MP3_HEADER_SINGLE_CHANNEL       0x3
45
46int mp3_header_parse(const unsigned char *buffer,
47                     int *version, int *layer, int *crc, int *bitrate,
48                     int *frequency, int *channel, int *mode_extension,
49                     int *frame_length, int *frame_duration);
50
51/* end of MP3 */
52
53/*
54 * MP4
55 */
56
57int audio_specific_config_parse(const unsigned char *buffer,
58                                int *aot, int *frequency, int *channel);
59
60int audio_specific_config_bitcoding(unsigned char *buffer,
61                                    int aot, int frequency, int channel);
62
63/* end of MP4 */
64
65#ifdef __cplusplus
66} /* extern "C" */
67#endif
68
69#endif /* ___WRS_OMXIL_AUDIO_PARSER */
70