[asterisk-commits] file: branch group/media_formats r407408 - in /team/group/media_formats/apps:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 5 09:38:57 CST 2014


Author: file
Date: Wed Feb  5 09:38:54 2014
New Revision: 407408

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

Modified:
    team/group/media_formats/apps/app_confbridge.c
    team/group/media_formats/apps/confbridge/conf_chan_record.c

Modified: team/group/media_formats/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/apps/app_confbridge.c?view=diff&rev=407408&r1=407407&r2=407408
==============================================================================
--- team/group/media_formats/apps/app_confbridge.c (original)
+++ team/group/media_formats/apps/app_confbridge.c Wed Feb  5 09:38:54 2014
@@ -70,6 +70,7 @@
 #include "asterisk/stasis.h"
 #include "asterisk/stasis_bridges.h"
 #include "asterisk/json.h"
+#include "asterisk/format_cache.h"
 
 /*** DOCUMENTATION
 	<application name="ConfBridge" language="en_US">
@@ -651,7 +652,6 @@
 static int conf_start_record(struct confbridge_conference *conference)
 {
 	struct ast_format_cap *cap;
-	struct ast_format format;
 
 	if (conference->record_state != CONF_RECORD_STOP) {
 		return -1;
@@ -662,16 +662,16 @@
 		return -1;
 	}
 
-	cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+	cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
 	if (!cap) {
 		return -1;
 	}
 
-	ast_format_cap_add(cap, ast_format_set(&format, AST_FORMAT_SLINEAR, 0));
+	ast_format_cap_add(cap, ast_format_slin, 0);
 
 	conference->record_chan = ast_request("CBRec", cap, NULL,
 		conference->name, NULL);
-	cap = ast_format_cap_destroy(cap);
+	ao2_ref(cap, -1);
 	if (!conference->record_chan) {
 		return -1;
 	}
@@ -1350,16 +1350,15 @@
 static int alloc_playback_chan(struct confbridge_conference *conference)
 {
 	struct ast_format_cap *cap;
-	struct ast_format format;
-
-	cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK);
+
+	cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
 	if (!cap) {
 		return -1;
 	}
-	ast_format_cap_add(cap, ast_format_set(&format, AST_FORMAT_SLINEAR, 0));
+	ast_format_cap_add(cap, ast_format_slin, 0);
 	conference->playback_chan = ast_request("CBAnn", cap, NULL,
 		conference->name, NULL);
-	cap = ast_format_cap_destroy(cap);
+	ao2_ref(cap, -1);
 	if (!conference->playback_chan) {
 		return -1;
 	}
@@ -3142,7 +3141,7 @@
 static void unregister_channel_tech(struct ast_channel_tech *tech)
 {
 	ast_channel_unregister(tech);
-	tech->capabilities = ast_format_cap_destroy(tech->capabilities);
+	ao2_cleanup(tech->capabilities);
 }
 
 /*!
@@ -3157,11 +3156,11 @@
  */
 static int register_channel_tech(struct ast_channel_tech *tech)
 {
-	tech->capabilities = ast_format_cap_alloc(0);
+	tech->capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
 	if (!tech->capabilities) {
 		return -1;
 	}
-	ast_format_cap_add_all(tech->capabilities);
+	ast_format_cap_add_all_by_type(tech->capabilities, AST_MEDIA_TYPE_UNKNOWN);
 	if (ast_channel_register(tech)) {
 		ast_log(LOG_ERROR, "Unable to register channel technology %s(%s).\n",
 			tech->type, tech->description);

Modified: team/group/media_formats/apps/confbridge/conf_chan_record.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/apps/confbridge/conf_chan_record.c?view=diff&rev=407408&r1=407407&r2=407408
==============================================================================
--- team/group/media_formats/apps/confbridge/conf_chan_record.c (original)
+++ team/group/media_formats/apps/confbridge/conf_chan_record.c Wed Feb  5 09:38:54 2014
@@ -33,6 +33,7 @@
 
 #include "asterisk/channel.h"
 #include "asterisk/bridge.h"
+#include "asterisk/format_cache.h"
 #include "include/confbridge.h"
 
 /* ------------------------------------------------------------------- */
@@ -56,8 +57,14 @@
 static struct ast_channel *rec_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, const char *data, int *cause)
 {
 	struct ast_channel *chan;
-	struct ast_format format;
 	const char *conf_name = data;
+	RAII_VAR(struct ast_format_cap *, capabilities, NULL, ao2_cleanup);
+
+	capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+	if (!capabilities) {
+		return NULL;
+	}
+	ast_format_cap_add_all_by_type(capabilities, AST_MEDIA_TYPE_UNKNOWN);
 
 	chan = ast_channel_alloc(1, AST_STATE_UP, NULL, NULL, NULL, NULL, NULL, NULL, 0,
 		"CBRec/conf-%s-uid-%d",
@@ -70,13 +77,13 @@
 		ast_channel_release(chan);
 		return NULL;
 	}
-	ast_format_set(&format, AST_FORMAT_SLINEAR, 0);
+
 	ast_channel_tech_set(chan, conf_record_get_tech());
-	ast_format_cap_add_all(ast_channel_nativeformats(chan));
-	ast_format_copy(ast_channel_writeformat(chan), &format);
-	ast_format_copy(ast_channel_rawwriteformat(chan), &format);
-	ast_format_copy(ast_channel_readformat(chan), &format);
-	ast_format_copy(ast_channel_rawreadformat(chan), &format);
+	ast_channel_nativeformats_set(chan, capabilities);
+	ast_channel_set_writeformat(chan, ast_format_slin);
+	ast_channel_set_rawwriteformat(chan, ast_format_slin);
+	ast_channel_set_readformat(chan, ast_format_slin);
+	ast_channel_set_rawreadformat(chan, ast_format_slin);
 	ast_channel_unlock(chan);
 	return chan;
 }




More information about the asterisk-commits mailing list