[Asterisk-cvs] asterisk rtp.c,1.92.2.14,1.92.2.15

russell at lists.digium.com russell at lists.digium.com
Fri Jun 24 17:52:35 CDT 2005


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

Modified Files:
      Tag: v1-0
	rtp.c 
Log Message:
print non-codec capabilities correctly (bug #3960)


Index: rtp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/rtp.c,v
retrieving revision 1.92.2.14
retrieving revision 1.92.2.15
diff -u -d -r1.92.2.14 -r1.92.2.15
--- rtp.c	31 May 2005 12:55:43 -0000	1.92.2.14
+++ rtp.c	24 Jun 2005 21:53:02 -0000	1.92.2.15
@@ -753,7 +753,7 @@
 }
 
 /* Looks up an RTP code out of our *static* outbound list */
-int ast_rtp_lookup_code(struct ast_rtp* rtp, int isAstFormat, int code) {
+int ast_rtp_lookup_code(struct ast_rtp* rtp, const int isAstFormat, const int code) {
   int pt;
 
 
@@ -787,7 +787,7 @@
   return -1;
 }
 
-char* ast_rtp_lookup_mime_subtype(int isAstFormat, int code) {
+char* ast_rtp_lookup_mime_subtype(const int isAstFormat, const int code) {
   int i;
 
   for (i = 0; i < sizeof mimeTypes/sizeof mimeTypes[0]; ++i) {
@@ -799,6 +799,41 @@
   return "";
 }
 
+char *ast_rtp_lookup_mime_multiple(char *buf, int size, const int capability, const int isAstFormat)
+{
+	int format;
+	unsigned len;
+	char *end = buf;
+	char *start = buf;
+
+	if (!buf || !size)
+		return NULL;
+
+	snprintf(end, size, "0x%x (", capability);
+
+	len = strlen(end);
+	end += len;
+	size -= len;
+	start = end;
+
+	for (format = 1; format < AST_RTP_MAX; format <<= 1) {
+		if (capability & format) {
+			const char *name = ast_rtp_lookup_mime_subtype(isAstFormat, format);
+			snprintf(end, size, "%s|", name);
+			len = strlen(end);
+			end += len;
+			size -= len;
+		}
+	}
+
+	if (start == end)
+		snprintf(start, size, "nothing)"); 
+	else if (size > 1)
+		*(end -1) = ')';
+	
+	return buf;
+ }
+
 static int rtp_socket(void)
 {
 	int s;




More information about the svn-commits mailing list