mirror of
https://github.com/asterisk/asterisk.git
synced 2026-05-03 20:06:24 +00:00
Version 0.1.8 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
16
translate.c
16
translate.c
@@ -253,7 +253,7 @@ static int show_translation(int fd, int argc, char *argv[])
|
||||
return RESULT_SHOWUSAGE;
|
||||
ast_cli(fd, " Translation times between formats (in milliseconds)\n");
|
||||
ast_cli(fd, " Destination Format\n");
|
||||
pthread_mutex_lock(&list_lock);
|
||||
ast_pthread_mutex_lock(&list_lock);
|
||||
for (x=0;x<SHOW_TRANS; x++) {
|
||||
if (x == 1)
|
||||
strcpy(line, " Src ");
|
||||
@@ -270,7 +270,7 @@ static int show_translation(int fd, int argc, char *argv[])
|
||||
snprintf(line + strlen(line), sizeof(line) - strlen(line), "\n");
|
||||
ast_cli(fd, line);
|
||||
}
|
||||
pthread_mutex_unlock(&list_lock);
|
||||
ast_pthread_mutex_unlock(&list_lock);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ int ast_register_translator(struct ast_translator *t)
|
||||
calc_cost(t);
|
||||
if (option_verbose > 1)
|
||||
ast_verbose(VERBOSE_PREFIX_2 "Registered translator '%s' from format %d to %d, cost %d\n", t->name, t->srcfmt, t->dstfmt, t->cost);
|
||||
pthread_mutex_lock(&list_lock);
|
||||
ast_pthread_mutex_lock(&list_lock);
|
||||
if (!added_cli) {
|
||||
ast_cli_register(&show_trans);
|
||||
added_cli++;
|
||||
@@ -303,14 +303,14 @@ int ast_register_translator(struct ast_translator *t)
|
||||
t->next = list;
|
||||
list = t;
|
||||
rebuild_matrix();
|
||||
pthread_mutex_unlock(&list_lock);
|
||||
ast_pthread_mutex_unlock(&list_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ast_unregister_translator(struct ast_translator *t)
|
||||
{
|
||||
struct ast_translator *u, *ul = NULL;
|
||||
pthread_mutex_lock(&list_lock);
|
||||
ast_pthread_mutex_lock(&list_lock);
|
||||
u = list;
|
||||
while(u) {
|
||||
if (u == t) {
|
||||
@@ -324,7 +324,7 @@ int ast_unregister_translator(struct ast_translator *t)
|
||||
u = u->next;
|
||||
}
|
||||
rebuild_matrix();
|
||||
pthread_mutex_unlock(&list_lock);
|
||||
ast_pthread_mutex_unlock(&list_lock);
|
||||
return (u ? 0 : -1);
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ int ast_translator_best_choice(int *dst, int *srcs)
|
||||
int bestdst=0;
|
||||
int cur = 1;
|
||||
int besttime=999999999;
|
||||
pthread_mutex_lock(&list_lock);
|
||||
ast_pthread_mutex_lock(&list_lock);
|
||||
for (y=0;y<MAX_FORMAT;y++) {
|
||||
if ((cur & *dst) && (cur & *srcs)) {
|
||||
/* This is a common format to both. Pick it if we don't have one already */
|
||||
@@ -363,6 +363,6 @@ int ast_translator_best_choice(int *dst, int *srcs)
|
||||
*dst = bestdst;
|
||||
best = 0;
|
||||
}
|
||||
pthread_mutex_unlock(&list_lock);
|
||||
ast_pthread_mutex_unlock(&list_lock);
|
||||
return best;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user