mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
More changes to change return values from load_module functions.
(issue #11096) Patches: codec_adpcm.c.patch uploaded by moy (license 222) codec_alaw.c.patch uploaded by moy (license 222) codec_a_mu.c.patch uploaded by moy (license 222) codec_g722.c.patch uploaded by moy (license 222) codec_g726.c.diff uploaded by moy (license 222) codec_gsm.c.patch uploaded by moy (license 222) codec_ilbc.c.patch uploaded by moy (license 222) codec_lpc10.c.patch uploaded by moy (license 222) codec_speex.c.patch uploaded by moy (license 222) codec_ulaw.c.patch uploaded by moy (license 222) codec_zap.c.patch uploaded by moy (license 222) format_g723.c.patch uploaded by moy (license 222) format_g726.c.patch uploaded by moy (license 222) format_g729.c.patch uploaded by moy (license 222) format_gsm.c.patch uploaded by moy (license 222) format_h263.c.patch uploaded by moy (license 222) format_h264.c.patch uploaded by moy (license 222) format_ilbc.c.patch uploaded by moy (license 222) format_jpeg.c.patch uploaded by moy (license 222) format_ogg_vorbis.c.patch uploaded by moy (license 222) format_pcm.c.patch uploaded by moy (license 222) format_sln.c.patch uploaded by moy (license 222) format_vox.c.patch uploaded by moy (license 222) format_wav.c.patch uploaded by moy (license 222) format_wav_gsm.c.patch uploaded by moy (license 222) res_adsi.c.patch uploaded by eliel (license 64) res_ael_share.c.patch uploaded by eliel (license 64) res_clioriginate.c.patch uploaded by eliel (license 64) res_convert.c.patch uploaded by eliel (license 64) res_indications.c.patch uploaded by eliel (license 64) res_musiconhold.c.patch uploaded by eliel (license 64) res_smdi.c.patch uploaded by eliel (license 64) res_speech.c.patch uploaded by eliel (license 64) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@87889 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -894,14 +894,16 @@ static struct ast_translator g726aal2tog726 = {
|
||||
.buf_size = BUFFER_SAMPLES,
|
||||
};
|
||||
|
||||
static void parse_config(int reload)
|
||||
static int parse_config(int reload)
|
||||
{
|
||||
struct ast_variable *var;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
struct ast_config *cfg = ast_config_load("codecs.conf", config_flags);
|
||||
|
||||
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")) {
|
||||
g726tolin.useplc = ast_true(var->value) ? 1 : 0;
|
||||
@@ -910,13 +912,14 @@ static void parse_config(int reload)
|
||||
}
|
||||
}
|
||||
ast_config_destroy(cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -940,7 +943,8 @@ static int load_module(void)
|
||||
int res = 0;
|
||||
|
||||
|
||||
parse_config(0);
|
||||
if (parse_config(0))
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
|
||||
res |= ast_register_translator(&g726tolin);
|
||||
res |= ast_register_translator(&lintog726);
|
||||
@@ -951,10 +955,12 @@ static int load_module(void)
|
||||
res |= ast_register_translator(&g726aal2tog726);
|
||||
res |= ast_register_translator(&g726tog726aal2);
|
||||
|
||||
if (res)
|
||||
if (res) {
|
||||
unload_module();
|
||||
return AST_MODULE_LOAD_FAILURE;
|
||||
}
|
||||
|
||||
return res;
|
||||
return AST_MODULE_LOAD_SUCCESS;
|
||||
}
|
||||
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "ITU G.726-32kbps G726 Transcoder",
|
||||
|
Reference in New Issue
Block a user