...
|
...
|
@@ -130,14 +130,10 @@ static inline void compute_sin_and_cos(HueContext *hue)
|
130
|
130
|
static inline int set_options(AVFilterContext *ctx, const char *args)
|
131
|
131
|
{
|
132
|
132
|
HueContext *hue = ctx->priv;
|
133
|
|
- int n, ret;
|
134
|
|
- char c1 = 0, c2 = 0;
|
|
133
|
+ int ret;
|
135
|
134
|
char *old_hue_expr, *old_hue_deg_expr, *old_saturation_expr;
|
136
|
135
|
AVExpr *old_hue_pexpr, *old_hue_deg_pexpr, *old_saturation_pexpr;
|
137
|
|
-
|
138
|
|
- if (args) {
|
139
|
|
- /* named options syntax */
|
140
|
|
- if (strchr(args, '=')) {
|
|
136
|
+ static const char *shorthand[] = { "h", "s", NULL };
|
141
|
137
|
old_hue_expr = hue->hue_expr;
|
142
|
138
|
old_hue_deg_expr = hue->hue_deg_expr;
|
143
|
139
|
old_saturation_expr = hue->saturation_expr;
|
...
|
...
|
@@ -150,7 +146,7 @@ static inline int set_options(AVFilterContext *ctx, const char *args)
|
150
|
150
|
hue->hue_deg_expr = NULL;
|
151
|
151
|
hue->saturation_expr = NULL;
|
152
|
152
|
|
153
|
|
- if ((ret = av_set_options_string(hue, args, "=", ":")) < 0)
|
|
153
|
+ if ((ret = av_opt_set_from_string(hue, args, shorthand, "=", ":")) < 0)
|
154
|
154
|
return ret;
|
155
|
155
|
if (hue->hue_expr && hue->hue_deg_expr) {
|
156
|
156
|
av_log(ctx, AV_LOG_ERROR,
|
...
|
...
|
@@ -172,33 +168,6 @@ static inline int set_options(AVFilterContext *ctx, const char *args)
|
172
|
172
|
"H_expr:%s h_deg_expr:%s s_expr:%s\n",
|
173
|
173
|
hue->hue_expr, hue->hue_deg_expr, hue->saturation_expr);
|
174
|
174
|
|
175
|
|
- /* compatibility h:s syntax */
|
176
|
|
- } else {
|
177
|
|
- n = sscanf(args, "%f%c%f%c", &hue->hue_deg, &c1, &hue->saturation, &c2);
|
178
|
|
- if (n != 1 && (n != 3 || c1 != ':')) {
|
179
|
|
- av_log(ctx, AV_LOG_ERROR,
|
180
|
|
- "Invalid syntax for argument '%s': "
|
181
|
|
- "must be in the form 'hue[:saturation]'\n", args);
|
182
|
|
- return AVERROR(EINVAL);
|
183
|
|
- }
|
184
|
|
-
|
185
|
|
- if (hue->saturation < SAT_MIN_VAL || hue->saturation > SAT_MAX_VAL) {
|
186
|
|
- av_log(ctx, AV_LOG_ERROR,
|
187
|
|
- "Invalid value for saturation %0.1f: "
|
188
|
|
- "must be included between range %d and +%d\n",
|
189
|
|
- hue->saturation, SAT_MIN_VAL, SAT_MAX_VAL);
|
190
|
|
- return AVERROR(EINVAL);
|
191
|
|
- }
|
192
|
|
-
|
193
|
|
- hue->hue = hue->hue_deg * M_PI / 180;
|
194
|
|
- hue->flat_syntax = 1;
|
195
|
|
-
|
196
|
|
- av_log(ctx, AV_LOG_VERBOSE,
|
197
|
|
- "H:%0.1f h:%0.1f s:%0.1f\n",
|
198
|
|
- hue->hue, hue->hue_deg, hue->saturation);
|
199
|
|
- }
|
200
|
|
- }
|
201
|
|
-
|
202
|
175
|
compute_sin_and_cos(hue);
|
203
|
176
|
|
204
|
177
|
return 0;
|