[svn-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r301780 - /team/dvossel/fixt...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jan 13 16:48:32 CST 2011


Author: dvossel
Date: Thu Jan 13 16:48:28 2011
New Revision: 301780

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=301780
Log:
convert files in /bridges dir to ast_format api

Modified:
    team/dvossel/fixtheworld_phase1_step3/bridges/bridge_multiplexed.c
    team/dvossel/fixtheworld_phase1_step3/bridges/bridge_simple.c
    team/dvossel/fixtheworld_phase1_step3/bridges/bridge_softmix.c

Modified: team/dvossel/fixtheworld_phase1_step3/bridges/bridge_multiplexed.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/bridges/bridge_multiplexed.c?view=diff&rev=301780&r1=301779&r2=301780
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/bridges/bridge_multiplexed.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/bridges/bridge_multiplexed.c Thu Jan 13 16:48:28 2011
@@ -306,7 +306,9 @@
 		return 0;
 	}
 
-	if (((c0->writeformat == c1->readformat) && (c0->readformat == c1->writeformat) && (c0->nativeformats == c1->nativeformats))) {
+	if ((ast_format_cmp(&c0->writeformat, &c1->readformat) == AST_FORMAT_CMP_EQUAL) &&
+		(ast_format_cmp(&c0->readformat, &c1->writeformat) == AST_FORMAT_CMP_EQUAL) &&
+		(ast_cap_identical(c0->nativeformats, c1->nativeformats))) {
 		return 0;
 	}
 
@@ -373,7 +375,6 @@
 	.name = "multiplexed_bridge",
 	.capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX,
 	.preference = AST_BRIDGE_PREFERENCE_HIGH,
-	.formats = AST_FORMAT_AUDIO_MASK | AST_FORMAT_VIDEO_MASK | AST_FORMAT_TEXT_MASK,
 	.create = multiplexed_bridge_create,
 	.destroy = multiplexed_bridge_destroy,
 	.join = multiplexed_bridge_join,
@@ -397,7 +398,12 @@
 	if (!(multiplexed_threads = ao2_container_alloc(MULTIPLEXED_BUCKETS, NULL, NULL))) {
 		return AST_MODULE_LOAD_DECLINE;
 	}
-
+	if (!(multiplexed_bridge.format_capabilities = ast_cap_alloc())) {
+		return AST_MODULE_LOAD_DECLINE;
+	}
+	ast_cap_add_all_by_type(multiplexed_bridge.format_capabilities, AST_FORMAT_TYPE_AUDIO);
+	ast_cap_add_all_by_type(multiplexed_bridge.format_capabilities, AST_FORMAT_TYPE_VIDEO);
+	ast_cap_add_all_by_type(multiplexed_bridge.format_capabilities, AST_FORMAT_TYPE_TEXT);
 	return ast_bridge_technology_register(&multiplexed_bridge);
 }
 

Modified: team/dvossel/fixtheworld_phase1_step3/bridges/bridge_simple.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/bridges/bridge_simple.c?view=diff&rev=301780&r1=301779&r2=301780
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/bridges/bridge_simple.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/bridges/bridge_simple.c Thu Jan 13 16:48:28 2011
@@ -51,7 +51,9 @@
 	}
 
 	/* See if we need to make these compatible */
-	if (((c0->writeformat == c1->readformat) && (c0->readformat == c1->writeformat) && (c0->nativeformats == c1->nativeformats))) {
+	if ((ast_format_cmp(&c0->writeformat, &c1->readformat) == AST_FORMAT_CMP_EQUAL) &&
+		(ast_format_cmp(&c0->readformat, &c1->writeformat) == AST_FORMAT_CMP_EQUAL) &&
+		(ast_cap_identical(c0->nativeformats, c1->nativeformats))) {
 		return 0;
 	}
 
@@ -85,18 +87,25 @@
 	.name = "simple_bridge",
 	.capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_THREAD,
 	.preference = AST_BRIDGE_PREFERENCE_MEDIUM,
-	.formats = AST_FORMAT_AUDIO_MASK | AST_FORMAT_VIDEO_MASK | AST_FORMAT_TEXT_MASK,
 	.join = simple_bridge_join,
 	.write = simple_bridge_write,
 };
 
 static int unload_module(void)
 {
+	ast_cap_destroy(simple_bridge.format_capabilities);
 	return ast_bridge_technology_unregister(&simple_bridge);
 }
 
 static int load_module(void)
 {
+	if (!(simple_bridge.format_capabilities = ast_cap_alloc())) {
+		return AST_MODULE_LOAD_DECLINE;
+	}
+	ast_cap_add_all_by_type(simple_bridge.format_capabilities, AST_FORMAT_TYPE_AUDIO);
+	ast_cap_add_all_by_type(simple_bridge.format_capabilities, AST_FORMAT_TYPE_VIDEO);
+	ast_cap_add_all_by_type(simple_bridge.format_capabilities, AST_FORMAT_TYPE_TEXT);
+
 	return ast_bridge_technology_register(&simple_bridge);
 }
 

