Allow multiple codecs to be printed in debug (bug #989)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3011 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-05-19 03:39:44 +00:00
parent 5d9aa86efa
commit 34347418e3
3 changed files with 68 additions and 16 deletions

27
frame.c
View File

@@ -424,6 +424,33 @@ char* ast_getformatname(int format)
return "UNKN";
}
char* ast_getformatname_multiple(char *buf, unsigned n, int format) {
unsigned u=1;
unsigned len;
char *b = buf;
char *start = buf;
if (!n) return buf;
snprintf(b,n,"0x%x(",format);
len = strlen(b);
b += len;
n -= len;
start = b;
while (u) {
if (u&format) {
snprintf(b,n,"%s|",ast_getformatname(u));
len = strlen(b);
b += len;
n -= len;
}
u *= 2;
}
if (start==b)
snprintf(start,n,"EMPTY)");
else if (n>1)
b[-1]=')';
return buf;
}
int ast_getformatbyname(char *name)
{
if (!strcasecmp(name, "g723.1"))