@ -403,15 +405,14 @@ int ast_register_translator(struct ast_translator *t)
calc_cost(t,1);
calc_cost(t,1);
if(option_verbose>1)
if(option_verbose>1)
ast_verbose(VERBOSE_PREFIX_2"Registered translator '%s' from format %s to %s, cost %d\n",term_color(tmp,t->name,COLOR_MAGENTA,COLOR_BLACK,sizeof(tmp)),ast_getformatname(1<<t->srcfmt),ast_getformatname(1<<t->dstfmt),t->cost);
ast_verbose(VERBOSE_PREFIX_2"Registered translator '%s' from format %s to %s, cost %d\n",term_color(tmp,t->name,COLOR_MAGENTA,COLOR_BLACK,sizeof(tmp)),ast_getformatname(1<<t->srcfmt),ast_getformatname(1<<t->dstfmt),t->cost);
ast_mutex_lock(&list_lock);
AST_LIST_LOCK(&translators);
if(!added_cli){
if(!added_cli){
ast_cli_register(&show_trans);
ast_cli_register(&show_trans);
added_cli++;
added_cli++;
}
}
t->next=list;
AST_LIST_INSERT_HEAD(&translators,t,list);
list=t;
rebuild_matrix(0);
rebuild_matrix(0);
ast_mutex_unlock(&list_lock);
AST_LIST_UNLOCK(&translators);
return0;
return0;
}
}
@ -419,24 +420,19 @@ int ast_register_translator(struct ast_translator *t)
ast_verbose(VERBOSE_PREFIX_2"Unregistered translator '%s' from format %s to %s\n",term_color(tmp,t->name,COLOR_MAGENTA,COLOR_BLACK,sizeof(tmp)),ast_getformatname(1<<t->srcfmt),ast_getformatname(1<<t->dstfmt));
ast_verbose(VERBOSE_PREFIX_2"Unregistered translator '%s' from format %s to %s\n",term_color(tmp,t->name,COLOR_MAGENTA,COLOR_BLACK,sizeof(tmp)),ast_getformatname(1<<t->srcfmt),ast_getformatname(1<<t->dstfmt));
break;
break;
}
}
ul=u;
u=u->next;
}
}
AST_LIST_TRAVERSE_SAFE_END
rebuild_matrix(0);
rebuild_matrix(0);
ast_mutex_unlock(&list_lock);
AST_LIST_UNLOCK(&translators);
return(u?0:-1);
return(u?0:-1);
}
}
@ -463,7 +459,7 @@ int ast_translator_best_choice(int *dst, int *srcs)
}
}
}else{
}else{
/* We will need to translate */
/* We will need to translate */
ast_mutex_lock(&list_lock);
AST_LIST_LOCK(&translators);
for(y=0;y<MAX_FORMAT;y++){
for(y=0;y<MAX_FORMAT;y++){
if(cur&*dst)
if(cur&*dst)
for(x=0;x<MAX_FORMAT;x++){
for(x=0;x<MAX_FORMAT;x++){
@ -477,7 +473,7 @@ int ast_translator_best_choice(int *dst, int *srcs)