[asterisk-commits] tilghman: branch tilghman/codec_bits3 r227350 - in /team/tilghman/codec_bits3...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 3 13:17:37 CST 2009


Author: tilghman
Date: Tue Nov  3 13:17:33 2009
New Revision: 227350

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=227350
Log:
Additional debugging with the test codec turned up several problems

Modified:
    team/tilghman/codec_bits3/apps/app_jack.c
    team/tilghman/codec_bits3/configure
    team/tilghman/codec_bits3/main/translate.c

Modified: team/tilghman/codec_bits3/apps/app_jack.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/apps/app_jack.c?view=diff&rev=227350&r1=227349&r2=227350
==============================================================================
--- team/tilghman/codec_bits3/apps/app_jack.c (original)
+++ team/tilghman/codec_bits3/apps/app_jack.c Tue Nov  3 13:17:33 2009
@@ -604,7 +604,7 @@
 	short buf[160];
 	struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass = AST_FORMAT_SLINEAR,
+		.subclass.codec = AST_FORMAT_SLINEAR,
 		.src = "JACK",
 		.data.ptr = buf,
 		.datalen = sizeof(buf),
@@ -781,7 +781,7 @@
 
 		switch (f->frametype) {
 		case AST_FRAME_CONTROL:
-			if (f->subclass == AST_CONTROL_HANGUP)
+			if (f->subclass.integer == AST_CONTROL_HANGUP)
 				jack_data->stop = 1;
 			break;
 		case AST_FRAME_VOICE:
@@ -827,9 +827,9 @@
 	if (frame->frametype != AST_FRAME_VOICE)
 		return 0;
 
-	if (frame->subclass != AST_FORMAT_SLINEAR) {
-		ast_log(LOG_WARNING, "Expected frame in SLINEAR for the audiohook, but got format %d\n",
-			frame->subclass);
+	if (frame->subclass.codec != AST_FORMAT_SLINEAR) {
+		ast_log(LOG_WARNING, "Expected frame in SLINEAR for the audiohook, but got format %s\n",
+			ast_getformatname(frame->subclass.codec));
 		return 0;
 	}
 

Modified: team/tilghman/codec_bits3/main/translate.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/main/translate.c?view=diff&rev=227350&r1=227349&r2=227350
==============================================================================
--- team/tilghman/codec_bits3/main/translate.c (original)
+++ team/tilghman/codec_bits3/main/translate.c Tue Nov  3 13:17:33 2009
@@ -221,7 +221,7 @@
 	}
 
 	f->frametype = AST_FRAME_VOICE;
-	f->subclass.codec = 1 << (pvt->t->dstfmt);
+	f->subclass.codec = 1LL << (pvt->t->dstfmt);
 	f->mallocd = 0;
 	f->offset = AST_FRIENDLY_OFFSET;
 	f->src = pvt->t->name;
@@ -493,7 +493,7 @@
 					tr_matrix[x][z].cost = newcost;
 					tr_matrix[x][z].multistep = 1;
 					ast_debug(3, "Discovered %d cost path from %s to %s, via %s\n", tr_matrix[x][z].cost,
-						  ast_getformatname(1 << x), ast_getformatname(1 << z), ast_getformatname(1 << y));
+						  ast_getformatname(1LL << x), ast_getformatname(1LL << z), ast_getformatname(1LL << y));
 					changed++;
 				}
 			}
