move iana codes to the implementations.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1666 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2006-06-23 20:14:29 +00:00
1 parent ce2a9d2636
commit 3ba26db705
13 files changed
+167 -88

No files matched your search

+11 -11
View File
@@ -440,16 +440,16 @@ static int do_describe(struct private_object *tech_pvt, int force)
if (force || !switch_test_flag(tech_pvt, TFLAG_CODEC_READY)) {
if (tech_pvt->codec_index < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Don't have my codec yet here's one\n");
tech_pvt->codec_name = lame(tech_pvt->codecs[0]->iananame);
tech_pvt->codec_num = tech_pvt->codecs[0]->ianacode;
tech_pvt->codec_name = lame(tech_pvt->codecs[0]->implementations->iananame);
tech_pvt->codec_num = tech_pvt->codecs[0]->implementations->ianacode;
tech_pvt->codec_index = 0;
payloads[0].name = lame(tech_pvt->codecs[0]->iananame);
payloads[0].id = tech_pvt->codecs[0]->ianacode;
payloads[0].name = lame(tech_pvt->codecs[0]->implementations->iananame);
payloads[0].id = tech_pvt->codecs[0]->implementations->ianacode;
} else {
payloads[0].name = lame(tech_pvt->codecs[tech_pvt->codec_index]->iananame);
payloads[0].id = tech_pvt->codecs[tech_pvt->codec_index]->ianacode;
payloads[0].name = lame(tech_pvt->codecs[tech_pvt->codec_index]->implementations->iananame);
payloads[0].id = tech_pvt->codecs[tech_pvt->codec_index]->implementations->ianacode;
}
@@ -1546,22 +1546,22 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
for(x = 0; x < len; x++) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Available Payload %s %u\n", payloads[x].name, payloads[x].id);
for(y = 0; y < tech_pvt->num_codecs; y++) {
char *name = tech_pvt->codecs[y]->iananame;
char *name = tech_pvt->codecs[y]->implementations->iananame;
if (!strncasecmp(name, "ilbc", 4)) {
name = "ilbc";
}
if (tech_pvt->codecs[y]->ianacode > 96) {
if (tech_pvt->codecs[y]->implementations->ianacode > 96) {
match = strcasecmp(name, payloads[x].name) ? 0 : 1;
} else {
match = (payloads[x].id == tech_pvt->codecs[y]->ianacode) ? 1 : 0;
match = (payloads[x].id == tech_pvt->codecs[y]->implementations->ianacode) ? 1 : 0;
}
if (match) {
tech_pvt->codec_index = y;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing Payload index %u %s %u\n", y, payloads[x].name, payloads[x].id);
tech_pvt->codec_name = tech_pvt->codecs[y]->iananame;
tech_pvt->codec_num = tech_pvt->codecs[y]->ianacode;
tech_pvt->codec_name = tech_pvt->codecs[y]->implementations->iananame;
tech_pvt->codec_num = tech_pvt->codecs[y]->implementations->ianacode;
if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
do_describe(tech_pvt, 0);
}
+34 -33
View File
@@ -351,24 +351,27 @@ static switch_status_t exosip_on_init(switch_core_session_t *session)
if (tech_pvt->num_codecs > 0) {
int i;
int i, lastcode = -1;
static const switch_codec_implementation_t *imp;
for (i = 0; i < tech_pvt->num_codecs; i++) {
snprintf(tmp, sizeof(tmp), "%u", tech_pvt->codecs[i]->ianacode);
sdp_message_m_payload_add(tech_pvt->local_sdp, 0, osip_strdup(tmp));
imp = tech_pvt->codecs[i]->implementations;
while(NULL != imp) {
uint32_t sps = imp->samples_per_second;
if (lastcode != imp->ianacode) {
snprintf(tmp, sizeof(tmp), "%u", imp->ianacode);
sdp_message_m_payload_add(tech_pvt->local_sdp, 0, osip_strdup(tmp));
lastcode = imp->ianacode;
}
/* Add to SDP config */
sdp_add_codec(tech_pvt->sdp_config, tech_pvt->codecs[i]->codec_type, tech_pvt->codecs[i]->ianacode, tech_pvt->codecs[i]->iananame, sps, 0);
sdp_add_codec(tech_pvt->sdp_config, tech_pvt->codecs[i]->codec_type, imp->ianacode, imp->iananame, sps, 0);
/* Add to SDP message */
snprintf(tmp, sizeof(tmp), "%u %s/%d", tech_pvt->codecs[i]->ianacode, tech_pvt->codecs[i]->iananame, sps);
snprintf(tmp, sizeof(tmp), "%u %s/%d", imp->ianacode, imp->iananame, sps);
sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "rtpmap", osip_strdup(tmp));
memset(tmp, 0, sizeof(tmp));
if (imp) {
@@ -521,10 +524,10 @@ static switch_status_t activate_rtp(struct private_object *tech_pvt)
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activating RTP %s:%d->%s:%d codec: %u ms: %d\n",
tech_pvt->local_sdp_audio_ip,
tech_pvt->local_sdp_audio_port,
tech_pvt->remote_sdp_audio_ip,
tech_pvt->remote_sdp_audio_port, tech_pvt->read_codec.codec_interface->ianacode, ms);
tech_pvt->local_sdp_audio_ip,
tech_pvt->local_sdp_audio_port,
tech_pvt->remote_sdp_audio_ip,
tech_pvt->remote_sdp_audio_port, tech_pvt->read_codec.implementation->ianacode, ms);
if (tech_pvt->realm) {
@@ -548,15 +551,15 @@ static switch_status_t activate_rtp(struct private_object *tech_pvt)
}
tech_pvt->rtp_session = switch_rtp_new(tech_pvt->local_sdp_audio_ip,
tech_pvt->local_sdp_audio_port,
tech_pvt->remote_sdp_audio_ip,
tech_pvt->remote_sdp_audio_port,
tech_pvt->read_codec.codec_interface->ianacode,
tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
ms,
flags,
key,
&err, switch_core_session_get_pool(tech_pvt->session));
tech_pvt->local_sdp_audio_port,
tech_pvt->remote_sdp_audio_ip,
tech_pvt->remote_sdp_audio_port,
tech_pvt->read_codec.implementation->ianacode,
tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
ms,
flags,
key,
&err, switch_core_session_get_pool(tech_pvt->session));
if (tech_pvt->rtp_session) {
uint8_t vad_in = switch_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0;
@@ -1311,7 +1314,7 @@ static switch_status_t exosip_create_call(eXosip_event_t * event)
for (i = 0; i < tech_pvt->num_codecs; i++) {
for (imp = tech_pvt->codecs[i]->implementations; imp; imp = imp->next) {
sdp_add_codec(tech_pvt->sdp_config, tech_pvt->codecs[i]->codec_type, tech_pvt->codecs[i]->ianacode, tech_pvt->codecs[i]->iananame,
sdp_add_codec(tech_pvt->sdp_config, tech_pvt->codecs[i]->codec_type, imp->ianacode, imp->iananame,
imp->samples_per_second, 0);
}
@@ -1520,22 +1523,20 @@ static switch_status_t parse_sdp_media(struct private_object *tech_pvt, sdp_medi
for(i = 0; !match && i < tech_pvt->num_codecs; i++) {
const switch_codec_implementation_t *imp;
if (pt < 97) {
match = (pt == tech_pvt->codecs[i]->ianacode) ? 1 : 0;
} else {
match = strcasecmp(name, tech_pvt->codecs[i]->iananame) ? 0 : 1;
}
if (match) {
match = 0;
for (imp = tech_pvt->codecs[i]->implementations; imp; imp = imp->next) {
if (pt < 97) {
match = (pt == imp->ianacode) ? 1 : 0;
} else {
match = strcasecmp(name, imp->iananame) ? 0 : 1;
}
for (imp = tech_pvt->codecs[i]->implementations; imp; imp = imp->next) {
if ((r == imp->samples_per_second)) {
match = 1;
break;
}
if (match && (r == imp->samples_per_second)) {
break;
}
}
}
if (match) {
+31 -15
View File
@@ -234,11 +234,15 @@ static switch_status_t iax_set_codec(struct private_object *tech_pvt, struct iax
}
for (x = 0; x < num_codecs; x++) {
unsigned int codec = iana2ast(codecs[x]->ianacode);
if (io == IAX_QUERY) {
iax_pref_codec_add(iax_session, codec);
static const switch_codec_implementation_t *imp;
for (imp = codecs[x]->implementations; imp; imp = imp->next) {
unsigned int codec = iana2ast(imp->ianacode);
if (io == IAX_QUERY) {
iax_pref_codec_add(iax_session, codec);
}
local_cap |= codec;
}
local_cap |= codec;
}
if (io == IAX_SET) {
@@ -247,7 +251,7 @@ static switch_status_t iax_set_codec(struct private_object *tech_pvt, struct iax
mixed_cap = local_cap;
}
leading = iana2ast(codecs[0]->ianacode);
leading = iana2ast(codecs[0]->implementations->ianacode);
if (io == IAX_QUERY) {
chosen = leading;
*format = chosen;
@@ -259,7 +263,7 @@ static switch_status_t iax_set_codec(struct private_object *tech_pvt, struct iax
return SWITCH_STATUS_SUCCESS;
} else if (switch_test_flag(&globals, GFLAG_MY_CODEC_PREFS) && (leading & mixed_cap)) {
chosen = leading;
dname = codecs[0]->iananame;
dname = codecs[0]->implementations->iananame;
} else {
unsigned int prefs[32];
int len = 0;
@@ -283,8 +287,12 @@ static switch_status_t iax_set_codec(struct private_object *tech_pvt, struct iax
int z;
chosen = prefs[x];
for (z = 0; z < num_codecs; z++) {
if (prefs[x] == iana2ast(codecs[z]->ianacode)) {
dname = codecs[z]->iananame;
static const switch_codec_implementation_t *imp;
for (imp = codecs[z]->implementations; imp; imp = imp->next) {
if (prefs[x] == iana2ast(imp->ianacode)) {
dname = imp->iananame;
break;
}
}
}
break;
@@ -294,17 +302,25 @@ static switch_status_t iax_set_codec(struct private_object *tech_pvt, struct iax
if (*format & mixed_cap) { /* is the one we asked for here? */
chosen = *format;
for (x = 0; x < num_codecs; x++) {
unsigned int cap = iana2ast(codecs[x]->ianacode);
if (cap == chosen) {
dname = codecs[x]->iananame;
static const switch_codec_implementation_t *imp;
for (imp = codecs[x]->implementations; imp; imp = imp->next) {
unsigned int cap = iana2ast(imp->ianacode);
if (cap == chosen) {
dname = imp->iananame;
break;
}
}
}
} else { /* c'mon there has to be SOMETHING... */
for (x = 0; x < num_codecs; x++) {
unsigned int cap = iana2ast(codecs[x]->ianacode);
if (cap & mixed_cap) {
chosen = cap;
dname = codecs[x]->iananame;
static const switch_codec_implementation_t *imp;
for (imp = codecs[x]->implementations; imp; imp = imp->next) {
unsigned int cap = iana2ast(imp->ianacode);
if (cap & mixed_cap) {
chosen = cap;
dname = imp->iananame;
break;
}
}
}
}