[svn-commits] file: branch group/media_formats r408271 - in /team/group/media_formats: chan...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Feb 17 09:33:52 CST 2014


Author: file
Date: Mon Feb 17 09:33:50 2014
New Revision: 408271

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=408271
Log:
Move chan_multicast_rtp over.

Modified:
    team/group/media_formats/channels/chan_multicast_rtp.c
    team/group/media_formats/include/asterisk/channel.h

Modified: team/group/media_formats/channels/chan_multicast_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/channels/chan_multicast_rtp.c?view=diff&rev=408271&r1=408270&r2=408271
==============================================================================
--- team/group/media_formats/channels/chan_multicast_rtp.c (original)
+++ team/group/media_formats/channels/chan_multicast_rtp.c Mon Feb 17 09:33:50 2014
@@ -117,7 +117,9 @@
 	struct ast_sockaddr control_address;
 	struct ast_sockaddr destination_address;
 	struct ast_channel *chan;
-	struct ast_format fmt;
+	struct ast_format_cap *caps = NULL;
+	struct ast_format *fmt = NULL;
+
 	ast_best_codec(cap, &fmt);
 
 	ast_sockaddr_setnull(&control_address);
@@ -145,6 +147,11 @@
 		goto failure;
 	}
 
+	caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+	if (!caps) {
+		goto failure;
+	}
+
 	if (!(instance = ast_rtp_instance_new("multicast", NULL, &control_address, multicast_type))) {
 		goto failure;
 	}
@@ -158,19 +165,25 @@
 
 	ast_channel_tech_set(chan, &multicast_rtp_tech);
 
-	ast_format_cap_add(ast_channel_nativeformats(chan), &fmt);
-	ast_format_copy(ast_channel_writeformat(chan), &fmt);
-	ast_format_copy(ast_channel_rawwriteformat(chan), &fmt);
-	ast_format_copy(ast_channel_readformat(chan), &fmt);
-	ast_format_copy(ast_channel_rawreadformat(chan), &fmt);
+	ast_format_cap_add(caps, fmt, 0);
+	ast_channel_nativeformats_set(chan, caps);
+	ast_channel_set_writeformat(chan, fmt);
+	ast_channel_set_rawwriteformat(chan, fmt);
+	ast_channel_set_readformat(chan, fmt);
+	ast_channel_set_rawreadformat(chan, fmt);
 
 	ast_channel_tech_pvt_set(chan, instance);
 
 	ast_channel_unlock(chan);
 
+	ao2_ref(fmt, -1);
+	ao2_ref(caps, -1);
+
 	return chan;
 
 failure:
+	ao2_cleanup(fmt);
+	ao2_cleanup(caps);
 	*cause = AST_CAUSE_FAILURE;
 	return NULL;
 }
@@ -178,10 +191,10 @@
 /*! \brief Function called when our module is loaded */
 static int load_module(void)
 {
-	if (!(multicast_rtp_tech.capabilities = ast_format_cap_alloc(0))) {
+	if (!(multicast_rtp_tech.capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
 		return AST_MODULE_LOAD_DECLINE;
 	}
-	ast_format_cap_add_all(multicast_rtp_tech.capabilities);
+	ast_format_cap_add_all_by_type(multicast_rtp_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN);
 	if (ast_channel_register(&multicast_rtp_tech)) {
 		ast_log(LOG_ERROR, "Unable to register channel class 'MulticastRTP'\n");
 		return AST_MODULE_LOAD_DECLINE;
@@ -194,7 +207,8 @@
 static int unload_module(void)
 {
 	ast_channel_unregister(&multicast_rtp_tech);
-	multicast_rtp_tech.capabilities = ast_format_cap_destroy(multicast_rtp_tech.capabilities);
+	ao2_ref(multicast_rtp_tech.capabilities, -1);
+	multicast_rtp_tech.capabilities = NULL;
 
 	return 0;
 }

Modified: team/group/media_formats/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/include/asterisk/channel.h?view=diff&rev=408271&r1=408270&r2=408271
==============================================================================
--- team/group/media_formats/include/asterisk/channel.h (original)
+++ team/group/media_formats/include/asterisk/channel.h Mon Feb 17 09:33:50 2014
@@ -2058,7 +2058,7 @@
  * \retval on success, pointer to result structure
  * \retval on failure, NULL
  */
-struct ast_format *ast_best_codec(struct ast_format_cap *cap, struct ast_format *result);
+struct ast_format *ast_best_codec(struct ast_format_cap *cap, struct ast_format **result);
 
 
 /*!




More information about the svn-commits mailing list