summaryrefslogtreecommitdiff
path: root/libavcodec/ratecontrol.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-06-01 08:07:07 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-06-01 08:07:07 +0000
commit9ace13b416c77f15464fd8e1a024db8b00ce76f9 (patch)
tree0f2a306d39f556bd203b4381141f52ef35fa5d17 /libavcodec/ratecontrol.c
parent27241cbffe180fc92f9f519c6ea7957fc4b3b0c9 (diff)
Make ff_parse_expr() and ff_parse_and_eval_expr() return an int
containing an error code. Allow these functions to convey the reason of the failure to the calling function, failure which is not always due to a parsing error but it may depend for example on a memory problem. Also fix several potential memleaks. Originally committed as revision 23402 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ratecontrol.c')
-rw-r--r--libavcodec/ratecontrol.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index fe6e4b08ab..375815a67f 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -66,7 +66,7 @@ static inline double bits2qp(RateControlEntry *rce, double bits){
int ff_rate_control_init(MpegEncContext *s)
{
RateControlContext *rcc= &s->rc_context;
- int i;
+ int i, res;
static const char * const const_names[]={
"PI",
"E",
@@ -106,10 +106,10 @@ int ff_rate_control_init(MpegEncContext *s)
};
emms_c();
- rcc->rc_eq_eval = ff_parse_expr(s->avctx->rc_eq ? s->avctx->rc_eq : "tex^qComp", const_names, func1_names, func1, NULL, NULL, 0, s->avctx);
- if (!rcc->rc_eq_eval) {
+ res = ff_parse_expr(&rcc->rc_eq_eval, s->avctx->rc_eq ? s->avctx->rc_eq : "tex^qComp", const_names, func1_names, func1, NULL, NULL, 0, s->avctx);
+ if (res < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\"\n", s->avctx->rc_eq);
- return -1;
+ return res;
}
for(i=0; i<5; i++){