From 320b0b6c907390f3c959e635d5973c2f15f91087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Fri, 15 Apr 2016 15:52:40 +0200 Subject: [PATCH] Use ms_parse_equalizer_string() to parse the strings provided by the gain linphonerc parameter --- coreapi/linphonecall.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 18d494896..4344cbae7 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2689,15 +2689,16 @@ static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){ ms_filter_call_method(f,MS_EQUALIZER_SET_ACTIVE,&enabled); if (enabled){ if (gains){ - do{ - int bytes; - MSEqualizerGain g; - if (sscanf(gains,"%f:%f:%f %n",&g.frequency,&g.gain,&g.width,&bytes)==3){ - ms_message("Read equalizer gains: %f(~%f) --> %f",g.frequency,g.width,g.gain); - ms_filter_call_method(f,MS_EQUALIZER_SET_GAIN,&g); - gains+=bytes; - }else break; - }while(1); + MSList *gains_list = ms_parse_equalizer_string(gains); + if (gains_list) { + MSList *it; + for(it=gains_list; it; it=it->next) { + MSEqualizerGain *g = (MSEqualizerGain *)it->data; + ms_message("Read equalizer gains: %f(~%f) --> %f",g->frequency,g->width,g->gain); + ms_filter_call_method(f,MS_EQUALIZER_SET_GAIN, g); + } + ms_list_free_with_data(gains_list, ms_free); + } } } }