aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_speech_utils.c
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2011-02-03 16:22:10 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2011-02-03 16:22:10 +0000
commit4aca3187a3db25ff4d2208f116f618b363dec7d5 (patch)
tree00da0caa5a07b7b25729f089dbcafb08129fa9be /apps/app_speech_utils.c
parent8170aae0a0882a93ca1ef80736cb95c2d6126865 (diff)
Asterisk media architecture conversion - no more format bitfields
This patch is the foundation of an entire new way of looking at media in Asterisk. The code present in this patch is everything required to complete phase1 of my Media Architecture proposal. For more information about this project visit the link below. https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal The primary function of this patch is to convert all the usages of format bitfields in Asterisk to use the new format and format_cap APIs. Functionally no change in behavior should be present in this patch. Thanks to twilson and russell for all the time they spent reviewing these changes. Review: https://reviewboard.asterisk.org/r/1083/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@306010 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_speech_utils.c')
-rw-r--r--apps/app_speech_utils.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c
index 0323f7c47..fe99157e9 100644
--- a/apps/app_speech_utils.c
+++ b/apps/app_speech_utils.c
@@ -642,7 +642,7 @@ static int speech_background(struct ast_channel *chan, const char *data)
int res = 0, done = 0, started = 0, quieted = 0, max_dtmf_len = 0;
struct ast_speech *speech = find_speech(chan);
struct ast_frame *f = NULL;
- int oldreadformat = AST_FORMAT_SLINEAR;
+ struct ast_format oldreadformat;
char dtmf[AST_MAX_EXTENSION] = "";
struct timeval start = { 0, 0 }, current;
struct ast_datastore *datastore = NULL;
@@ -658,6 +658,7 @@ static int speech_background(struct ast_channel *chan, const char *data)
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
+ ast_format_clear(&oldreadformat);
if (speech == NULL)
return -1;
@@ -673,10 +674,10 @@ static int speech_background(struct ast_channel *chan, const char *data)
}
/* Record old read format */
- oldreadformat = chan->readformat;
+ ast_format_copy(&oldreadformat, &chan->readformat);
/* Change read format to be signed linear */
- if (ast_set_read_format(chan, speech->format))
+ if (ast_set_read_format(chan, &speech->format))
return -1;
if (!ast_strlen_zero(args.soundfile)) {
@@ -881,7 +882,7 @@ static int speech_background(struct ast_channel *chan, const char *data)
ast_channel_datastore_remove(chan, datastore);
} else {
/* Channel is okay so restore read format */
- ast_set_read_format(chan, oldreadformat);
+ ast_set_read_format(chan, &oldreadformat);
}
return 0;