[asterisk-commits] kharwell: branch kharwell/media_formats_translation_core r413195 - in /team/k...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 2 09:46:45 CDT 2014


Author: kharwell
Date: Fri May  2 09:46:35 2014
New Revision: 413195

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=413195
Log:
addressed some review findings

Modified:
    team/kharwell/media_formats_translation_core/include/asterisk/translate.h
    team/kharwell/media_formats_translation_core/main/translate.c

Modified: team/kharwell/media_formats_translation_core/include/asterisk/translate.h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/media_formats_translation_core/include/asterisk/translate.h?view=diff&rev=413195&r1=413194&r2=413195
==============================================================================
--- team/kharwell/media_formats_translation_core/include/asterisk/translate.h (original)
+++ team/kharwell/media_formats_translation_core/include/asterisk/translate.h Fri May  2 09:46:35 2014
@@ -291,8 +291,8 @@
  */
 int ast_translator_best_choice(struct ast_format_cap *dst_cap,
 	struct ast_format_cap *src_cap,
-	struct ast_format *dst_fmt_out,
-	struct ast_format *src_fmt_out);
+	struct ast_format **dst_fmt_out,
+	struct ast_format **src_fmt_out);
 
 /*! 
  * \brief Builds a translator path

Modified: team/kharwell/media_formats_translation_core/main/translate.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/media_formats_translation_core/main/translate.c?view=diff&rev=413195&r1=413194&r2=413195
==============================================================================
--- team/kharwell/media_formats_translation_core/main/translate.c (original)
+++ team/kharwell/media_formats_translation_core/main/translate.c Fri May  2 09:46:35 2014
@@ -878,7 +878,7 @@
 static char *handle_show_translation_table(struct ast_cli_args *a)
 {
 	int x, y, i, k;
-	int longest, num_codecs = 0, curlen = 0;
+	int longest = 0, num_codecs = 0, curlen = 0;
 	struct ast_str *out = ast_str_create(1024);
 	struct ast_codec *codec;
 
@@ -889,6 +889,7 @@
 		if (codec->type != AST_MEDIA_TYPE_AUDIO) {
 			continue;
 		}
+		curlen = strlen(codec->name);
 		if (curlen > longest) {
 			longest = curlen;
 		}
@@ -1204,8 +1205,8 @@
 /*! \brief Calculate our best translator source format, given costs, and a desired destination */
 int ast_translator_best_choice(struct ast_format_cap *dst_cap,
 	struct ast_format_cap *src_cap,
-	struct ast_format *dst_fmt_out,
-	struct ast_format *src_fmt_out)
+	struct ast_format **dst_fmt_out,
+	struct ast_format **src_fmt_out)
 {
 	unsigned int besttablecost = INT_MAX;
 	unsigned int beststeps = INT_MAX;
@@ -1242,8 +1243,8 @@
 	}
 
 	if (best) {
-		dst_fmt_out = ast_format_copy(best);
-		src_fmt_out = ast_format_copy(best);
+		*dst_fmt_out = ast_format_copy(best);
+		*src_fmt_out = ast_format_copy(best);
 		ao2_ref(best, -1);
 		ao2_ref(joint_cap, -1);
 		return 0;
@@ -1296,8 +1297,8 @@
 	if (!best) {
 		return -1;
 	}
-	dst_fmt_out = ast_format_copy(best);
-	src_fmt_out = ast_format_copy(best);
+	*dst_fmt_out = ast_format_copy(best);
+	*src_fmt_out = ast_format_copy(bestdst);
 	ao2_ref(best, -1);
 	ao2_ref(bestdst, -1);
 	return 0;
@@ -1347,7 +1348,7 @@
 
 		/* if this is not a desired format, nothing to do */
 		if (ast_format_cap_iscompatible_format(
-			    dest, fmt) == AST_FORMAT_CMP_EQUAL) {
+			    dest, fmt) == AST_FORMAT_CMP_NOT_EQUAL) {
 			continue;
 		}
 
@@ -1409,7 +1410,7 @@
 		check_translation_path(dest, src, result,
 				       cur_src, AST_MEDIA_TYPE_AUDIO);
 		check_translation_path(dest, src, result,
-				       cur_src, AST_MEDIA_TYPE_AUDIO);
+				       cur_src, AST_MEDIA_TYPE_VIDEO);
 		AST_RWLIST_UNLOCK(&translators);
 		ao2_ref(cur_src, -1);
 	}




More information about the asterisk-commits mailing list