[asterisk-commits] tilghman: branch tilghman/codec_bits3 r227470 - /team/tilghman/codec_bits3/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 3 16:19:44 CST 2009


Author: tilghman
Date: Tue Nov  3 16:19:39 2009
New Revision: 227470

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=227470
Log:
More types that needed to change

Modified:
    team/tilghman/codec_bits3/main/frame.c

Modified: team/tilghman/codec_bits3/main/frame.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/main/frame.c?view=diff&rev=227470&r1=227469&r2=227470
==============================================================================
--- team/tilghman/codec_bits3/main/frame.c (original)
+++ team/tilghman/codec_bits3/main/frame.c Tue Nov  3 16:19:39 2009
@@ -80,7 +80,7 @@
 
 struct ast_smoother {
 	int size;
-	int format;
+	format_t format;
 	int flags;
 	float samplesperbyte;
 	unsigned int opt_needs_swap:1;
@@ -587,7 +587,7 @@
 	start = end;
 	for (x = 0; x < ARRAY_LEN(AST_FORMAT_LIST); x++) {
 		if (AST_FORMAT_LIST[x].bits & format) {
-			snprintf(end, size,"%s|",AST_FORMAT_LIST[x].name);
+			snprintf(end, size, "%s|", AST_FORMAT_LIST[x].name);
 			len = strlen(end);
 			end += len;
 			size -= len;
@@ -596,7 +596,7 @@
 	if (start == end)
 		ast_copy_string(start, "nothing)", size);
 	else if (size > 1)
-		*(end -1) = ')';
+		*(end - 1) = ')';
 	return buf;
 }
 
@@ -679,27 +679,30 @@
 
 	ast_cli(a->fd, "%11s %9s %10s   TYPE   %8s   %s\n","INT","BINARY","HEX","NAME","DESC");
 	ast_cli(a->fd, "--------------------------------------------------------------------------------\n");
-	if ((a->argc == 3) || (!strcasecmp(a->argv[3],"audio"))) {
+	if ((a->argc == 3) || (!strcasecmp(a->argv[3], "audio"))) {
 		found = 1;
-		for (i=0;i<13;i++) {
-			snprintf(hex,25,"(0x%x)",1<<i);
-			ast_cli(a->fd, "%11u (1 << %2d) %10s  audio   %8s   (%s)\n",1 << i,i,hex,ast_getformatname(1<<i),ast_codec2str(1<<i));
-		}
-	}
-
-	if ((a->argc == 3) || (!strcasecmp(a->argv[3],"image"))) {
+		for (i = 0; i < 48; i++) {
+			if (!((1LL << i) & AST_FORMAT_AUDIO_MASK)) {
+				continue;
+			}
+			snprintf(hex, sizeof(hex), "(0x%Lx)", 1LL << i);
+			ast_cli(a->fd, "%11Lu (1 << %2d) %10s  audio   %8s   (%s)\n", 1LL << i, i, hex, ast_getformatname(1LL << i), ast_codec2str(1LL << i));
+		}
+	}
+
+	if ((a->argc == 3) || (!strcasecmp(a->argv[3], "image"))) {
 		found = 1;
-		for (i=16;i<18;i++) {
-			snprintf(hex,25,"(0x%x)",1<<i);
-			ast_cli(a->fd, "%11u (1 << %2d) %10s  image   %8s   (%s)\n",1 << i,i,hex,ast_getformatname(1<<i),ast_codec2str(1<<i));
-		}
-	}
-
-	if ((a->argc == 3) || (!strcasecmp(a->argv[3],"video"))) {
+		for (i = 16; i < 18; i++) {
+			snprintf(hex, sizeof(hex), "(0x%Lx)", 1LL << i);
+			ast_cli(a->fd, "%11Lu (1 << %2d) %10s  image   %8s   (%s)\n", 1LL << i, i, hex, ast_getformatname(1LL << i), ast_codec2str(1LL << i));
+		}
+	}
+
+	if ((a->argc == 3) || (!strcasecmp(a->argv[3], "video"))) {
 		found = 1;
-		for (i=18;i<22;i++) {
-			snprintf(hex,25,"(0x%x)",1<<i);
-			ast_cli(a->fd, "%11u (1 << %2d) %10s  video   %8s   (%s)\n",1 << i,i,hex,ast_getformatname(1<<i),ast_codec2str(1<<i));
+		for (i = 18; i < 63; i++) {
+			snprintf(hex, sizeof(hex), "(0x%Lx)", 1LL << i);
+			ast_cli(a->fd, "%11Lu (1 << %2d) %10s  video   %8s   (%s)\n", 1LL << i, i, hex, ast_getformatname(1LL << i), ast_codec2str(1LL << i));
 		}
 	}
 
@@ -711,12 +714,13 @@
 
 static char *show_codec_n(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-	int codec, i, found=0;
+	format_t codec;
+	int i, found = 0;
 
 	switch (cmd) {
 	case CLI_INIT:
 		e->command = "core show codec";
-		e->usage = 
+		e->usage =
 			"Usage: core show codec <number>\n"
 			"       Displays codec mapping\n";
 		return NULL;
@@ -727,17 +731,17 @@
 	if (a->argc != 4)
 		return CLI_SHOWUSAGE;
 
-	if (sscanf(a->argv[3], "%30d", &codec) != 1)
+	if (sscanf(a->argv[3], "%30Ld", &codec) != 1)
 		return CLI_SHOWUSAGE;
 
-	for (i = 0; i < 32; i++)
-		if (codec & (1 << i)) {
+	for (i = 0; i < 63; i++)
+		if (codec & (1LL << i)) {
 			found = 1;
-			ast_cli(a->fd, "%11u (1 << %2d)  %s\n",1 << i,i,ast_codec2str(1<<i));
+			ast_cli(a->fd, "%11Lu (1 << %2d)  %s\n", 1LL << i, i, ast_codec2str(1LL << i));
 		}
 
 	if (!found)
-		ast_cli(a->fd, "Codec %d not found\n", codec);
+		ast_cli(a->fd, "Codec %Ld not found\n", codec);
 
 	return CLI_SUCCESS;
 }




More information about the asterisk-commits mailing list