summaryrefslogtreecommitdiff
path: root/libavfilter/af_aformat.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-10 13:52:53 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-10 13:59:45 +0200
commit2a2a643c90ff091f1fa4a0634bcc4e18639bcee0 (patch)
tree2f093ba8b00873b35ed154df0da9251bb6dbacc6 /libavfilter/af_aformat.c
parent451315830a3b8ff4014cd0dda8583f5845e5a8d0 (diff)
parente67a87eac814c7805d18c983c43033a8a1bd62af (diff)
Merge commit 'e67a87eac814c7805d18c983c43033a8a1bd62af'
* commit 'e67a87eac814c7805d18c983c43033a8a1bd62af': vf_(no)format: switch to an AVOptions-based system. af_aformat: switch to an AVOptions-based system. Conflicts: doc/filters.texi libavfilter/af_aformat.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/af_aformat.c')
-rw-r--r--libavfilter/af_aformat.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c
index 9ac381fc1e..fd3f40df80 100644
--- a/libavfilter/af_aformat.c
+++ b/libavfilter/af_aformat.c
@@ -59,17 +59,24 @@ AVFILTER_DEFINE_CLASS(aformat);
#define PARSE_FORMATS(str, type, list, add_to_list, get_fmt, none, desc) \
do { \
- char *next, *cur = str; \
+ char *next, *cur = str, sep; \
+ \
+ if (str && strchr(str, ',')) { \
+ av_log(ctx, AV_LOG_WARNING, "This syntax is deprecated, use '|' to "\
+ "separate %s.\n", desc); \
+ sep = ','; \
+ } else \
+ sep = '|'; \
+ \
while (cur) { \
type fmt; \
- next = strchr(cur, ','); \
+ next = strchr(cur, sep); \
if (next) \
*next++ = 0; \
\
if ((fmt = get_fmt(cur)) == none) { \
av_log(ctx, AV_LOG_ERROR, "Error parsing " desc ": %s.\n", cur);\
- ret = AVERROR(EINVAL); \
- goto fail; \
+ return AVERROR(EINVAL); \
} \
add_to_list(&list, fmt); \
\
@@ -86,18 +93,6 @@ static int get_sample_rate(const char *samplerate)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
AFormatContext *s = ctx->priv;
- int ret;
-
- if (!args) {
- av_log(ctx, AV_LOG_ERROR, "No parameters supplied.\n");
- return AVERROR(EINVAL);
- }
-
- s->class = &aformat_class;
- av_opt_set_defaults(s);
-
- if ((ret = av_set_options_string(s, args, "=", ":")) < 0)
- return ret;
PARSE_FORMATS(s->formats_str, enum AVSampleFormat, s->formats,
ff_add_format, av_get_sample_fmt, AV_SAMPLE_FMT_NONE, "sample format");
@@ -107,9 +102,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
ff_add_channel_layout, av_get_channel_layout, 0,
"channel layout");
-fail:
- av_opt_free(s);
- return ret;
+ return 0;
}
static int query_formats(AVFilterContext *ctx)
@@ -148,6 +141,7 @@ AVFilter avfilter_af_aformat = {
.init = init,
.query_formats = query_formats,
.priv_size = sizeof(AFormatContext),
+ .priv_class = &aformat_class,
.inputs = avfilter_af_aformat_inputs,
.outputs = avfilter_af_aformat_outputs,