[Asterisk-cvs] asterisk frame.c,1.6,1.7

markster at lists.digium.com markster at lists.digium.com
Fri Sep 26 18:16:23 CDT 2003


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

Modified Files:
	frame.c 
Log Message:
Show codec enhancements (bug #307)


Index: frame.c
===================================================================
RCS file: /usr/cvsroot/asterisk/frame.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- frame.c	16 Aug 2003 14:48:05 -0000	1.6
+++ frame.c	26 Sep 2003 23:17:33 -0000	1.7
@@ -441,7 +441,10 @@
 		"undefined",                  /* 23 */
         "Maximum video format",       /* 24 */
 		};
-	return codecs[codec];
+	if ((codec >= 0) && (codec <= 24))
+		return codecs[codec];
+	else
+		return "unknown";
 }
 
 static int show_codecs(int fd, int argc, char *argv[])
@@ -454,19 +457,19 @@
 	if ((argc == 2) || (!strcasecmp(argv[1],"audio"))) {
 		found = 1;
 		for (i=0;i<11;i++)
-			ast_cli(fd, "%8d (1 << %2d)  %s\n",1 << i,i,ast_codec2str(i));
+			ast_cli(fd, "%11u (1 << %2d)  %s\n",1 << i,i,ast_codec2str(i));
 	}
 
 	if ((argc == 2) || (!strcasecmp(argv[1],"image"))) {
 		found = 1;
 		for (i=16;i<18;i++)
-			ast_cli(fd, "%8d (1 << %2d)  %s\n",1 << i,i,ast_codec2str(i));
+			ast_cli(fd, "%11u (1 << %2d)  %s\n",1 << i,i,ast_codec2str(i));
 	}
 
 	if ((argc == 2) || (!strcasecmp(argv[1],"video"))) {
 		found = 1;
 		for (i=18;i<20;i++)
-			ast_cli(fd, "%8d (1 << %2d)  %s\n",1 << i,i,ast_codec2str(i));
+			ast_cli(fd, "%11u (1 << %2d)  %s\n",1 << i,i,ast_codec2str(i));
 	}
 
 	if (! found)
@@ -499,9 +502,9 @@
 		return RESULT_SHOWUSAGE;
 
 	for (i=0;i<32;i++)
-		if (codec == (1 << i)) {
+		if (codec & (1 << i)) {
 			found = 1;
-			ast_cli(fd, "%d (1 << %d)  %s\n",1 << i,i,ast_codec2str(i));
+			ast_cli(fd, "%11u (1 << %2d)  %s\n",1 << i,i,ast_codec2str(i));
 		}
 
 	if (! found)




More information about the svn-commits mailing list