[svn-commits] dvossel: branch dvossel/fixtheworld_phase1_step1 r298814 - /team/dvossel/fixt...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Dec 17 19:06:45 UTC 2010


Author: dvossel
Date: Fri Dec 17 13:06:42 2010
New Revision: 298814

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=298814
Log:
addition of iax2 capability conversion layer

Modified:
    team/dvossel/fixtheworld_phase1_step1/main/format_cap.c

Modified: team/dvossel/fixtheworld_phase1_step1/main/format_cap.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step1/main/format_cap.c?view=diff&rev=298814&r1=298813&r2=298814
==============================================================================
--- team/dvossel/fixtheworld_phase1_step1/main/format_cap.c (original)
+++ team/dvossel/fixtheworld_phase1_step1/main/format_cap.c Fri Dec 17 13:06:42 2010
@@ -90,6 +90,9 @@
 {
 	struct ast_format *fnew;
 
+	if (!format) {
+		return;
+	}
 	if (!(fnew = ao2_alloc(sizeof(struct ast_format), NULL))) {
 		return;
 	}
@@ -247,11 +250,30 @@
 uint64_t ast_cap_to_iax2(struct ast_cap *cap)
 {
 	uint64_t res = 0;
-
+	struct ao2_iterator it;
+	struct ast_format *tmp;
+
+	it = ao2_iterator_init(cap->formats, 0);
+	while ((tmp = ao2_iterator_next(&it))) {
+		res |= ast_format_to_iax2(tmp);
+		ao2_ref(tmp, -1);
+	}
+	ao2_iterator_destroy(&it);
 	return res;
 }
 
 void ast_cap_from_iax2(uint64_t src, struct ast_cap *dst)
 {
-	return;
-}
+	uint64_t tmp = 0;
+	int x;
+	struct ast_format tmp_format = { 0, };
+
+	for (x = 0; x < 64; x++) {
+		tmp = (1ULL << x);
+		if (tmp & src) {
+			ast_cap_add(dst, ast_format_from_iax2(tmp, &tmp_format));
+		}
+	}
+
+
+}




More information about the svn-commits mailing list