diff options
author | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-12-21 19:52:18 +0000 |
---|---|---|
committer | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-12-21 19:52:18 +0000 |
commit | 4afdbc642b4133b61c608fb25942306510d024e6 (patch) | |
tree | 8412d2a8fc355fa473d654feb47f5159e0df9aee /apps | |
parent | 322326058e7ad82eeb971673895f71bcc3230244 (diff) |
put generator functions next to each other.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48768 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_sms.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/apps/app_sms.c b/apps/app_sms.c index c68d3b958..44b7c52bb 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -253,16 +253,6 @@ typedef struct sms_s { #define is8bit(dcs) (((dcs)&0xC0)?(((dcs)&4)):(((dcs)&12)==4)) #define is16bit(dcs) (((dcs)&0xC0)?0:(((dcs)&12)==8)) -static void *sms_alloc (struct ast_channel *chan, void *params) -{ - return params; -} - -static void sms_release (struct ast_channel *chan, void *data) -{ - return; -} - static void sms_messagetx (sms_t * h); /*! \brief copy number, skipping non digits apart from leading + */ @@ -1469,6 +1459,10 @@ static void sms_messagetx(sms_t * h) h->obyten = len + 1; /* bytes to send (including checksum) */ } +/*! + * outgoing data are produced by this generator function, that reads from + * the descriptor whether it has data to send and which ones. + */ static int sms_generate (struct ast_channel *chan, void *data, int len, int samples) { struct ast_frame f = { 0 }; @@ -1544,6 +1538,25 @@ static int sms_generate (struct ast_channel *chan, void *data, int len, int samp } /*! + * Just return the pointer to the descriptor that we received. + */ +static void *sms_alloc (struct ast_channel *chan, void *sms_t_ptr) +{ + return sms_t_ptr; +} + +static void sms_release (struct ast_channel *chan, void *data) +{ + return; /* nothing to do here. */ +} + +static struct ast_generator smsgen = { + .alloc = sms_alloc, + .release = sms_release, + .generate = sms_generate, +}; + +/*! * Process an incoming frame, trying to detect the carrier and * decode the message. The two frequencies are 1300 and 2100 Hz. * The decoder detects the amplitude of the signal over the last @@ -1679,12 +1692,6 @@ static void sms_process(sms_t * h, int samples, signed short *data) } } -static struct ast_generator smsgen = { - alloc:sms_alloc, - release:sms_release, - generate:sms_generate, -}; - static int sms_exec (struct ast_channel *chan, void *data) { int res = -1; |