summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
Diffstat (limited to 'bridges')
-rw-r--r--bridges/bridge_multiplexed.c13
-rw-r--r--bridges/bridge_simple.c13
-rw-r--r--bridges/bridge_softmix.c23
3 files changed, 35 insertions, 14 deletions
diff --git a/bridges/bridge_multiplexed.c b/bridges/bridge_multiplexed.c
index 520673134..0d2b3e254 100644
--- a/bridges/bridge_multiplexed.c
+++ b/bridges/bridge_multiplexed.c
@@ -306,7 +306,9 @@ static int multiplexed_bridge_join(struct ast_bridge *bridge, struct ast_bridge_
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_format_cap_identical(c0->nativeformats, c1->nativeformats))) {
return 0;
}
@@ -373,7 +375,6 @@ static struct ast_bridge_technology multiplexed_bridge = {
.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,
@@ -388,6 +389,7 @@ static int unload_module(void)
int res = ast_bridge_technology_unregister(&multiplexed_bridge);
ao2_ref(multiplexed_threads, -1);
+ multiplexed_bridge.format_capabilities = ast_format_cap_destroy(multiplexed_bridge.format_capabilities);
return res;
}
@@ -397,7 +399,12 @@ static int load_module(void)
if (!(multiplexed_threads = ao2_container_alloc(MULTIPLEXED_BUCKETS, NULL, NULL))) {
return AST_MODULE_LOAD_DECLINE;
}
-
+ if (!(multiplexed_bridge.format_capabilities = ast_format_cap_alloc())) {
+ return AST_MODULE_LOAD_DECLINE;
+ }
+ ast_format_cap_add_all_by_type(multiplexed_bridge.format_capabilities, AST_FORMAT_TYPE_AUDIO);
+ ast_format_cap_add_all_by_type(multiplexed_bridge.format_capabilities, AST_FORMAT_TYPE_VIDEO);
+ ast_format_cap_add_all_by_type(multiplexed_bridge.format_capabilities, AST_FORMAT_TYPE_TEXT);
return ast_bridge_technology_register(&multiplexed_bridge);
}
diff --git a/bridges/bridge_simple.c b/bridges/bridge_simple.c
index 0dbcd25d2..72b91087a 100644
--- a/bridges/bridge_simple.c
+++ b/bridges/bridge_simple.c
@@ -51,7 +51,9 @@ static int simple_bridge_join(struct ast_bridge *bridge, struct ast_bridge_chann
}
/* 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_format_cap_identical(c0->nativeformats, c1->nativeformats))) {
return 0;
}
@@ -85,18 +87,25 @@ static struct ast_bridge_technology simple_bridge = {
.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_format_cap_destroy(simple_bridge.format_capabilities);
return ast_bridge_technology_unregister(&simple_bridge);
}
static int load_module(void)
{
+ if (!(simple_bridge.format_capabilities = ast_format_cap_alloc())) {
+ return AST_MODULE_LOAD_DECLINE;
+ }
+ ast_format_cap_add_all_by_type(simple_bridge.format_capabilities, AST_FORMAT_TYPE_AUDIO);
+ ast_format_cap_add_all_by_type(simple_bridge.format_capabilities, AST_FORMAT_TYPE_VIDEO);
+ ast_format_cap_add_all_by_type(simple_bridge.format_capabilities, AST_FORMAT_TYPE_TEXT);
+
return ast_bridge_technology_register(&simple_bridge);
}
diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c
index 69d13a2b6..b25ab99fa 100644
--- a/bridges/bridge_softmix.c
+++ b/bridges/bridge_softmix.c
@@ -126,9 +126,9 @@ static int softmix_bridge_join(struct ast_bridge *bridge, struct ast_bridge_chan
/* 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 @@ static enum ast_bridge_write_result softmix_bridge_write(struct ast_bridge *brid
/* 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 @@ static struct ast_bridge_technology softmix_bridge = {
.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 struct ast_bridge_technology softmix_bridge = {
static int unload_module(void)
{
+ ast_format_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_format_cap_alloc())) {
+ return AST_MODULE_LOAD_DECLINE;
+ }
+#ifdef SOFTMIX_16_SUPPORT
+ ast_format_cap_add(softmix_bridge.format_capabilities, ast_format_set(&tmp, AST_FORMAT_SLINEAR16, 0));
+#else
+ ast_format_cap_add(softmix_bridge.format_capabilities, ast_format_set(&tmp, AST_FORMAT_SLINEAR, 0));
+#endif
return ast_bridge_technology_register(&softmix_bridge);
}