[FFmpeg-devel] [PATCH 3/5] avfilter/scale: separate exprs parse and eval

Gyan ffmpeg at gyani.pro
Sat Dec 28 07:16:33 EET 2019


Hi Michael,

On 26-12-2019 02:42 pm, Gyan wrote:
>
>
> On 24-12-2019 11:39 am, Gyan wrote:
>>
>>
>> On 24-12-2019 04:50 am, Michael Niedermayer wrote:
>>> On Tue, Dec 17, 2019 at 02:55:06PM +0530, Gyan wrote:
>>> [...]
>>>> @@ -127,6 +204,22 @@ static av_cold int init_dict(AVFilterContext 
>>>> *ctx, AVDictionary **opts)
>>>>       if (!scale->h_expr)
>>>>           av_opt_set(scale, "h", "ih", 0);
>>>>   +    ret = av_expr_parse(&scale->w_pexpr, scale->w_expr,
>>>> +                            names,
>>>> +                            NULL, NULL, NULL, NULL, 0, ctx);
>>>> +    if (ret < 0) {
>>>> +        av_log(ctx, AV_LOG_ERROR, "Cannot parse width expression: 
>>>> '%s'\n", scale->w_expr);
>>>> +        return ret;
>>>> +    }
>>>> +
>>>> +    ret = av_expr_parse(&scale->h_pexpr, scale->h_expr,
>>>> +                            names,
>>>> +                            NULL, NULL, NULL, NULL, 0, ctx);
>>>> +    if (ret < 0) {
>>>> +        av_log(ctx, AV_LOG_ERROR, "Cannot parse height expression: 
>>>> '%s'\n", scale->h_expr);
>>>> +        return ret;
>>>> +    }
>>>> +
>>>> +        if (w) {
>>>> +            ret = av_expr_parse(&scale->w_pexpr, scale->w_expr,
>>>> +                            names,
>>>> +                            NULL, NULL, NULL, NULL, 0, ctx);
>>>> +            if (ret < 0) {
>>>> +                av_log(ctx, AV_LOG_ERROR, "Cannot parse width 
>>>> expression: '%s'\n", scale->w_expr);
>>>> +                goto revert;
>>>> +            }
>>>> +        }
>>>> +
>>>> +        if (h) {
>>>> +            ret = av_expr_parse(&scale->h_pexpr, scale->h_expr,
>>>> +                            names,
>>>> +                            NULL, NULL, NULL, NULL, 0, ctx);
>>>> +            if (ret < 0) {
>>>> +                av_log(ctx, AV_LOG_ERROR, "Cannot parse height 
>>>> expression: '%s'\n", scale->h_expr);
>>>> +                goto revert;
>>>> +            }
>>>> +        }
>>> Duplicate code
>>
>> init_dict() is not called during command processing since we don't 
>> reset any other parameter except for one of width or height. Do you 
>> want me to reinit all parameters after a command?
>
> Ping.

If you can suggest how you want me to proceed, that would be helpful.

Gyan


More information about the ffmpeg-devel mailing list