@@ -551,7 +551,7 @@
 	ast_cli(a->fd, "          Source Format (Rows) Destination Format (Columns)\n\n");
 	/* Get the length of the longest (usable?) codec name, so we know how wide the left side should be */
 	for (x = 0; x < SHOW_TRANS; x++) {
-		curlen = strlen(ast_getformatname(1 << (x)));
+		curlen = strlen(ast_getformatname(1LL << (x)));
 		if (curlen > longest)
 			longest = curlen;
 		for (y = 0; y < SHOW_TRANS; y++) {
@@ -563,15 +563,15 @@
 	for (x = -1; x < SHOW_TRANS; x++) {
 		struct ast_str *out = ast_str_alloca(125);
 		/*Go ahead and move to next iteration if dealing with an unknown codec*/
-		if(x >= 0 && !strcmp(ast_getformatname(1 << (x)), "unknown"))
+		if(x >= 0 && !strcmp(ast_getformatname(1LL << (x)), "unknown"))
 			continue;
 		ast_str_set(&out, -1, " ");
 		for (y = -1; y < SHOW_TRANS; y++) {
 			/*Go ahead and move to next iteration if dealing with an unknown codec*/
-			if (y >= 0 && !strcmp(ast_getformatname(1 << (y)), "unknown"))
+			if (y >= 0 && !strcmp(ast_getformatname(1LL << (y)), "unknown"))
 				continue;
 			if (y >= 0)
-				curlen = strlen(ast_getformatname(1 << (y)));
+				curlen = strlen(ast_getformatname(1LL << (y)));
 			if (y >= 0 && magnitude[y] + 1 > curlen) {
 				curlen = magnitude[y] + 1;
 			}
@@ -582,10 +582,10 @@
 				ast_str_append(&out, -1, "%*d", curlen + 1, tr_matrix[x][y].cost);
 			} else if (x == -1 && y >= 0) {
 				/* Top row - use a dynamic size */
-				ast_str_append(&out, -1, "%*s", curlen + 1, ast_getformatname(1 << (y)) );
+				ast_str_append(&out, -1, "%*s", curlen + 1, ast_getformatname(1LL << (y)) );
 			} else if (y == -1 && x >= 0) {
 				/* Left column - use a static size. */
-				ast_str_append(&out, -1, "%*s", longest, ast_getformatname(1 << (x)) );
+				ast_str_append(&out, -1, "%*s", longest, ast_getformatname(1LL << (x)) );
 			} else if (x >= 0 && y >= 0) {
 				/* Codec not supported */
 				ast_str_append(&out, -1, "%*s", curlen + 1, "-");
@@ -670,7 +670,7 @@
 
 	ast_verb(2, "Registered translator '%s' from format %s to %s, cost %d\n",
 			    term_color(tmp, t->name, COLOR_MAGENTA, COLOR_BLACK, sizeof(tmp)),
-			    ast_getformatname(1 << t->srcfmt), ast_getformatname(1 << t->dstfmt), t->cost);
+			    ast_getformatname(1LL << t->srcfmt), ast_getformatname(1LL << t->dstfmt), t->cost);
 
 	if (!added_cli) {
 		ast_cli_register_multiple(cli_translate, ARRAY_LEN(cli_translate));
@@ -714,7 +714,7 @@
 	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&translators, u, list) {
 		if (u == t) {
 			AST_RWLIST_REMOVE_CURRENT(list);
-			ast_verb(2, "Unregistered translator '%s' from format %s to %s\n", term_color(tmp, t->name, COLOR_MAGENTA, COLOR_BLACK, sizeof(tmp)), ast_getformatname(1 << t->srcfmt), ast_getformatname(1 << t->dstfmt));
+			ast_verb(2, "Unregistered translator '%s' from format %s to %s\n", term_color(tmp, t->name, COLOR_MAGENTA, COLOR_BLACK, sizeof(tmp)), ast_getformatname(1LL << t->srcfmt), ast_getformatname(1LL << t->dstfmt));
 			found = 1;
 			break;
 		}
@@ -818,7 +818,7 @@
 format_t ast_translate_available_formats(format_t dest, format_t src)
 {
 	format_t res = dest;
-	unsigned int x;
+	format_t x;
 	format_t src_audio = src & AST_FORMAT_AUDIO_MASK;
 	format_t src_video = src & AST_FORMAT_VIDEO_MASK;
 




More information about the asterisk-commits mailing list