mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +00:00
Version 0.1.8 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@310 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
24
file.c
24
file.c
@@ -77,14 +77,14 @@ int ast_format_register(char *name, char *exts, int format,
|
|||||||
char * (*getcomment)(struct ast_filestream *))
|
char * (*getcomment)(struct ast_filestream *))
|
||||||
{
|
{
|
||||||
struct ast_format *tmp;
|
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");
|
ast_log(LOG_WARNING, "Unable to lock format list\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tmp = formats;
|
tmp = formats;
|
||||||
while(tmp) {
|
while(tmp) {
|
||||||
if (!strcasecmp(name, tmp->name)) {
|
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);
|
ast_log(LOG_WARNING, "Tried to register '%s' format, already registered\n", name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ int ast_format_register(char *name, char *exts, int format,
|
|||||||
tmp = malloc(sizeof(struct ast_format));
|
tmp = malloc(sizeof(struct ast_format));
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
ast_log(LOG_WARNING, "Out of memory\n");
|
ast_log(LOG_WARNING, "Out of memory\n");
|
||||||
pthread_mutex_unlock(&formatlock);
|
ast_pthread_mutex_unlock(&formatlock);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
strncpy(tmp->name, name, sizeof(tmp->name));
|
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->getcomment = getcomment;
|
||||||
tmp->next = formats;
|
tmp->next = formats;
|
||||||
formats = tmp;
|
formats = tmp;
|
||||||
pthread_mutex_unlock(&formatlock);
|
ast_pthread_mutex_unlock(&formatlock);
|
||||||
if (option_verbose > 1)
|
if (option_verbose > 1)
|
||||||
ast_verbose( VERBOSE_PREFIX_2 "Registered file format %s, extension(s) %s\n", name, exts);
|
ast_verbose( VERBOSE_PREFIX_2 "Registered file format %s, extension(s) %s\n", name, exts);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -117,7 +117,7 @@ int ast_format_register(char *name, char *exts, int format,
|
|||||||
int ast_format_unregister(char *name)
|
int ast_format_unregister(char *name)
|
||||||
{
|
{
|
||||||
struct ast_format *tmp, *tmpl = NULL;
|
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");
|
ast_log(LOG_WARNING, "Unable to lock format list\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ int ast_format_unregister(char *name)
|
|||||||
else
|
else
|
||||||
formats = tmp->next;
|
formats = tmp->next;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
pthread_mutex_unlock(&formatlock);
|
ast_pthread_mutex_unlock(&formatlock);
|
||||||
if (option_verbose > 1)
|
if (option_verbose > 1)
|
||||||
ast_verbose( VERBOSE_PREFIX_2 "Unregistered format %s\n", name);
|
ast_verbose( VERBOSE_PREFIX_2 "Unregistered format %s\n", name);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -228,7 +228,7 @@ static int ast_filehelper(char *filename, char *filename2, char *fmt, int action
|
|||||||
if (action == ACTION_OPEN)
|
if (action == ACTION_OPEN)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
/* Check for a specific format */
|
/* 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");
|
ast_log(LOG_WARNING, "Unable to lock format list\n");
|
||||||
if (action == ACTION_EXISTS)
|
if (action == ACTION_EXISTS)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -304,7 +304,7 @@ static int ast_filehelper(char *filename, char *filename2, char *fmt, int action
|
|||||||
}
|
}
|
||||||
f = f->next;
|
f = f->next;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&formatlock);
|
ast_pthread_mutex_unlock(&formatlock);
|
||||||
if ((action == ACTION_EXISTS) || (action == ACTION_OPEN))
|
if ((action == ACTION_EXISTS) || (action == ACTION_OPEN))
|
||||||
res = ret ? ret : -1;
|
res = ret ? ret : -1;
|
||||||
return res;
|
return res;
|
||||||
@@ -404,7 +404,7 @@ struct ast_filestream *ast_writefile(char *filename, char *type, char *comment,
|
|||||||
struct ast_filestream *fs=NULL;
|
struct ast_filestream *fs=NULL;
|
||||||
char *fn;
|
char *fn;
|
||||||
char *ext;
|
char *ext;
|
||||||
if (pthread_mutex_lock(&formatlock)) {
|
if (ast_pthread_mutex_lock(&formatlock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock format list\n");
|
ast_log(LOG_WARNING, "Unable to lock format list\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -434,7 +434,7 @@ struct ast_filestream *ast_writefile(char *filename, char *type, char *comment,
|
|||||||
}
|
}
|
||||||
f = f->next;
|
f = f->next;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&formatlock);
|
ast_pthread_mutex_unlock(&formatlock);
|
||||||
if (!f)
|
if (!f)
|
||||||
ast_log(LOG_WARNING, "No such format '%s'\n", type);
|
ast_log(LOG_WARNING, "No such format '%s'\n", type);
|
||||||
return fs;
|
return fs;
|
||||||
@@ -476,6 +476,10 @@ char ast_waitstream(struct ast_channel *c, char *breakon)
|
|||||||
case AST_CONTROL_HANGUP:
|
case AST_CONTROL_HANGUP:
|
||||||
ast_frfree(fr);
|
ast_frfree(fr);
|
||||||
return -1;
|
return -1;
|
||||||
|
case AST_CONTROL_RINGING:
|
||||||
|
case AST_CONTROL_ANSWER:
|
||||||
|
/* Unimportant */
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ast_log(LOG_WARNING, "Unexpected control subclass '%d'\n", fr->subclass);
|
ast_log(LOG_WARNING, "Unexpected control subclass '%d'\n", fr->subclass);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user