Modified: team/dvossel/fixtheworld_phase1_step3/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/bridges/bridge_softmix.c?view=diff&rev=301780&r1=301779&r2=301780
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/bridges/bridge_softmix.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/bridges/bridge_softmix.c Thu Jan 13 16:48:28 2011
@@ -126,9 +126,9 @@
 	/* Setup frame parameters */
 	sc->frame.frametype = AST_FRAME_VOICE;
 #ifdef SOFTMIX_16_SUPPORT
-	sc->frame.subclass.codec = AST_FORMAT_SLINEAR16;
+	ast_format_set(&sc->frame.subclass.format, AST_FORMAT_SLINEAR16, 0);
 #else
-	sc->frame.subclass.codec = AST_FORMAT_SLINEAR;
+	ast_format_set(&sc->frame.subclass.format, AST_FORMAT_SLINEAR, 0);
 #endif
 	sc->frame.data.ptr = sc->final_buf;
 	sc->frame.datalen = SOFTMIX_DATALEN;
@@ -171,9 +171,9 @@
 
 	/* If a frame was provided add it to the smoother */
 #ifdef SOFTMIX_16_SUPPORT
-	if (frame->frametype == AST_FRAME_VOICE && frame->subclass.codec == AST_FORMAT_SLINEAR16) {
+	if (frame->frametype == AST_FRAME_VOICE && frame->subclass.format.id == AST_FORMAT_SLINEAR16) {
 #else
-	if (frame->frametype == AST_FRAME_VOICE && frame->subclass.codec == AST_FORMAT_SLINEAR) {
+	if (frame->frametype == AST_FRAME_VOICE && frame->subclass.format.id == AST_FORMAT_SLINEAR) {
 #endif
 		ast_slinfactory_feed(&sc->factory, frame);
 	}
@@ -282,11 +282,6 @@
 	.name = "softmix",
 	.capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX | AST_BRIDGE_CAPABILITY_THREAD | AST_BRIDGE_CAPABILITY_MULTITHREADED,
 	.preference = AST_BRIDGE_PREFERENCE_LOW,
-#ifdef SOFTMIX_16_SUPPORT
-	.formats = AST_FORMAT_SLINEAR16,
-#else
-	.formats = AST_FORMAT_SLINEAR,
-#endif
 	.create = softmix_bridge_create,
 	.destroy = softmix_bridge_destroy,
 	.join = softmix_bridge_join,
@@ -298,11 +293,21 @@
 
 static int unload_module(void)
 {
+	ast_cap_destroy(softmix_bridge.format_capabilities);
 	return ast_bridge_technology_unregister(&softmix_bridge);
 }
 
 static int load_module(void)
 {
+	struct ast_format tmp;
+	if (!(softmix_bridge.format_capabilities = ast_cap_alloc())) {
+		return AST_MODULE_LOAD_DECLINE;
+	}
+#ifdef SOFTMIX_16_SUPPORT
+	ast_cap_add(softmix_bridge.format_capabilities, ast_format_set(&tmp, AST_FORMAT_SLINEAR16, 0));
+#else
+	ast_cap_add(softmix_bridge.format_capabilities, ast_format_set(&tmp, AST_FORMAT_SLINEAR, 0));
+#endif
 	return ast_bridge_technology_register(&softmix_bridge);
 }
 




More information about the svn-commits mailing list