1 /*
2 * Copyright (c) 2011 Mina Nagy Zaki
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
8 * License 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 GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 /**
22 * @file
23 * format audio filter
24 */
25
30
35
38
42
47
48 #define OFFSET(x) offsetof(AFormatContext, x)
49 #define A AV_OPT_FLAG_AUDIO_PARAM
50 #define F AV_OPT_FLAG_FILTERING_PARAM
54 {
"channel_layouts",
"A comma-separated list of channel layouts.",
OFFSET(channel_layouts_str),
AV_OPT_TYPE_STRING, .flags =
A|
F },
56 };
57
59
60 #define PARSE_FORMATS(str, type, list, add_to_list, get_fmt, none, desc) \
61 do { \
62 char *next, *cur = str, sep; \
63 \
64 if (str && strchr(str, ',')) { \
65 av_log(ctx, AV_LOG_WARNING, "This syntax is deprecated, use '|' to "\
66 "separate %s.\n", desc); \
67 sep = ','; \
68 } else \
69 sep = '|'; \
70 \
71 while (cur) { \
72 type fmt; \
73 next = strchr(cur, sep); \
74 if (next) \
75 *next++ = 0; \
76 \
77 if ((fmt = get_fmt(cur)) == none) { \
78 av_log(ctx, AV_LOG_ERROR, "Error parsing " desc ": %s.\n", cur);\
79 return AVERROR(EINVAL); \
80 } \
81 add_to_list(&list, fmt); \
82 \
83 cur = next; \
84 } \
85 } while (0)
86
88 {
89 int ret = strtol(samplerate,
NULL, 0);
91 }
92
94 {
96
103 "channel layout");
104
105 return 0;
106 }
107
109 {
111
118
119 return 0;
120 }
121
123 {
126 },
128 };
129
131 {
134 },
136 };
137
140 .description =
NULL_IF_CONFIG_SMALL(
"Convert the input audio to one of the specified formats."),
144 .priv_class = &aformat_class,
145 .
inputs = avfilter_af_aformat_inputs,
146 .
outputs = avfilter_af_aformat_outputs,
147 };