1 /*
2 * Copyright (c) 2013 Nicolas George
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
25
31
32 #define CONTEXT ASetRateContext
33 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
34
35 #define OPT_GENERIC(name, field, def, min, max, descr, type, deffield, ...) \
36 { name, descr, offsetof(CONTEXT, field), AV_OPT_TYPE_ ## type, \
37 { .deffield = def }, min, max, FLAGS, __VA_ARGS__ }
38
39 #define OPT_INT(name, field, def, min, max, descr, ...) \
40 OPT_GENERIC(name, field, def, min, max, descr, INT, i64, __VA_ARGS__)
41
43 OPT_INT(
"sample_rate", sample_rate, 44100, 1, INT_MAX,
"set the sample rate",),
44 OPT_INT(
"r", sample_rate, 44100, 1, INT_MAX,
"set the sample rate",),
46 };
47
49
53 {
56
58 &cfg_in[0]->samplerates)) < 0)
60
62 &cfg_out[0]->samplerates);
63 }
64
66 {
71 int inrate =
inlink->sample_rate;
72
73 if (intb.
num == 1 && intb.
den == inrate) {
76 } else {
81 }
82 return 0;
83 }
84
86 {
90
96 }
97
99 {
103 },
104 };
105
107 {
111 },
112 };
113
115 .
p.
name =
"asetrate",
117 "altering the data."),
118 .p.priv_class = &asetrate_class,
124 };