<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7364">View Change</a></p><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">translate: Show sample rate for silk, speex, and slin in translation table.<br><br>ASTERISK-24662<br><br>Change-Id: I3822956984292c99c48bca8e97807e498ccc0e88<br>---<br>M main/translate.c<br>1 file changed, 26 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/translate.c b/main/translate.c<br>index f2aa588..30f1649 100644<br>--- a/main/translate.c<br>+++ b/main/translate.c<br>@@ -945,7 +945,8 @@<br> static char *handle_show_translation_table(struct ast_cli_args *a)<br> {<br> int x, y, i, k;<br>- int longest = 0, num_codecs = 0, curlen = 0;<br>+ int longest = 7; /* slin192 */<br>+ int num_codecs = 0, curlen = 0;<br> struct ast_str *out = ast_str_create(1024);<br> struct ast_codec *codec;<br> <br>@@ -982,6 +983,7 @@<br> <br> ast_str_set(&out, 0, " ");<br> for (k = 0; k < num_codecs; k++) {<br>+ int adjust = 0;<br> struct ast_codec *col = k ? ast_codec_get_by_id(k) : NULL;<br> <br> y = -1;<br>@@ -997,6 +999,12 @@<br> <br> if (k > 0) {<br> curlen = strlen(col->name);<br>+ if (!strcmp(col->name, "slin") ||<br>+ !strcmp(col->name, "speex") ||<br>+ !strcmp(col->name, "silk")) {<br>+ adjust = log10(col->sample_rate / 1000) + 1;<br>+ curlen = curlen + adjust;<br>+ }<br> }<br> <br> if (curlen < 5) {<br>@@ -1008,10 +1016,25 @@<br> ast_str_append(&out, 0, "%*u", curlen + 1, (matrix_get(x, y)->table_cost/100));<br> } else if (i == 0 && k > 0) {<br> /* Top row - use a dynamic size */<br>- ast_str_append(&out, 0, "%*s", curlen + 1, col->name);<br>+ if (!strcmp(col->name, "slin") ||<br>+ !strcmp(col->name, "speex") ||<br>+ !strcmp(col->name, "silk")) {<br>+ ast_str_append(&out, 0, "%*s%u", curlen - adjust + 1,<br>+ col->name, col->sample_rate / 1000);<br>+ } else {<br>+ ast_str_append(&out, 0, "%*s", curlen + 1, col->name);<br>+ }<br> } else if (k == 0 && i > 0) {<br> /* Left column - use a static size. */<br>- ast_str_append(&out, 0, "%*s", longest, row->name);<br>+ if (!strcmp(row->name, "slin") ||<br>+ !strcmp(row->name, "speex") ||<br>+ !strcmp(row->name, "silk")) {<br>+ int adjust_row = log10(row->sample_rate / 1000) + 1;<br>+ ast_str_append(&out, 0, "%*s%u", longest - adjust_row,<br>+ row->name, row->sample_rate / 1000);<br>+ } else {<br>+ ast_str_append(&out, 0, "%*s", longest, row->name);<br>+ }<br> } else if (x >= 0 && y >= 0) {<br> /* Codec not supported */<br> ast_str_append(&out, 0, "%*s", curlen + 1, "-");<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7364">change 7364</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7364"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I3822956984292c99c48bca8e97807e498ccc0e88 </div>
<div style="display:none"> Gerrit-Change-Number: 7364 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexander Traud <pabstraud@compuserve.com> </div>
<div style="display:none"> Gerrit-Reviewer: Alexander Traud <pabstraud@compuserve.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>