aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-06 22:51:48 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-06 22:51:48 +0000
commit4b2fc9d3e738dbb2e7dd297de2f35e571e350691 (patch)
treee611f1c508d4cbd9720858d06c92a4cfaa25dccb /channels
parentfed34a6362c74a4f65bae5fb89bcae3f58db5f27 (diff)
Commit some cleanups to the format type code.
- Remove the AST_FORMAT_MAX_* types, as these are consuming 3 out of our available 32 bits. - Add a native slin16 type, so that 16kHz codecs can translate without losing resolution. (This doesn't affect anything immediately, until another codec has wb support.) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89071 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_gtalk.c2
-rw-r--r--channels/chan_h323.c4
-rw-r--r--channels/chan_jingle.c7
-rw-r--r--channels/chan_mgcp.c6
-rw-r--r--channels/chan_phone.c2
-rw-r--r--channels/chan_sip.c10
-rw-r--r--channels/chan_skinny.c4
7 files changed, 15 insertions, 20 deletions
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c
index 5666af95c..6f106bde9 100644
--- a/channels/chan_gtalk.c
+++ b/channels/chan_gtalk.c
@@ -198,7 +198,7 @@ static int gtalk_get_codec(struct ast_channel *chan);
static const struct ast_channel_tech gtalk_tech = {
.type = "Gtalk",
.description = "Gtalk Channel Driver",
- .capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
+ .capabilities = AST_FORMAT_AUDIO_MASK,
.requester = gtalk_request,
.send_digit_begin = gtalk_digit_begin,
.send_digit_end = gtalk_digit_end,
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index da324cf6d..99b2086ae 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -249,7 +249,7 @@ static int oh323_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
static const struct ast_channel_tech oh323_tech = {
.type = "H323",
.description = tdesc,
- .capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
+ .capabilities = AST_FORMAT_AUDIO_MASK,
.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
.requester = oh323_request,
.send_digit_begin = oh323_digit_begin,
@@ -1739,7 +1739,7 @@ static struct ast_channel *oh323_request(const char *type, int format, void *dat
return NULL;
}
oldformat = format;
- format &= ((AST_FORMAT_MAX_AUDIO << 1) - 1);
+ format &= AST_FORMAT_AUDIO_MASK;
if (!format) {
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", format);
oh323_destroy(pvt);
diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c
index e332159db..16d906c91 100644
--- a/channels/chan_jingle.c
+++ b/channels/chan_jingle.c
@@ -198,7 +198,7 @@ static int jingle_get_codec(struct ast_channel *chan);
static const struct ast_channel_tech jingle_tech = {
.type = "Jingle",
.description = "Jingle Channel Driver",
- .capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
+ .capabilities = AST_FORMAT_AUDIO_MASK,
.requester = jingle_request,
.send_digit_begin = jingle_digit_begin,
.send_digit_end = jingle_digit_end,
@@ -340,10 +340,7 @@ static int jingle_accept_call(struct jingle *client, struct jingle_pvt *p)
continue;
if (alreadysent & pref_codec)
continue;
- if (pref_codec <= AST_FORMAT_MAX_AUDIO)
- add_codec_to_answer(p, pref_codec, dcodecs);
- else
- add_codec_to_answer(p, pref_codec, dcodecs);
+ add_codec_to_answer(p, pref_codec, dcodecs);
alreadysent |= pref_codec;
}
payload_red = iks_new("payload-type");
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 9eb0fa112..b0b138a00 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -2076,7 +2076,7 @@ static int add_sdp(struct mgcp_request *resp, struct mgcp_subchannel *sub, struc
snprintf(c, sizeof(c), "c=IN IP4 %s\r\n", ast_inet_ntoa(dest.sin_addr));
ast_copy_string(t, "t=0 0\r\n", sizeof(t));
snprintf(m, sizeof(m), "m=audio %d RTP/AVP", ntohs(dest.sin_port));
- for (x = 1; x <= AST_FORMAT_MAX_AUDIO; x <<= 1) {
+ for (x = 1; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
if (p->capability & x) {
if (mgcpdebug) {
ast_verbose("Answering with capability %d\n", x);
@@ -2142,7 +2142,7 @@ static int transmit_modify_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp
return 0;
}
ast_copy_string(local, "p:20", sizeof(local));
- for (x=1;x<= AST_FORMAT_MAX_AUDIO; x <<= 1) {
+ for (x = 1; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
if (p->capability & x) {
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype(1, x, 0));
strncat(local, tmp, sizeof(local) - strlen(local) - 1);
@@ -2172,7 +2172,7 @@ static int transmit_connect_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp
struct mgcp_endpoint *p = sub->parent;
ast_copy_string(local, "p:20", sizeof(local));
- for (x=1;x<= AST_FORMAT_MAX_AUDIO; x <<= 1) {
+ for (x = 1; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
if (p->capability & x) {
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype(1, x, 0));
strncat(local, tmp, sizeof(local) - strlen(local) - 1);
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 33f515d5e..17204fda5 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -594,7 +594,7 @@ static struct ast_frame *phone_read(struct ast_channel *ast)
}
p->fr.samples = 240;
p->fr.datalen = res;
- p->fr.frametype = p->lastinput <= AST_FORMAT_MAX_AUDIO ?
+ p->fr.frametype = p->lastinput <= AST_FORMAT_AUDIO_MASK ?
AST_FRAME_VOICE :
p->lastinput <= AST_FORMAT_PNG ? AST_FRAME_IMAGE
: AST_FRAME_VIDEO;
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 7b4764b6d..2e231d35d 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -155,8 +155,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define XMIT_ERROR -2
-#define VIDEO_CODEC_MASK 0x1fc0000 /*!< Video codecs from H.261 thru AST_FORMAT_MAX_VIDEO */
-
/* #define VOCAL_DATA_HACK */
#define DEFAULT_DEFAULT_EXPIRY 120
@@ -7228,20 +7226,20 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p)
}
/* Now send any other common audio and video codecs, and non-codec formats: */
- for (x = 1; x <= (needtext ? AST_FORMAT_MAX_TEXT : (needvideo ? AST_FORMAT_MAX_VIDEO : AST_FORMAT_MAX_AUDIO)); x <<= 1) {
+ for (x = 1; x <= (needtext ? AST_FORMAT_TEXT_MASK : (needvideo ? AST_FORMAT_VIDEO_MASK : AST_FORMAT_AUDIO_MASK)); x <<= 1) {
if (!(capability & x)) /* Codec not requested */
continue;
if (alreadysent & x) /* Already added to SDP */
continue;
- if (x <= AST_FORMAT_MAX_AUDIO)
+ if (x & AST_FORMAT_AUDIO_MASK)
add_codec_to_sdp(p, x, SDP_SAMPLE_RATE(x),
&m_audio, &a_audio, debug, &min_audio_packet_size);
- else if (x <= AST_FORMAT_MAX_VIDEO)
+ else if (x & AST_FORMAT_VIDEO_MASK)
add_vcodec_to_sdp(p, x, 90000,
&m_video, &a_video, debug, &min_video_packet_size);
- else if (x <= AST_FORMAT_MAX_TEXT)
+ else if (x & AST_FORMAT_TEXT_MASK)
add_tcodec_to_sdp(p, x, 1000,
&m_text, &a_text, debug, &min_text_packet_size);
}
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 86d2a5b95..6808d32a4 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -1239,7 +1239,7 @@ static int handle_time_date_req_message(struct skinny_req *req, struct skinnyses
static const struct ast_channel_tech skinny_tech = {
.type = "Skinny",
.description = tdesc,
- .capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
+ .capabilities = AST_FORMAT_AUDIO_MASK,
.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
.requester = skinny_request,
.devicestate = skinny_devicestate,
@@ -5395,7 +5395,7 @@ static struct ast_channel *skinny_request(const char *type, int format, void *da
oldformat = format;
- if (!(format &= ((AST_FORMAT_MAX_AUDIO << 1) - 1))) {
+ if (!(format &= AST_FORMAT_AUDIO_MASK)) {
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", format);
return NULL;
}