summaryrefslogtreecommitdiff
path: root/res/res_speech.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2007-07-11 16:10:03 +0000
committerJoshua Colp <jcolp@digium.com>2007-07-11 16:10:03 +0000
commitb314d6ee08b351955f579f01ca5eda1730ab8641 (patch)
tree72e018984e7adf9cd8afeb3e7fbc92e6e9ad1142 /res/res_speech.c
parent406c3df40e6b94c6b8ebdf476a9610eab5b43cf7 (diff)
Can't forget to remember what format is in use for writing.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@74560 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_speech.c')
-rw-r--r--res/res_speech.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/res/res_speech.c b/res/res_speech.c
index fdcf322a6..b902f40d7 100644
--- a/res/res_speech.c
+++ b/res/res_speech.c
@@ -168,6 +168,10 @@ struct ast_speech *ast_speech_new(char *engine_name, int format)
if (!(engine = find_engine(engine_name)))
return NULL;
+ /* Make sure the requested format fits */
+ if (!(engine->formats & format))
+ return NULL;
+
/* Allocate our own speech structure, and try to allocate a structure from the engine too */
if (!(new_speech = ast_calloc(1, sizeof(*new_speech))))
return NULL;
@@ -181,6 +185,9 @@ struct ast_speech *ast_speech_new(char *engine_name, int format)
/* Copy over our engine pointer */
new_speech->engine = engine;
+ /* Can't forget the format audio is going to be in */
+ new_speech->format = format;
+
/* We are not ready to accept audio yet */
ast_speech_change_state(new_speech, AST_SPEECH_STATE_NOT_READY);