diff options
author | David Vossel <dvossel@digium.com> | 2011-02-03 16:22:10 +0000 |
---|---|---|
committer | David Vossel <dvossel@digium.com> | 2011-02-03 16:22:10 +0000 |
commit | c26c190711a1bbe3b5fff1a93facae333757c56e (patch) | |
tree | 00da0caa5a07b7b25729f089dbcafb08129fa9be /apps/app_amd.c | |
parent | 652fb64a01c7a8656697d07e606620ee0ced6929 (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: https://origsvn.digium.com/svn/asterisk/trunk@306010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_amd.c')
-rw-r--r-- | apps/app_amd.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/app_amd.c b/apps/app_amd.c index c978ce0f4..60c13fd95 100644 --- a/apps/app_amd.c +++ b/apps/app_amd.c @@ -148,7 +148,8 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) int res = 0; struct ast_frame *f = NULL; struct ast_dsp *silenceDetector = NULL; - int dspsilence = 0, readFormat, framelength = 0; + int dspsilence = 0, framelength = 0; + struct ast_format readFormat; int inInitialSilence = 1; int inGreeting = 0; int voiceDuration = 0; @@ -188,10 +189,11 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) AST_APP_ARG(argMaximumWordLength); ); + ast_format_clear(&readFormat); ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", chan->name, S_COR(chan->caller.ani.number.valid, chan->caller.ani.number.str, "(N/A)"), S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, "(N/A)"), - ast_getformatname(chan->readformat)); + ast_getformatname(&chan->readformat)); /* Lets parse the arguments. */ if (!ast_strlen_zero(parse)) { @@ -240,8 +242,8 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) minimumWordLength, betweenWordsSilence, maximumNumberOfWords, silenceThreshold, maximumWordLength); /* Set read format to signed linear so we get signed linear frames in */ - readFormat = chan->readformat; - if (ast_set_read_format(chan, AST_FORMAT_SLINEAR) < 0 ) { + ast_format_copy(&readFormat, &chan->readformat); + if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR) < 0 ) { ast_log(LOG_WARNING, "AMD: Channel [%s]. Unable to set to linear mode, giving up\n", chan->name ); pbx_builtin_setvar_helper(chan , "AMDSTATUS", ""); pbx_builtin_setvar_helper(chan , "AMDCAUSE", ""); @@ -399,7 +401,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) pbx_builtin_setvar_helper(chan , "AMDCAUSE" , amdCause); /* Restore channel read format */ - if (readFormat && ast_set_read_format(chan, readFormat)) + if (readFormat.id && ast_set_read_format(chan, &readFormat)) ast_log(LOG_WARNING, "AMD: Unable to restore read format on '%s'\n", chan->name); /* Free the DSP used to detect silence */ |