1 /*
2 * MPEG-4 Audio common code
3 * Copyright (c) 2008 Baptiste Coudurier <baptiste.coudurier@free.fr>
4 * Copyright (c) 2009 Alex Converse <alex.converse@gmail.com>
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
26
27 /**
28 * Parse MPEG-4 audio configuration for ALS object type.
29 * @param[in] gb bit reader context
30 * @param[in] c MPEG4AudioConfig structure to fill
31 * @return on success 0 is returned, otherwise a value < 0
32 */
34 {
37
40
41 // override AudioSpecificConfig channel configuration and sample rate
42 // which are buggy in old ALS conformance files
44
45 if (
c->sample_rate <= 0) {
48 }
49
50 // skip number of samples
52
53 // read number of channels
56
57 return 0;
58 }
59
61 0,
62 1, // mono (1/0)
63 2, // stereo (2/0)
64 3, // 3/0
65 4, // 3/1
66 5, // 3/2
67 6, // 3/2.1
68 8, // 5/2.1
69 0,
70 0,
71 0,
72 7, // 3/3.1
73 8, // 3/2/2.1
74 24 // 3/3/3 - 5/2/3 - 3/0/0.2
75 };
76
78 {
82 return object_type;
83 }
84
86 {
90 }
91
93 int sync_extension, void *logctx)
94 {
95 int specific_config_bitindex,
ret;
102 else {
105 }
109 // check for W6132 Annex YYYY draft MP3onMP4
119 } else {
121 c->ext_sample_rate = 0;
122 }
124
129
131
135 }
136
137 if (
c->ext_object_type !=
AOT_SBR && sync_extension) {
139 if (
show_bits(gb, 11) == 0x2b7) {
// sync extension
144 if (
c->ext_sample_rate ==
c->sample_rate)
146 }
149 break;
150 } else
152 }
153 }
154
155 //PS requires SBR
158 //Limit implicit PS to the HE-AACv2 Profile
159 if ((
c->ps == -1 &&
c->object_type !=
AOT_AAC_LC) ||
c->channels & ~0x01)
161
162 return specific_config_bitindex - start_bit_index;
163 }
164
166 int size,
int sync_extension,
void *logctx)
167 {
170
173
177
179 }