[Asterisk-cvs] asterisk frame.c,1.31,1.32

markster at lists.digium.com markster at lists.digium.com
Tue May 18 23:27:24 CDT 2004


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

Modified Files:
	frame.c 
Log Message:
Allow multiple codecs to be printed in debug (bug #989)


Index: frame.c
===================================================================
RCS file: /usr/cvsroot/asterisk/frame.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- frame.c	9 May 2004 07:51:43 -0000	1.31
+++ frame.c	19 May 2004 03:39:44 -0000	1.32
@@ -424,6 +424,33 @@
 	return "UNKN";
 }
 
+char* ast_getformatname_multiple(char *buf, unsigned n, int format) {
+	unsigned u=1;
+	unsigned len;
+	char *b = buf;
+	char *start = buf;
+	if (!n) return buf;
+	snprintf(b,n,"0x%x(",format);
+	len = strlen(b);
+	b += len;
+	n -= len;
+	start = b;
+	while (u) {
+		if (u&format) {
+			snprintf(b,n,"%s|",ast_getformatname(u));
+			len = strlen(b);
+			b += len;
+			n -= len;
+		}
+		u *= 2;
+	}
+	if (start==b)
+		snprintf(start,n,"EMPTY)");
+	else if (n>1)
+		b[-1]=')';
+	return buf;
+}
+
 int ast_getformatbyname(char *name)
 {
 	if (!strcasecmp(name, "g723.1")) 




More information about the svn-commits mailing list