History

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

Michael Niedermayer committed 13 years ago

Commit 2a2a6432 parents 4513158 e67a87e4 files · +95 −33Browse files

Showing the changes to libavfilter/af_aformat.c (1 of 4 files). Show all

Unified · Split

libavfilter/af_aformat.c+13−19
@@ -59,17 +59,24 @@ AVFILTER_DEFINE_CLASS(aformat); · 58 unmodified lines
5959
6060 #define PARSE_FORMATS(str, type, list, add_to_list, get_fmt, none, desc) \
6161 do { \
62− char *next, *cur = str; \
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+ \
6371 while (cur) { \
6472 type fmt; \
65− next = strchr(cur, ','); \
73+ next = strchr(cur, sep); \
6674 if (next) \
6775 *next++ = 0; \
6876 \
6977 if ((fmt = get_fmt(cur)) == none) { \
7078 av_log(ctx, AV_LOG_ERROR, "Error parsing " desc ": %s.\n", cur);\
71− ret = AVERROR(EINVAL); \
72− goto fail; \
79+ return AVERROR(EINVAL); \
7380 } \
7481 add_to_list(&list, fmt); \
7582 \
@@ -86,18 +93,6 @@ static int get_sample_rate(const char *samplerate) · 10 unmodified lines
8693 static av_cold int init(AVFilterContext *ctx, const char *args)
8794 {
8895 AFormatContext *s = ctx->priv;
89− int ret;
90−
91− if (!args) {
92− av_log(ctx, AV_LOG_ERROR, "No parameters supplied.\n");
93− return AVERROR(EINVAL);
94− }
95−
96− s->class = &aformat_class;
97− av_opt_set_defaults(s);
98−
99− if ((ret = av_set_options_string(s, args, "=", ":")) < 0)
100− return ret;
10196
10297 PARSE_FORMATS(s->formats_str, enum AVSampleFormat, s->formats,
10398 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) · 3 unmodified lines
107102 ff_add_channel_layout, av_get_channel_layout, 0,
108103 "channel layout");
109104
110−fail:
111− av_opt_free(s);
112− return ret;
105+ return 0;
113106 }
114107
115108 static int query_formats(AVFilterContext *ctx)
@@ -148,6 +141,7 @@ AVFilter avfilter_af_aformat = { · 32 unmodified lines
148141 .init = init,
149142 .query_formats = query_formats,
150143 .priv_size = sizeof(AFormatContext),
144+ .priv_class = &aformat_class,
151145
152146 .inputs = avfilter_af_aformat_inputs,
153147 .outputs = avfilter_af_aformat_outputs,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t