diff options
author | David Vossel <dvossel@digium.com> | 2011-02-03 16:22:10 +0000 |
---|---|---|
committer | David Vossel <dvossel@digium.com> | 2011-02-03 16:22:10 +0000 |
commit | c26c190711a1bbe3b5fff1a93facae333757c56e (patch) | |
tree | 00da0caa5a07b7b25729f089dbcafb08129fa9be /bridges/bridge_softmix.c | |
parent | 652fb64a01c7a8656697d07e606620ee0ced6929 (diff) |
Asterisk media architecture conversion - no more format bitfields
This patch is the foundation of an entire new way of looking at media in Asterisk.
The code present in this patch is everything required to complete phase1 of my
Media Architecture proposal. For more information about this project visit the link below.
https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal
The primary function of this patch is to convert all the usages of format
bitfields in Asterisk to use the new format and format_cap APIs. Functionally
no change in behavior should be present in this patch. Thanks to twilson
and russell for all the time they spent reviewing these changes.
Review: https://reviewboard.asterisk.org/r/1083/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'bridges/bridge_softmix.c')
-rw-r--r-- | bridges/bridge_softmix.c | 23 |
1 files changed, 14 insertions, 9 deletions
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); } |