1 /*
2 * Core Audio Format muxer
3 * Copyright (c) 2011 Carl Eugen Hoyos
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
28
36
38 switch (codec_id) {
41 return 1; //< kCAFLinearPCMFormatFlagIsFloat
45 return 2; //< kCAFLinearPCMFormatFlagIsLittleEndian
48 return 3; //< kCAFLinearPCMFormatFlagIsFloat | kCAFLinearPCMFormatFlagIsLittleEndian
49 default:
50 return 0;
51 }
52 }
53
55 switch (codec_id) {
69 return 1;
72 return 6;
74 return 64;
79 return 160;
81 return 320;
83 return 384;
86 return 1152;
88 return 1536;
91 return 4096;
93 return (1024 - 4 * channels) * 8 / (4 * channels) + 1;
95 return (1024 - 7 * channels) * 2 / channels + 2;
96 default:
97 return 0;
98 }
99 }
100
102 {
108 int64_t chunk_size = 0;
109
115 }
116
131 codec_tag =
MKTAG(
'l',
'p',
'c',
'm');
132 }
133
134 if (!codec_tag) {
137 }
138
140 av_log(s,
AV_LOG_ERROR,
"Muxing variable packet size not supported on non seekable output\n");
142 }
143
147
157
162 }
163
175 avio_w8(pb, 0);
/* decoder version */
176
177 avio_wb16(pb, 0x81FF);
/* Mode set (all modes for AMR_NB) */
178 avio_w8(pb, 0x00);
/* Mode change period (no restriction) */
179 avio_w8(pb, 0x01);
/* Frames per sample */
184 }
185
189 chunk_size += strlen(t->
key) + strlen(t->
value) + 2;
190 }
197 }
198 }
199
204
206 return 0;
207 }
208
210 {
212
217 if (alloc_size < 0) {
219 } else {
222 alloc_size);
223 }
227 }
228 for (i = 4; i > 0; i--) {
229 unsigned top = pkt->
size >> i * 7;
230 if (top)
232 }
235 }
236 return 0;
237 }
238
240 {
243
247
261 }
263 }
264 return 0;
265 }
266
270 .mime_type = "audio/x-caf",
271 .extensions = "caf",
279 };