aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-28 18:59:59 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-28 18:59:59 +0000
commite2c714c0cff1a5c76c83a9b4280d5fad6ddae714 (patch)
treecc434c7447968461b0272d46631fd26fc0e9247a /include
parent1b8e8e16331b3dc3ec079bc5a2e094c2fcac7f27 (diff)
move slinfactory structure definition back to header... it's just easier to use this way
add infrastructure for whispering onto a channel git-svn-id: http://svn.digium.com/svn/asterisk/trunk@38422 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/channel.h45
-rw-r--r--include/asterisk/frame.h6
-rw-r--r--include/asterisk/slinfactory.h10
3 files changed, 51 insertions, 10 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 06a895293..fe2b33ed9 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -268,6 +268,7 @@ struct ast_channel_tech {
};
struct ast_channel_spy_list;
+struct ast_channel_whisper_buffer;
#define DEBUGCHAN_FLAG 0x80000000
#define FRAMECOUNT_INC(x) ( ((x) & DEBUGCHAN_FLAG) | ((x++) & ~DEBUGCHAN_FLAG) )
@@ -382,6 +383,7 @@ struct ast_channel {
int rawwriteformat; /*!< Raw write format */
struct ast_channel_spy_list *spies; /*!< Chan Spy stuff */
+ struct ast_channel_whisper_buffer *whisper; /*!< Whisper Paging buffer */
AST_LIST_ENTRY(ast_channel) chan_list; /*!< For easy linking */
struct ast_jb jb; /*!< The jitterbuffer state */
@@ -397,21 +399,20 @@ struct ast_channel {
/*! \brief Channels have this property if they can create jitter; i.e. most VoIP channels */
#define AST_CHAN_TP_CREATESJITTER (1 << 1)
-/* This flag has been deprecated by the transfercapbilty data member in struct ast_channel */
-/* #define AST_FLAG_DIGITAL (1 << 0) */ /* if the call is a digital ISDN call */
#define AST_FLAG_DEFER_DTMF (1 << 1) /*!< if dtmf should be deferred */
#define AST_FLAG_WRITE_INT (1 << 2) /*!< if write should be interrupt generator */
#define AST_FLAG_BLOCKING (1 << 3) /*!< if we are blocking */
#define AST_FLAG_ZOMBIE (1 << 4) /*!< if we are a zombie */
#define AST_FLAG_EXCEPTION (1 << 5) /*!< if there is a pending exception */
#define AST_FLAG_MOH (1 << 6) /*!< XXX anthm promises me this will disappear XXX listening to moh */
-#define AST_FLAG_SPYING (1 << 7) /*!< XXX might also go away XXX is spying on someone */
+#define AST_FLAG_SPYING (1 << 7) /*!< is spying on someone */
#define AST_FLAG_NBRIDGE (1 << 8) /*!< is it in a native bridge */
#define AST_FLAG_IN_AUTOLOOP (1 << 9) /*!< the channel is in an auto-incrementing dialplan processor,
so when ->priority is set, it will get incremented before
- finding the next priority to run
- */
-#define AST_FLAG_OUTGOING (1 << 10) /*! Is this call outgoing */
+ finding the next priority to run */
+#define AST_FLAG_OUTGOING (1 << 10) /*!< Is this call outgoing */
+#define AST_FLAG_WHISPER (1 << 11) /*!< Is this channel being whispered on */
+
/* @} */
#define AST_FEATURE_PLAY_WARNING (1 << 0)
@@ -1277,6 +1278,38 @@ const char *channelreloadreason2txt(enum channelreloadreason reason);
/*! \brief return an ast_variable list of channeltypes */
struct ast_variable *ast_channeltype_list(void);
+/*!
+ \brief Begin 'whispering' onto a channel
+ \param chan The channel to whisper onto
+ \return 0 for success, non-zero for failure
+
+ This function will add a whisper buffer onto a channel and set a flag
+ causing writes to the channel to reduce the volume level of the written
+ audio samples, and then to mix in audio from the whisper buffer if it
+ is available.
+
+ Note: This function performs no locking; you must hold the channel's lock before
+ calling this function.
+ */
+int ast_channel_whisper_start(struct ast_channel *chan);
+
+/*!
+ \brief Feed an audio frame into the whisper buffer on a channel
+ \param chan The channel to whisper onto
+ \return 0 for success, non-zero for failure
+ */
+int ast_channel_whisper_feed(struct ast_channel *chan, struct ast_frame *f);
+
+/*!
+ \brief Stop 'whispering' onto a channel
+ \param chan The channel to whisper onto
+ \return 0 for success, non-zero for failure
+
+ Note: This function performs no locking; you must hold the channel's lock before
+ calling this function.
+ */
+void ast_channel_whisper_stop(struct ast_channel *chan);
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h
index ab9cb1b8c..35cd30ac6 100644
--- a/include/asterisk/frame.h
+++ b/include/asterisk/frame.h
@@ -354,7 +354,7 @@ struct ast_frame *ast_fralloc(char *source, int len);
*/
void ast_frfree(struct ast_frame *fr);
-/*! \brief Copies a frame
+/*! \brief Makes a frame independent of any static storage
* \param fr frame to act upon
* Take a frame, and if it's not been malloc'd, make a malloc'd copy
* and if the data hasn't been malloced then make the
@@ -366,10 +366,10 @@ struct ast_frame *ast_frisolate(struct ast_frame *fr);
/*! \brief Copies a frame
* \param fr frame to copy
- * Dupliates a frame -- should only rarely be used, typically frisolate is good enough
+ * Duplicates a frame -- should only rarely be used, typically frisolate is good enough
* \return Returns a frame on success, NULL on error
*/
-struct ast_frame *ast_frdup(struct ast_frame *fr);
+struct ast_frame *ast_frdup(const struct ast_frame *fr);
/*! \brief Reads a frame from an fd
* Read a frame from a stream or packet fd, as written by fd_write
diff --git a/include/asterisk/slinfactory.h b/include/asterisk/slinfactory.h
index be2e96e58..4bdbfa7cd 100644
--- a/include/asterisk/slinfactory.h
+++ b/include/asterisk/slinfactory.h
@@ -31,7 +31,15 @@
extern "C" {
#endif
-struct ast_slinfactory;
+struct ast_slinfactory {
+ struct ast_frame *queue;
+ struct ast_trans_pvt *trans;
+ short hold[1280];
+ short *offset;
+ size_t holdlen; /*!< in samples */
+ unsigned int size; /*!< in samples */
+ unsigned int format;
+};
void ast_slinfactory_init(struct ast_slinfactory *sf);
void ast_slinfactory_destroy(struct ast_slinfactory *sf);