Mercurial > libavcodec.hg
comparison eval.c @ 6324:e378dca8784f libavcodec
const
| author | michael |
|---|---|
| date | Sun, 03 Feb 2008 23:25:35 +0000 |
| parents | 0ae80d7e989a |
| children | 0809b40d9b65 |
comparison
equal
deleted
inserted
replaced
| 6323:e6da66f378c7 | 6324:e378dca8784f |
|---|---|
| 53 double (**func1)(void *, double a); // NULL terminated | 53 double (**func1)(void *, double a); // NULL terminated |
| 54 const char **func1_name; // NULL terminated | 54 const char **func1_name; // NULL terminated |
| 55 double (**func2)(void *, double a, double b); // NULL terminated | 55 double (**func2)(void *, double a, double b); // NULL terminated |
| 56 char **func2_name; // NULL terminated | 56 char **func2_name; // NULL terminated |
| 57 void *opaque; | 57 void *opaque; |
| 58 char **error; | 58 const char **error; |
| 59 #define VARS 10 | 59 #define VARS 10 |
| 60 double var[VARS]; | 60 double var[VARS]; |
| 61 } Parser; | 61 } Parser; |
| 62 | 62 |
| 63 static int8_t si_prefixes['z' - 'E' + 1]={ | 63 static int8_t si_prefixes['z' - 'E' + 1]={ |
| 377 } | 377 } |
| 378 | 378 |
| 379 AVEvalExpr * ff_parse(char *s, const char **const_name, | 379 AVEvalExpr * ff_parse(char *s, const char **const_name, |
| 380 double (**func1)(void *, double), const char **func1_name, | 380 double (**func1)(void *, double), const char **func1_name, |
| 381 double (**func2)(void *, double, double), char **func2_name, | 381 double (**func2)(void *, double, double), char **func2_name, |
| 382 char **error){ | 382 const char **error){ |
| 383 Parser p; | 383 Parser p; |
| 384 AVEvalExpr * e; | 384 AVEvalExpr * e; |
| 385 char w[strlen(s) + 1], * wp = w; | 385 char w[strlen(s) + 1], * wp = w; |
| 386 | 386 |
| 387 while (*s) | 387 while (*s) |
| 414 } | 414 } |
| 415 | 415 |
| 416 double ff_eval2(char *s, double *const_value, const char **const_name, | 416 double ff_eval2(char *s, double *const_value, const char **const_name, |
| 417 double (**func1)(void *, double), const char **func1_name, | 417 double (**func1)(void *, double), const char **func1_name, |
| 418 double (**func2)(void *, double, double), char **func2_name, | 418 double (**func2)(void *, double, double), char **func2_name, |
| 419 void *opaque, char **error){ | 419 void *opaque, const char **error){ |
| 420 AVEvalExpr * e = ff_parse(s, const_name, func1, func1_name, func2, func2_name, error); | 420 AVEvalExpr * e = ff_parse(s, const_name, func1, func1_name, func2, func2_name, error); |
| 421 double d; | 421 double d; |
| 422 if (!e) return NAN; | 422 if (!e) return NAN; |
| 423 d = ff_parse_eval(e, const_value, opaque); | 423 d = ff_parse_eval(e, const_value, opaque); |
| 424 ff_eval_free(e); | 424 ff_eval_free(e); |
| 428 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | 428 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) |
| 429 attribute_deprecated double ff_eval(char *s, double *const_value, const char **const_name, | 429 attribute_deprecated double ff_eval(char *s, double *const_value, const char **const_name, |
| 430 double (**func1)(void *, double), const char **func1_name, | 430 double (**func1)(void *, double), const char **func1_name, |
| 431 double (**func2)(void *, double, double), char **func2_name, | 431 double (**func2)(void *, double, double), char **func2_name, |
| 432 void *opaque){ | 432 void *opaque){ |
| 433 char *error=NULL; | 433 const char *error=NULL; |
| 434 double ret; | 434 double ret; |
| 435 ret = ff_eval2(s, const_value, const_name, func1, func1_name, func2, func2_name, opaque, &error); | 435 ret = ff_eval2(s, const_value, const_name, func1, func1_name, func2, func2_name, opaque, &error); |
| 436 if (error) | 436 if (error) |
| 437 av_log(NULL, AV_LOG_ERROR, "Error evaluating \"%s\": %s\n", s, error); | 437 av_log(NULL, AV_LOG_ERROR, "Error evaluating \"%s\": %s\n", s, error); |
| 438 return ret; | 438 return ret; |
