summaryrefslogtreecommitdiff
path: root/channels/iax2-parser.c
diff options
context:
space:
mode:
authorDavid Vossel <dvossel@digium.com>2011-02-03 16:22:10 +0000
committerDavid Vossel <dvossel@digium.com>2011-02-03 16:22:10 +0000
commitc26c190711a1bbe3b5fff1a93facae333757c56e (patch)
tree00da0caa5a07b7b25729f089dbcafb08129fa9be /channels/iax2-parser.c
parent652fb64a01c7a8656697d07e606620ee0ced6929 (diff)
Asterisk media architecture conversion - no more format bitfields
This patch is the foundation of an entire new way of looking at media in Asterisk. The code present in this patch is everything required to complete phase1 of my Media Architecture proposal. For more information about this project visit the link below. https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal The primary function of this patch is to convert all the usages of format bitfields in Asterisk to use the new format and format_cap APIs. Functionally no change in behavior should be present in this patch. Thanks to twilson and russell for all the time they spent reviewing these changes. Review: https://reviewboard.asterisk.org/r/1083/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/iax2-parser.c')
-rw-r--r--channels/iax2-parser.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/channels/iax2-parser.c b/channels/iax2-parser.c
index 094651e70..ce9af244d 100644
--- a/channels/iax2-parser.c
+++ b/channels/iax2-parser.c
@@ -218,9 +218,9 @@ static void dump_versioned_codec(char *output, int maxlen, void *value, int len)
{
char *version = (char *) value;
if (version[0] == 0) {
- if (len == (int) (sizeof(format_t) + sizeof(char))) {
- format_t codec = ntohll(get_unaligned_uint64(value + 1));
- ast_copy_string(output, ast_getformatname(codec), maxlen);
+ if (len == (int) (sizeof(iax2_format) + sizeof(char))) {
+ iax2_format codec = ntohll(get_unaligned_uint64(value + 1));
+ ast_copy_string(output, iax2_getformatname(codec), maxlen);
} else {
ast_copy_string(output, "Invalid length!", maxlen);
}
@@ -804,11 +804,11 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
{
int version = data[2];
if (version == 0) {
- if (len != (int)sizeof(char) + sizeof(format_t)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int) (sizeof(format_t) + sizeof(char)), len);
+ if (len != (int)sizeof(char) + sizeof(iax2_format)) {
+ snprintf(tmp, (int)sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int) (sizeof(iax2_format) + sizeof(char)), len);
errorf(tmp);
} else {
- ies->capability = (format_t) ntohll(get_unaligned_uint64(data + 3));
+ ies->capability = (iax2_format) ntohll(get_unaligned_uint64(data + 3));
}
} /* else unknown version */
}
@@ -825,11 +825,11 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
{
int version = data[2];
if (version == 0) {
- if (len != (int)sizeof(char) + sizeof(format_t)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting format to be %d bytes long but was %d\n", (int) (sizeof(format_t) + sizeof(char)), len);
+ if (len != (int)sizeof(char) + sizeof(iax2_format)) {
+ snprintf(tmp, (int)sizeof(tmp), "Expecting format to be %d bytes long but was %d\n", (int) (sizeof(iax2_format) + sizeof(char)), len);
errorf(tmp);
} else {
- ies->format = (format_t) ntohll(get_unaligned_uint64(data + 3));
+ ies->format = (iax2_format) ntohll(get_unaligned_uint64(data + 3));
}
} /* else unknown version */
}
@@ -1138,7 +1138,7 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f)
{
fr->af.frametype = f->frametype;
- fr->af.subclass.codec = f->subclass.codec;
+ ast_format_copy(&fr->af.subclass.format, &f->subclass.format);
fr->af.mallocd = 0; /* Our frame is static relative to the container */
fr->af.datalen = f->datalen;
fr->af.samples = f->samples;
@@ -1157,7 +1157,7 @@ void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f)
}
#if __BYTE_ORDER == __LITTLE_ENDIAN
/* We need to byte-swap slinear samples from network byte order */
- if ((fr->af.frametype == AST_FRAME_VOICE) && (fr->af.subclass.codec == AST_FORMAT_SLINEAR)) {
+ if ((fr->af.frametype == AST_FRAME_VOICE) && (fr->af.subclass.format.id == AST_FORMAT_SLINEAR)) {
/* 2 bytes / sample for SLINEAR */
ast_swapcopy_samples(fr->af.data.ptr, f->data.ptr, copy_len / 2);
} else