[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r302627 - /team/dvossel/fixt...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 19 14:23:10 CST 2011


Author: dvossel
Date: Wed Jan 19 14:23:06 2011
New Revision: 302627

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=302627
Log:
conversion of multicast_rtp.c to ast_format api

Modified:
    team/dvossel/fixtheworld_phase1_step3/channels/chan_multicast_rtp.c

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_multicast_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_multicast_rtp.c?view=diff&rev=302627&r1=302626&r2=302627
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_multicast_rtp.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_multicast_rtp.c Wed Jan 19 14:23:06 2011
@@ -52,17 +52,16 @@
 static const char tdesc[] = "Multicast RTP Paging Channel Driver";
 
 /* Forward declarations */
-static struct ast_channel *multicast_rtp_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
+static struct ast_channel *multicast_rtp_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, void *data, int *cause);
 static int multicast_rtp_call(struct ast_channel *ast, char *dest, int timeout);
 static int multicast_rtp_hangup(struct ast_channel *ast);
 static struct ast_frame *multicast_rtp_read(struct ast_channel *ast);
 static int multicast_rtp_write(struct ast_channel *ast, struct ast_frame *f);
 
 /* Channel driver declaration */
-static const struct ast_channel_tech multicast_rtp_tech = {
+static struct ast_channel_tech multicast_rtp_tech = {
 	.type = "MulticastRTP",
 	.description = tdesc,
-	.capabilities = -1,
 	.requester = multicast_rtp_request,
 	.call = multicast_rtp_call,
 	.hangup = multicast_rtp_hangup,
@@ -107,14 +106,15 @@
 }
 
 /*! \brief Function called when we should prepare to call the destination */
-static struct ast_channel *multicast_rtp_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
+static struct ast_channel *multicast_rtp_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, void *data, int *cause)
 {
 	char *tmp = ast_strdupa(data), *multicast_type = tmp, *destination, *control;
 	struct ast_rtp_instance *instance;
 	struct ast_sockaddr control_address;
 	struct ast_sockaddr destination_address;
 	struct ast_channel *chan;
-	format_t fmt = ast_best_codec(format);
+	struct ast_format fmt;
+	ast_best_codec(cap, &fmt);
 
 	ast_sockaddr_setnull(&control_address);
 
@@ -153,11 +153,13 @@
 	ast_rtp_instance_set_remote_address(instance, &destination_address);
 
 	chan->tech = &multicast_rtp_tech;
-	chan->nativeformats = fmt;
-	chan->writeformat = fmt;
-	chan->readformat = fmt;
-	chan->rawwriteformat = fmt;
-	chan->rawreadformat = fmt;
+
+	ast_format_cap_add(chan->nativeformats, &fmt);
+	ast_format_copy(&chan->writeformat, &fmt);
+	ast_format_copy(&chan->rawwriteformat, &fmt);
+	ast_format_copy(&chan->readformat, &fmt);
+	ast_format_copy(&chan->rawreadformat, &fmt);
+
 	chan->tech_pvt = instance;
 
 	return chan;
@@ -170,6 +172,10 @@
 /*! \brief Function called when our module is loaded */
 static int load_module(void)
 {
+	if (!(multicast_rtp_tech.capabilities = ast_format_cap_alloc())) {
+		return AST_MODULE_LOAD_DECLINE;
+	}
+	ast_format_cap_add_all(multicast_rtp_tech.capabilities);
 	if (ast_channel_register(&multicast_rtp_tech)) {
 		ast_log(LOG_ERROR, "Unable to register channel class 'MulticastRTP'\n");
 		return AST_MODULE_LOAD_DECLINE;
@@ -182,6 +188,7 @@
 static int unload_module(void)
 {
 	ast_channel_unregister(&multicast_rtp_tech);
+	multicast_rtp_tech.capabilities = ast_format_cap_destroy(multicast_rtp_tech.capabilities);
 
 	return 0;
 }




More information about the asterisk-commits mailing list