[svn-commits] kharwell: branch kharwell/media_formats_translation_core r413540 - in /team/k...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu May 8 15:31:28 CDT 2014


Author: kharwell
Date: Thu May  8 15:31:20 2014
New Revision: 413540

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=413540
Log:
another round of review finding changes

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

Modified: team/kharwell/media_formats_translation_core/include/asterisk/codec.h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/media_formats_translation_core/include/asterisk/codec.h?view=diff&rev=413540&r1=413539&r2=413540
==============================================================================
--- team/kharwell/media_formats_translation_core/include/asterisk/codec.h (original)
+++ team/kharwell/media_formats_translation_core/include/asterisk/codec.h Thu May  8 15:31:20 2014
@@ -177,15 +177,4 @@
  */
 unsigned int ast_codec_determine_length(const struct ast_codec *codec, unsigned int samples);
 
-/*!
- * \brief Get the names of all codecs, separated by a '|', matching the given
- *        codec's original id.
- *
- * \param codec The codec to match against
- * \param buf the string buffer to write names to
- *
- * \retval the given string buffer.
- */
-struct ast_str **ast_codec_get_names(const struct ast_codec *codec, struct ast_str **buf);
-
 #endif /* _AST_CODEC_H */

Modified: team/kharwell/media_formats_translation_core/include/asterisk/format.h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/media_formats_translation_core/include/asterisk/format.h?view=diff&rev=413540&r1=413539&r2=413540
==============================================================================
--- team/kharwell/media_formats_translation_core/include/asterisk/format.h (original)
+++ team/kharwell/media_formats_translation_core/include/asterisk/format.h Thu May  8 15:31:20 2014
@@ -138,14 +138,6 @@
 enum ast_format_cmp_res ast_format_cmp(const struct ast_format *format1, const struct ast_format *format2);
 
 /*!
- * \brief Compare the format's codec to the given codec.
- *
- * \retval ast_format_cmp_res representing the result of comparing format->codec and codec
- */
-enum ast_format_cmp_res ast_format_cmp_codec(
-	const struct ast_format *format, const struct ast_codec *codec);
-
-/*1
  * \brief Get a common joint capability between two formats
  *
  * \retval non-NULL if joint capability exists

Modified: team/kharwell/media_formats_translation_core/main/codec.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/media_formats_translation_core/main/codec.c?view=diff&rev=413540&r1=413539&r2=413540
==============================================================================
--- team/kharwell/media_formats_translation_core/main/codec.c (original)
+++ team/kharwell/media_formats_translation_core/main/codec.c Thu May  8 15:31:20 2014
@@ -352,30 +352,3 @@
 	return codec->get_length(samples);
 }
 
-static int codec_append_name(void *obj, void *arg, int flags)
-{
-	const struct ast_codec *left = obj;
-	const struct ast_codec *right = arg;
-
-	if (left == right) {
-		ast_str_append(buf, 0, "%s|", left->name);
-	}
-	return 0;
-}
-
-struct ast_str **ast_codec_get_names(const struct ast_codec *codec,
-				     struct ast_str **buf)
-{
-	int size = ast_str_strlen(*buf) + 1;
-
-	ast_str_append(buf, 0, "(");
-	ao2_callback(codecs, OBJ_NODATA, codec_append_name, codec);
-
-	if (size == ast_str_strlen(*buf)) {
-		ast_str_append(buf, 0, "nothing)");
-	} else {
-		ast_str_truncate(buf, -1);
-		ast_str_append(buf, 0, ")");
-	}
-	return buf;
-}

Modified: team/kharwell/media_formats_translation_core/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/media_formats_translation_core/main/format.c?view=diff&rev=413540&r1=413539&r2=413540
==============================================================================
--- team/kharwell/media_formats_translation_core/main/format.c (original)
+++ team/kharwell/media_formats_translation_core/main/format.c Thu May  8 15:31:20 2014
@@ -205,11 +205,6 @@
 	return AST_FORMAT_CMP_EQUAL;
 }
 
-enum ast_format_cmp_res ast_format_cmp_codec(const struct ast_format *format1, const struct ast_codec *codec)
-{
-	return format->codec == codec ? AST_FORMAT_CMP_EQUAL : AST_FORMAT_CMP_NOT_EQUAL;
-}
-
 struct ast_format *ast_format_joint(const struct ast_format *format1, const struct ast_format *format2)
 {
 	if (format1->codec != format2->codec) {

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=413540&r1=413539&r2=413540
==============================================================================
--- team/kharwell/media_formats_translation_core/main/translate.c (original)
+++ team/kharwell/media_formats_translation_core/main/translate.c Thu May  8 15:31:20 2014
@@ -696,8 +696,8 @@
 		return 0;
 	}
 
-	src_ll = ast_format_cmp_codec(ast_format_slin, src) == AST_FORMAT_CMP_EQUAL;
-	dst_ll = ast_format_cmp_codec(ast_format_slin, dst) == AST_FORMAT_CMP_EQUAL;
+	src_ll = !strcmp(src->name, "slin");
+	dst_ll = !strcmp(dst->name, "slin");
 	if (src_ll) {
 		if (dst_ll && (src_rate == dst_rate)) {
 			return AST_TRANS_COST_LL_LL_ORIGSAMP;
@@ -827,16 +827,25 @@
 	}
 }
 
+static void codec_append_name(const struct ast_codec *codec, struct ast_str **buf)
+{
+	if (codec) {
+		ast_str_append(buf, 0, "(%s@%d)", codec->name, codec->sample_rate);
+	} else {
+		ast_str_append(buf, 0, "(nothing)");
+	}
+}
+
 const char *ast_translate_path_to_str(struct ast_trans_pvt *p, struct ast_str **str)
 {
 	if (!p || !p->t) {
 		return "";
 	}
 
-	ast_codec_get_names(&p->t->src_codec, str);
+	codec_append_name(&p->t->src_codec, str);
 	while (p) {
 		ast_str_append(str, 0, "->");
-		ast_codec_get_names(&p->t->dst_codec, str);
+		codec_append_name(&p->t->dst_codec, str);
 		p = p->next;
 	}
 
@@ -998,7 +1007,7 @@
 		ast_str_reset(str);
 
 		if (step) {
-			ast_codec_get_names(&step->src_codec, &str);
+			codec_append_name(&step->src_codec, &str);
 			while (src != dst) {
 				step = matrix_get(src, dst)->step;
 				if (!step) {
@@ -1006,7 +1015,7 @@
 					break;
 				}
 				ast_str_append(&str, 0, "->");
-				ast_codec_get_names(&step->src_codec, &str);
+				codec_append_name(&step->src_codec, &str);
 				src = step->dst_fmt_index;
 			}
 		}




More information about the svn-commits mailing list