diff options
Diffstat (limited to 'main/translate.c')
-rw-r--r-- | main/translate.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/main/translate.c b/main/translate.c index 92c0cb9ea..70e97f955 100644 --- a/main/translate.c +++ b/main/translate.c @@ -946,7 +946,8 @@ static void handle_cli_recalc(struct ast_cli_args *a) static char *handle_show_translation_table(struct ast_cli_args *a) { int x, y, i, k; - int longest = 0, num_codecs = 0, curlen = 0; + int longest = 7; /* slin192 */ + int num_codecs = 0, curlen = 0; struct ast_str *out = ast_str_create(1024); struct ast_codec *codec; @@ -983,6 +984,7 @@ static char *handle_show_translation_table(struct ast_cli_args *a) ast_str_set(&out, 0, " "); for (k = 0; k < num_codecs; k++) { + int adjust = 0; struct ast_codec *col = k ? ast_codec_get_by_id(k) : NULL; y = -1; @@ -998,6 +1000,12 @@ static char *handle_show_translation_table(struct ast_cli_args *a) if (k > 0) { curlen = strlen(col->name); + if (!strcmp(col->name, "slin") || + !strcmp(col->name, "speex") || + !strcmp(col->name, "silk")) { + adjust = log10(col->sample_rate / 1000) + 1; + curlen = curlen + adjust; + } } if (curlen < 5) { @@ -1009,10 +1017,25 @@ static char *handle_show_translation_table(struct ast_cli_args *a) ast_str_append(&out, 0, "%*u", curlen + 1, (matrix_get(x, y)->table_cost/100)); } else if (i == 0 && k > 0) { /* Top row - use a dynamic size */ - ast_str_append(&out, 0, "%*s", curlen + 1, col->name); + if (!strcmp(col->name, "slin") || + !strcmp(col->name, "speex") || + !strcmp(col->name, "silk")) { + ast_str_append(&out, 0, "%*s%u", curlen - adjust + 1, + col->name, col->sample_rate / 1000); + } else { + ast_str_append(&out, 0, "%*s", curlen + 1, col->name); + } } else if (k == 0 && i > 0) { /* Left column - use a static size. */ - ast_str_append(&out, 0, "%*s", longest, row->name); + if (!strcmp(row->name, "slin") || + !strcmp(row->name, "speex") || + !strcmp(row->name, "silk")) { + int adjust_row = log10(row->sample_rate / 1000) + 1; + ast_str_append(&out, 0, "%*s%u", longest - adjust_row, + row->name, row->sample_rate / 1000); + } else { + ast_str_append(&out, 0, "%*s", longest, row->name); + } } else if (x >= 0 && y >= 0) { /* Codec not supported */ ast_str_append(&out, 0, "%*s", curlen + 1, "-"); |