[svn-commits] qwell: branch qwell/ari_channel_mute r393846 - in /team/qwell/ari_channel_mut...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Jul 8 15:47:59 CDT 2013
Author: qwell
Date: Mon Jul 8 15:47:58 2013
New Revision: 393846
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393846
Log:
s/mute/suppress/
Modified:
team/qwell/ari_channel_mute/include/asterisk/channel.h
team/qwell/ari_channel_mute/main/channel.c
team/qwell/ari_channel_mute/res/res_mutestream.c
team/qwell/ari_channel_mute/res/stasis/control.c
Modified: team/qwell/ari_channel_mute/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_mute/include/asterisk/channel.h?view=diff&rev=393846&r1=393845&r2=393846
==============================================================================
--- team/qwell/ari_channel_mute/include/asterisk/channel.h (original)
+++ team/qwell/ari_channel_mute/include/asterisk/channel.h Mon Jul 8 15:47:58 2013
@@ -4379,27 +4379,27 @@
#define AST_MUTE_DIRECTION_WRITE (1 << 1)
/*!
- * \brief Mute a stream on a channel
- *
- * \param chan The channel to mute
- * \param direction The direction of the stream to mute
- * \param frametype The type of frame (AST_FRAME_VOICE, etc) to mute
+ * \brief Suppress a stream on a channel
+ *
+ * \param chan The channel to suppress
+ * \param direction The direction of the stream to suppress
+ * \param frametype The type of frame (AST_FRAME_VOICE, etc) to suppress
*
* \retval 0 Success
* \retval -1 Failure
*/
-int ast_channel_mute(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype);
-
-/*!
- * \brief Unmute a stream on a channel
- *
- * \param chan The channel to unmute
- * \param direction The direction of the stream to unmute
- * \param frametype The type of frame (AST_FRAME_VOICE, etc) to unmute
+int ast_channel_suppress(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype);
+
+/*!
+ * \brief Stop suppressing a stream on a channel
+ *
+ * \param chan The channel to stop suppressing
+ * \param direction The direction of the stream to stop suppressing
+ * \param frametype The type of frame (AST_FRAME_VOICE, etc) to stop suppressing
*
* \retval 0 Success
* \retval -1 Failure
*/
-int ast_channel_unmute(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype);
+int ast_channel_unsuppress(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype);
#endif /* _ASTERISK_CHANNEL_H */
Modified: team/qwell/ari_channel_mute/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_mute/main/channel.c?view=diff&rev=393846&r1=393845&r2=393846
==============================================================================
--- team/qwell/ari_channel_mute/main/channel.c (original)
+++ team/qwell/ari_channel_mute/main/channel.c Mon Jul 8 15:47:58 2013
@@ -10533,47 +10533,47 @@
return 0;
}
-static void mute_datastore_destroy_cb(void *data)
+static void suppress_datastore_destroy_cb(void *data)
{
ao2_cleanup(data);
}
-static const struct ast_datastore_info mute_datastore_voice = {
- .type = "mutevoice",
- .destroy = mute_datastore_destroy_cb
+static const struct ast_datastore_info suppress_datastore_voice = {
+ .type = "suppressvoice",
+ .destroy = suppress_datastore_destroy_cb
};
-static void mute_framehook_destroy_cb(void *data)
+static void suppress_framehook_destroy_cb(void *data)
{
ao2_cleanup(data);
}
-struct mute_data {
+struct suppress_data {
enum ast_frame_type frametype;
unsigned int direction;
int framehook_id;
};
-static struct ast_frame *mute_framehook_event_cb(struct ast_channel *chan, struct ast_frame *frame, enum ast_framehook_event event, void *data)
-{
- struct mute_data *mute = data;
- int mute_frame = 0;
+static struct ast_frame *suppress_framehook_event_cb(struct ast_channel *chan, struct ast_frame *frame, enum ast_framehook_event event, void *data)
+{
+ struct suppress_data *suppress = data;
+ int suppress_frame = 0;
if (!frame) {
return NULL;
}
- if (frame->frametype != mute->frametype) {
+ if (frame->frametype != suppress->frametype) {
return frame;
}
- if (event == AST_FRAMEHOOK_EVENT_READ && (mute->direction & AST_MUTE_DIRECTION_READ)) {
- mute_frame = 1;
- } else if (event == AST_FRAMEHOOK_EVENT_WRITE && (mute->direction & AST_MUTE_DIRECTION_WRITE)) {
- mute_frame = 1;
- }
-
- if (mute_frame) {
+ if (event == AST_FRAMEHOOK_EVENT_READ && (suppress->direction & AST_MUTE_DIRECTION_READ)) {
+ suppress_frame = 1;
+ } else if (event == AST_FRAMEHOOK_EVENT_WRITE && (suppress->direction & AST_MUTE_DIRECTION_WRITE)) {
+ suppress_frame = 1;
+ }
+
+ if (suppress_frame) {
switch (frame->frametype) {
case AST_FRAME_VOICE:
frame = &ast_null_frame;
@@ -10586,90 +10586,90 @@
return frame;
}
-static const struct ast_datastore_info *mute_get_datastore_information(enum ast_frame_type frametype)
+static const struct ast_datastore_info *suppress_get_datastore_information(enum ast_frame_type frametype)
{
switch (frametype) {
case AST_FRAME_VOICE:
- return &mute_datastore_voice;
+ return &suppress_datastore_voice;
default:
return NULL;
}
}
-int ast_channel_mute(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype)
+int ast_channel_suppress(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype)
{
SCOPED_CHANNELLOCK(lockvar, chan);
- RAII_VAR(struct mute_data *, mute, NULL, ao2_cleanup);
+ RAII_VAR(struct suppress_data *, suppress, NULL, ao2_cleanup);
const struct ast_datastore_info *datastore_info = NULL;
struct ast_datastore *datastore = NULL;
struct ast_framehook_interface interface = {
.version = AST_FRAMEHOOK_INTERFACE_VERSION,
- .event_cb = mute_framehook_event_cb,
- .destroy_cb = mute_framehook_destroy_cb,
+ .event_cb = suppress_framehook_event_cb,
+ .destroy_cb = suppress_framehook_destroy_cb,
};
int framehook_id;
- if (!(datastore_info = mute_get_datastore_information(frametype))) {
- ast_log(LOG_WARNING, "Attempted to mute an unsupported frame type (%d).\n", frametype);
+ if (!(datastore_info = suppress_get_datastore_information(frametype))) {
+ ast_log(LOG_WARNING, "Attempted to suppress an unsupported frame type (%d).\n", frametype);
return -1;
}
if ((datastore = ast_channel_datastore_find(chan, datastore_info, NULL))) {
- mute = datastore->data;
- ao2_ref(mute, +1);
-
- mute->direction |= direction;
+ suppress = datastore->data;
+ ao2_ref(suppress, +1);
+
+ suppress->direction |= direction;
return 0;
}
- if (!(mute = ao2_alloc(sizeof(*mute), NULL))) {
- ast_log(LOG_WARNING, "Failed to allocate data while attempting to mute channel.\n");
+ if (!(suppress = ao2_alloc(sizeof(*suppress), NULL))) {
+ ast_log(LOG_WARNING, "Failed to allocate data while attempting to suppress a stream.\n");
return -1;
}
- mute->frametype = frametype;
- mute->direction |= direction;
-
- interface.data = mute;
+ suppress->frametype = frametype;
+ suppress->direction |= direction;
+
+ interface.data = suppress;
framehook_id = ast_framehook_attach(chan, &interface);
if (framehook_id < 0) {
/* Hook attach failed. Get rid of the evidence. */
- ast_log(LOG_WARNING, "Failed to attach framehook while attempting to mute channel.\n");
+ ast_log(LOG_WARNING, "Failed to attach framehook while attempting to suppress a stream.\n");
return -1;
}
/* One ref for the framehook */
- ao2_ref(mute, +1);
-
- mute->framehook_id = framehook_id;
+ ao2_ref(suppress, +1);
+
+ suppress->framehook_id = framehook_id;
if (!(datastore = ast_datastore_alloc(datastore_info, NULL))) {
- ast_log(LOG_WARNING, "Failed to allocate datastore while attempting to mute channel.\n");
+ ast_log(LOG_WARNING, "Failed to allocate datastore while attempting to suppress a stream.\n");
ast_framehook_detach(chan, framehook_id);
return -1;
}
- datastore->data = mute;
+ datastore->data = suppress;
ast_channel_datastore_add(chan, datastore);
/* and another ref for the datastore */
- ao2_ref(mute, +1);
+ ao2_ref(suppress, +1);
return 0;
}
-int ast_channel_unmute(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype)
+int ast_channel_unsuppress(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype)
{
const struct ast_datastore_info *datastore_info = NULL;
struct ast_datastore *datastore = NULL;
- struct mute_data *mute;
-
- if (!(datastore_info = mute_get_datastore_information(frametype))) {
- ast_log(LOG_WARNING, "Attempted to unmute an unsupported frame type (%d).\n", frametype);
+ struct suppress_data *suppress;
+
+ if (!(datastore_info = suppress_get_datastore_information(frametype))) {
+ ast_log(LOG_WARNING, "Attempted to unsuppress an unsupported frame type (%d).\n", frametype);
return -1;
}
@@ -10678,13 +10678,13 @@
return 0;
}
- mute = datastore->data;
-
- mute->direction &= ~(direction);
-
- if (mute->direction == 0) {
- /* Nothing left to mute. Bye! */
- ast_framehook_detach(chan, mute->framehook_id);
+ suppress = datastore->data;
+
+ suppress->direction &= ~(direction);
+
+ if (suppress->direction == 0) {
+ /* Nothing left to suppress. Bye! */
+ ast_framehook_detach(chan, suppress->framehook_id);
ast_channel_datastore_remove(chan, datastore);
}
Modified: team/qwell/ari_channel_mute/res/res_mutestream.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_mute/res/res_mutestream.c?view=diff&rev=393846&r1=393845&r2=393846
==============================================================================
--- team/qwell/ari_channel_mute/res/res_mutestream.c (original)
+++ team/qwell/ari_channel_mute/res/res_mutestream.c Mon Jul 8 15:47:58 2013
@@ -142,9 +142,9 @@
ast_channel_lock(chan);
if (mute) {
- ret = ast_channel_mute(chan, mute_direction, frametype);
+ ret = ast_channel_suppress(chan, mute_direction, frametype);
} else {
- ret = ast_channel_unmute(chan, mute_direction, frametype);
+ ret = ast_channel_unsuppress(chan, mute_direction, frametype);
}
ast_channel_unlock(chan);
Modified: team/qwell/ari_channel_mute/res/stasis/control.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_mute/res/stasis/control.c?view=diff&rev=393846&r1=393845&r2=393846
==============================================================================
--- team/qwell/ari_channel_mute/res/stasis/control.c (original)
+++ team/qwell/ari_channel_mute/res/stasis/control.c Mon Jul 8 15:47:58 2013
@@ -218,7 +218,7 @@
{
RAII_VAR(struct stasis_app_control_mute_data *, mute_data, data, ast_free);
- ast_channel_mute(control->channel, mute_data->direction, mute_data->frametype);
+ ast_channel_suppress(control->channel, mute_data->direction, mute_data->frametype);
return NULL;
}
@@ -244,7 +244,7 @@
{
RAII_VAR(struct stasis_app_control_mute_data *, mute_data, data, ast_free);
- ast_channel_unmute(control->channel, mute_data->direction, mute_data->frametype);
+ ast_channel_unsuppress(control->channel, mute_data->direction, mute_data->frametype);
return NULL;
}
More information about the svn-commits
mailing list