1 /*
2 * Copyright (c) 2011 Stefano Sabatini
3 * Copyright (c) 2011 Mina Nagy Zaki
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
22 /**
23 * @file
24 * resampling audio filter
25 */
26
36
45
47 {
50
53 if (!aresample->
swr) {
56 }
57
58 if (opts) {
60
64 }
66 }
71 }
72
74 {
77 }
78
80 {
83 uint64_t out_layout =
av_get_int(aresample->
swr,
"ocl", NULL);
85
88
95
99
100 if(out_rate > 0) {
101 int ratelist[] = { out_rate, -1 };
103 } else {
105 }
107
109 int formatlist[] = { out_format, -1 };
111 } else
114
115 if(out_layout) {
116 int64_t layout_list[] = { out_layout, -1 };
118 } else
121
122 return 0;
123 }
124
125
127 {
132 int out_rate;
133 uint64_t out_layout;
135 char inchl_buf[128], outchl_buf[128];
136
140 0, ctx);
147
149 if (ret < 0)
151
156
160
162
165
169 return 0;
170 }
171
173 {
176 int64_t delay;
177 int n_out = n_in * aresample->
ratio + 32;
181
183 if (delay > 0)
184 n_out += delay;
185
187
188 if(!outsamplesref)
190
196
202 } else {
204 }
207 if (n_out <= 0) {
210 return 0;
211 }
212
214
219 }
220
222 {
227
229 do{
232
235 int n_out = 4096;
236 int64_t pts;
237
239 if (!outsamplesref)
241
244
246 if (n_out <= 0) {
249 }
250
253
254 outsamplesref->
pts = pts;
255
257 }
259 }
260
262 {
264 }
265
267 {
269 return prev ? NULL : s->
swr;
270 }
271
272 #define OFFSET(x) offsetof(AResampleContext, x)
273 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
274
277 {NULL}
278 };
279
287 };
288
290 {
294 },
295 { NULL }
296 };
297
299 {
304 },
305 { NULL }
306 };
307
315 .priv_class = &aresample_class,
316 .
inputs = aresample_inputs,
318 };