Revision 9ace13b4 libavcodec/eval.h

View differences:

libavcodec/eval.h
32 32
 * Parses and evaluates an expression.
33 33
 * Note, this is significantly slower than ff_eval_expr().
34 34
 *
35
 * @param res a pointer to a double where is put the result value of
36
 * the expression, or NAN in case of error
35 37
 * @param s expression as a zero terminated string for example "1+2^3+5*5+sin(2/3)"
36 38
 * @param const_name NULL terminated array of zero terminated strings of constant identifers for example {"PI", "E", 0}
37 39
 * @param const_value a zero terminated array of values for the identifers from const_name
......
41 43
 * @param func2 NULL terminated array of function pointers for functions which take 2 arguments
42 44
 * @param opaque a pointer which will be passed to all functions from func1 and func2
43 45
 * @param log_ctx parent logging context
44
 * @return the value of the expression
46
 * @return 0 in case of success, a negative value corresponding to an
47
 * AVERROR code otherwise
45 48
 */
46
double ff_parse_and_eval_expr(const char *s,
49
int ff_parse_and_eval_expr(double *res, const char *s,
47 50
                              const char * const *const_name, const double *const_value,
48 51
                              const char * const *func1_name, double (* const *func1)(void *, double),
49 52
                              const char * const *func2_name, double (* const *func2)(void *, double, double),
......
52 55
/**
53 56
 * Parses an expression.
54 57
 *
58
 * @param expr a pointer where is put an AVExpr containing the parsed
59
 * value in case of successfull parsing, or NULL otherwise.
60
 * The pointed to AVExpr must be freed with ff_free_expr() by the user
61
 * when it is not needed anymore.
55 62
 * @param s expression as a zero terminated string for example "1+2^3+5*5+sin(2/3)"
56 63
 * @param const_name NULL terminated array of zero terminated strings of constant identifers for example {"PI", "E", 0}
57 64
 * @param func1_name NULL terminated array of zero terminated strings of func1 identifers
......
59 66
 * @param func2_name NULL terminated array of zero terminated strings of func2 identifers
60 67
 * @param func2 NULL terminated array of function pointers for functions which take 2 arguments
61 68
 * @param log_ctx parent logging context
62
 * @return AVExpr which must be freed with ff_free_expr() by the user when it is not needed anymore
63
 *         NULL if anything went wrong
69
 * @return 0 in case of success, a negative value corresponding to an
70
 * AVERROR code otherwise
64 71
 */
65
AVExpr *ff_parse_expr(const char *s,
72
int ff_parse_expr(AVExpr **expr, const char *s,
66 73
                      const char * const *const_name,
67 74
                      const char * const *func1_name, double (* const *func1)(void *, double),
68 75
                      const char * const *func2_name, double (* const *func2)(void *, double, double),

Also available in: Unified diff