|
|
|
@ -77,14 +77,14 @@ int ast_format_register(char *name, char *exts, int format,
|
|
|
|
|
char * (*getcomment)(struct ast_filestream *))
|
|
|
|
|
{
|
|
|
|
|
struct ast_format *tmp;
|
|
|
|
|
if (pthread_mutex_lock(&formatlock)) {
|
|
|
|
|
if (ast_pthread_mutex_lock(&formatlock)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to lock format list\n");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
tmp = formats;
|
|
|
|
|
while(tmp) {
|
|
|
|
|
if (!strcasecmp(name, tmp->name)) {
|
|
|
|
|
pthread_mutex_unlock(&formatlock);
|
|
|
|
|
ast_pthread_mutex_unlock(&formatlock);
|
|
|
|
|
ast_log(LOG_WARNING, "Tried to register '%s' format, already registered\n", name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
@ -93,7 +93,7 @@ int ast_format_register(char *name, char *exts, int format,
|
|
|
|
|
tmp = malloc(sizeof(struct ast_format));
|
|
|
|
|
if (!tmp) {
|
|
|
|
|
ast_log(LOG_WARNING, "Out of memory\n");
|
|
|
|
|
pthread_mutex_unlock(&formatlock);
|
|
|
|
|
ast_pthread_mutex_unlock(&formatlock);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
strncpy(tmp->name, name, sizeof(tmp->name));
|
|
|
|
@ -108,7 +108,7 @@ int ast_format_register(char *name, char *exts, int format,
|
|
|
|
|
tmp->getcomment = getcomment;
|
|
|
|
|
tmp->next = formats;
|
|
|
|
|
formats = tmp;
|
|
|
|
|
pthread_mutex_unlock(&formatlock);
|
|
|
|
|
ast_pthread_mutex_unlock(&formatlock);
|
|
|
|
|
if (option_verbose > 1)
|
|
|
|
|
ast_verbose( VERBOSE_PREFIX_2 "Registered file format %s, extension(s) %s\n", name, exts);
|
|
|
|
|
return 0;
|
|
|
|
@ -117,7 +117,7 @@ int ast_format_register(char *name, char *exts, int format,
|
|
|
|
|
int ast_format_unregister(char *name)
|
|
|
|
|
{
|
|
|
|
|
struct ast_format *tmp, *tmpl = NULL;
|
|
|
|
|
if (pthread_mutex_lock(&formatlock)) {
|
|
|
|
|
if (ast_pthread_mutex_lock(&formatlock)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to lock format list\n");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
@ -129,7 +129,7 @@ int ast_format_unregister(char *name)
|
|
|
|
|
else
|
|
|
|
|
formats = tmp->next;
|
|
|
|
|
free(tmp);
|
|
|
|
|
pthread_mutex_unlock(&formatlock);
|
|
|
|
|
ast_pthread_mutex_unlock(&formatlock);
|
|
|
|
|
if (option_verbose > 1)
|
|
|
|
|
ast_verbose( VERBOSE_PREFIX_2 "Unregistered format %s\n", name);
|
|
|
|
|
return 0;
|
|
|
|
@ -228,7 +228,7 @@ static int ast_filehelper(char *filename, char *filename2, char *fmt, int action
|
|
|
|
|
if (action == ACTION_OPEN)
|
|
|
|
|
ret = -1;
|
|
|
|
|
/* Check for a specific format */
|
|
|
|
|
if (pthread_mutex_lock(&formatlock)) {
|
|
|
|
|
if (ast_pthread_mutex_lock(&formatlock)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to lock format list\n");
|
|
|
|
|
if (action == ACTION_EXISTS)
|
|
|
|
|
return 0;
|
|
|
|
@ -304,7 +304,7 @@ static int ast_filehelper(char *filename, char *filename2, char *fmt, int action
|
|
|
|
|
}
|
|
|
|
|
f = f->next;
|
|
|
|
|
}
|
|
|
|
|
pthread_mutex_unlock(&formatlock);
|
|
|
|
|
ast_pthread_mutex_unlock(&formatlock);
|
|
|
|
|
if ((action == ACTION_EXISTS) || (action == ACTION_OPEN))
|
|
|
|
|
res = ret ? ret : -1;
|
|
|
|
|
return res;
|
|
|
|
@ -404,7 +404,7 @@ struct ast_filestream *ast_writefile(char *filename, char *type, char *comment,
|
|
|
|
|
struct ast_filestream *fs=NULL;
|
|
|
|
|
char *fn;
|
|
|
|
|
char *ext;
|
|
|
|
|
if (pthread_mutex_lock(&formatlock)) {
|
|
|
|
|
if (ast_pthread_mutex_lock(&formatlock)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to lock format list\n");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
@ -434,7 +434,7 @@ struct ast_filestream *ast_writefile(char *filename, char *type, char *comment,
|
|
|
|
|
}
|
|
|
|
|
f = f->next;
|
|
|
|
|
}
|
|
|
|
|
pthread_mutex_unlock(&formatlock);
|
|
|
|
|
ast_pthread_mutex_unlock(&formatlock);
|
|
|
|
|
if (!f)
|
|
|
|
|
ast_log(LOG_WARNING, "No such format '%s'\n", type);
|
|
|
|
|
return fs;
|
|
|
|
@ -476,6 +476,10 @@ char ast_waitstream(struct ast_channel *c, char *breakon)
|
|
|
|
|
case AST_CONTROL_HANGUP:
|
|
|
|
|
ast_frfree(fr);
|
|
|
|
|
return -1;
|
|
|
|
|
case AST_CONTROL_RINGING:
|
|
|
|
|
case AST_CONTROL_ANSWER:
|
|
|
|
|
/* Unimportant */
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ast_log(LOG_WARNING, "Unexpected control subclass '%d'\n", fr->subclass);
|
|
|
|
|
}
|
|
|
|
|