[svn-commits] file: branch file/bridging r65490 -
/team/file/bridging/bridges/bridge_softmix.c
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Tue May 22 10:35:45 MST 2007
Author: file
Date: Tue May 22 12:35:45 2007
New Revision: 65490
URL: http://svn.digium.com/view/asterisk?view=rev&rev=65490
Log:
Add skeleton file for the software based mixer.
Added:
team/file/bridging/bridges/bridge_softmix.c (with props)
Added: team/file/bridging/bridges/bridge_softmix.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/bridges/bridge_softmix.c?view=auto&rev=65490
==============================================================================
--- team/file/bridging/bridges/bridge_softmix.c (added)
+++ team/file/bridging/bridges/bridge_softmix.c Tue May 22 12:35:45 2007
@@ -1,0 +1,124 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2007, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief Multi-party software based channel mixing
+ *
+ * \author Joshua Colp <jcolp at digium.com>
+ *
+ * \ingroup bridges
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "asterisk/module.h"
+#include "asterisk/channel.h"
+#include "asterisk/bridging.h"
+#include "asterisk/frame.h"
+#include "asterisk/slinfactory.h"
+#include "asterisk/options.h"
+#include "asterisk/logger.h"
+
+#define SOFTMIX_SAMPLES 160
+
+struct softmix_bridge_pvt {
+ struct ast_slinfactory *factory;
+};
+
+struct softmix_bridge_channel_pvt {
+ struct ast_slinfactory *factory;
+ struct ast_frame *frame;
+};
+
+/* Called when the bridge is created */
+static int softmix_bridge_create(struct ast_bridge *bridge)
+{
+ return 0;
+}
+
+/* Called when the bridge is destroyed */
+static int softmix_bridge_destroy(struct ast_bridge *bridge)
+{
+ return 0;
+}
+
+/* Called when a channel is joined to the bridge. We need to setup a smoother so that frames from all channels will be consistent */
+static int softmix_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+{
+ struct softmix_bridge_channel_pvt *sbcp = NULL;
+
+ /* Allocate new memory for the bridged channel private structure */
+ if (!(sbcp = ast_calloc(1, sizeof(*sbcp))))
+ return -1;
+
+ /* Associate our private structure with the bridged channel, it would be rather useless without it */
+ bridge_channel->bridge_pvt = sbcp;
+
+ return 0;
+}
+
+/* Called when a channel leaves the bridge */
+static int softmix_bridge_leave(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+{
+ return 0;
+}
+
+/* Called when a frame comes from a channel and should go into the bridge */
+static int softmix_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
+{
+ return 0;
+}
+
+/* Called when the bridged channel thread should do something */
+static int softmix_bridge_signal(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+{
+ return 0;
+}
+
+static struct ast_bridge_technology softmix_bridge = {
+ .name = "softmix",
+ .capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX,
+ .formats = AST_FORMAT_SLINEAR,
+ .create = softmix_bridge_create,
+ .destroy = softmix_bridge_destroy,
+ .join = softmix_bridge_join,
+ .leave = softmix_bridge_leave,
+ .write = softmix_bridge_write,
+ .signal = softmix_bridge_signal,
+};
+
+static int unload_module(void)
+{
+ return ast_bridge_technology_unregister(&softmix_bridge);
+}
+
+static int load_module(void)
+{
+ return ast_bridge_technology_register(&softmix_bridge);
+}
+
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Multi-party software based channel mixing");
Propchange: team/file/bridging/bridges/bridge_softmix.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/file/bridging/bridges/bridge_softmix.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/file/bridging/bridges/bridge_softmix.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the svn-commits
mailing list