mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +00:00
Rework codecs command to comply with the 64-bit scheme
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@228049 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
61
main/frame.c
61
main/frame.c
@@ -661,9 +661,9 @@ static char *show_codecs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
|
|||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case CLI_INIT:
|
case CLI_INIT:
|
||||||
e->command = "core show codecs [audio|video|image]";
|
e->command = "core show codecs [audio|video|image|text]";
|
||||||
e->usage =
|
e->usage =
|
||||||
"Usage: core show codecs [audio|video|image]\n"
|
"Usage: core show codecs [audio|video|image|text]\n"
|
||||||
" Displays codec mapping\n";
|
" Displays codec mapping\n";
|
||||||
return NULL;
|
return NULL;
|
||||||
case CLI_GENERATE:
|
case CLI_GENERATE:
|
||||||
@@ -677,39 +677,48 @@ static char *show_codecs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
|
|||||||
ast_cli(a->fd, "Disclaimer: this command is for informational purposes only.\n"
|
ast_cli(a->fd, "Disclaimer: this command is for informational purposes only.\n"
|
||||||
"\tIt does not indicate anything about your configuration.\n");
|
"\tIt does not indicate anything about your configuration.\n");
|
||||||
|
|
||||||
ast_cli(a->fd, "%11s %9s %10s TYPE %8s %s\n","INT","BINARY","HEX","NAME","DESC");
|
ast_cli(a->fd, "%19s %9s %20s TYPE %8s %s\n","INT","BINARY","HEX","NAME","DESCRIPTION");
|
||||||
ast_cli(a->fd, "--------------------------------------------------------------------------------\n");
|
ast_cli(a->fd, "-----------------------------------------------------------------------------------\n");
|
||||||
if ((a->argc == 3) || (!strcasecmp(a->argv[3], "audio"))) {
|
for (i = 0; i < 63; i++) {
|
||||||
found = 1;
|
|
||||||
for (i = 0; i < 48; i++) {
|
if (a->argc == 4) {
|
||||||
if (!((1LL << i) & AST_FORMAT_AUDIO_MASK)) {
|
if (!strcasecmp(a->argv[3], "audio")) {
|
||||||
|
if (!((1LL << i) & AST_FORMAT_AUDIO_MASK)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else if (!strcasecmp(a->argv[3], "video")) {
|
||||||
|
if (!((1LL << i) & AST_FORMAT_VIDEO_MASK)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else if (!strcasecmp(a->argv[3], "image")) {
|
||||||
|
if (i != 16 && i != 17) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else if (!strcasecmp(a->argv[3], "text")) {
|
||||||
|
if (!((1LL << i) & AST_FORMAT_TEXT_MASK)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
snprintf(hex, sizeof(hex), "(0x%Lx)", 1LL << i);
|
|
||||||
ast_cli(a->fd, "%11Lu (1 << %2d) %10s audio %8s (%s)\n", 1LL << i, i, hex, ast_getformatname(1LL << i), ast_codec2str(1LL << i));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ((a->argc == 3) || (!strcasecmp(a->argv[3], "image"))) {
|
snprintf(hex, sizeof(hex), "(0x%Lx)", 1LL << i);
|
||||||
|
ast_cli(a->fd, "%19Lu (1 << %2d) %20s %5s %8s (%s)\n", 1LL << i, i, hex,
|
||||||
|
((1LL << i) & AST_FORMAT_AUDIO_MASK) ? "audio" :
|
||||||
|
i == 16 || i == 17 ? "image" :
|
||||||
|
((1LL << i) & AST_FORMAT_VIDEO_MASK) ? "video" :
|
||||||
|
((1LL << i) & AST_FORMAT_TEXT_MASK) ? "text" :
|
||||||
|
"(unk)",
|
||||||
|
ast_getformatname(1LL << i), ast_codec2str(1LL << i));
|
||||||
found = 1;
|
found = 1;
|
||||||
for (i = 16; i < 18; i++) {
|
|
||||||
snprintf(hex, sizeof(hex), "(0x%Lx)", 1LL << i);
|
|
||||||
ast_cli(a->fd, "%11Lu (1 << %2d) %10s image %8s (%s)\n", 1LL << i, i, hex, ast_getformatname(1LL << i), ast_codec2str(1LL << i));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((a->argc == 3) || (!strcasecmp(a->argv[3], "video"))) {
|
if (!found) {
|
||||||
found = 1;
|
|
||||||
for (i = 18; i < 63; i++) {
|
|
||||||
snprintf(hex, sizeof(hex), "(0x%Lx)", 1LL << i);
|
|
||||||
ast_cli(a->fd, "%11Lu (1 << %2d) %10s video %8s (%s)\n", 1LL << i, i, hex, ast_getformatname(1LL << i), ast_codec2str(1LL << i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
return CLI_SHOWUSAGE;
|
return CLI_SHOWUSAGE;
|
||||||
else
|
} else {
|
||||||
return CLI_SUCCESS;
|
return CLI_SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *show_codec_n(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
static char *show_codec_n(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||||
|
Reference in New Issue
Block a user