diff options
Diffstat (limited to 'codecs/codec_adpcm.c')
-rw-r--r-- | codecs/codec_adpcm.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/codecs/codec_adpcm.c b/codecs/codec_adpcm.c index e76470b6c..a40bbbc9f 100644 --- a/codecs/codec_adpcm.c +++ b/codecs/codec_adpcm.c @@ -350,13 +350,15 @@ static struct ast_translator lintoadpcm = { .buf_size = BUFFER_SAMPLES/ 2, /* 2 samples per byte */ }; -static void parse_config(int reload) +static int parse_config(int reload) { struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; struct ast_config *cfg = ast_config_load("codecs.conf", config_flags); struct ast_variable *var; - if (cfg == NULL || cfg == CONFIG_STATUS_FILEUNCHANGED) - return; + if (cfg == NULL) + return -1; + if (cfg == CONFIG_STATUS_FILEUNCHANGED) + return 0; for (var = ast_variable_browse(cfg, "plc"); var ; var = var->next) { if (!strcasecmp(var->name, "genericplc")) { adpcmtolin.useplc = ast_true(var->value) ? 1 : 0; @@ -364,13 +366,15 @@ static void parse_config(int reload) } } ast_config_destroy(cfg); + return 0; } /*! \brief standard module glue */ static int reload(void) { - parse_config(1); - return 0; + if (parse_config(1)) + return AST_MODULE_LOAD_DECLINE; + return AST_MODULE_LOAD_SUCCESS; } static int unload_module(void) @@ -387,14 +391,16 @@ static int load_module(void) { int res; - parse_config(0); + if (parse_config(0)) + return AST_MODULE_LOAD_DECLINE; res = ast_register_translator(&adpcmtolin); if (!res) res = ast_register_translator(&lintoadpcm); else ast_unregister_translator(&adpcmtolin); - - return res; + if (res) + return AST_MODULE_LOAD_FAILURE; + return AST_MODULE_LOAD_SUCCESS; } AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Adaptive Differential PCM Coder/Decoder", |