[Asterisk-cvs] asterisk frame.c,1.67,1.68

kpfleming kpfleming
Fri Oct 28 17:56:51 CDT 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv2657

Modified Files:
	frame.c 
Log Message:
add API call to properly sum two frames of SLINEAR data


Index: frame.c
===================================================================
RCS file: /usr/cvsroot/asterisk/frame.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- frame.c	28 Oct 2005 21:35:55 -0000	1.67
+++ frame.c	28 Oct 2005 21:49:27 -0000	1.68
@@ -1271,3 +1271,25 @@
 
 	return 0;
 }
+
+int ast_frame_slinear_sum(struct ast_frame *f1, struct ast_frame *f2)
+{
+	int count;
+	short *data1, *data2;
+
+	if ((f1->frametype != AST_FRAME_VOICE) || (f1->subclass != AST_FORMAT_SLINEAR))
+		return -1;
+
+	if ((f2->frametype != AST_FRAME_VOICE) || (f2->subclass != AST_FORMAT_SLINEAR))
+		return -1;
+
+	if (f1->samples != f2->samples)
+		return -1;
+
+	for (count = 0, data1 = f1->data, data2 = f2->data;
+	     count < f1->samples;
+	     count++, data1++, data2++)
+		ast_slinear_saturated_add(data1, *data2);
+
+	return 0;
+}




More information about the svn-commits mailing list