[asterisk-commits] tilghman: branch group/codec_bits r108858 - in /team/group/codec_bits: channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 14 16:57:29 CDT 2008


Author: tilghman
Date: Fri Mar 14 16:57:29 2008
New Revision: 108858

URL: http://svn.digium.com/view/asterisk?view=rev&rev=108858
Log:
Hooray, SIP compiles

Modified:
    team/group/codec_bits/channels/chan_agent.c
    team/group/codec_bits/channels/chan_local.c
    team/group/codec_bits/channels/chan_mgcp.c
    team/group/codec_bits/channels/chan_oss.c
    team/group/codec_bits/channels/chan_phone.c
    team/group/codec_bits/channels/chan_sip.c
    team/group/codec_bits/include/asterisk/frame.h
    team/group/codec_bits/include/asterisk/rtp.h
    team/group/codec_bits/include/asterisk/translate.h
    team/group/codec_bits/main/frame.c

Modified: team/group/codec_bits/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/channels/chan_agent.c?view=diff&rev=108858&r1=108857&r2=108858
==============================================================================
--- team/group/codec_bits/channels/chan_agent.c (original)
+++ team/group/codec_bits/channels/chan_agent.c Fri Mar 14 16:57:29 2008
@@ -236,7 +236,7 @@
 static const struct ast_channel_tech agent_tech = {
 	.type = "Agent",
 	.description = tdesc,
-	.capabilities = { { -1, -1, -1, -1, -1, -1, -1, -1 }, { -1, -1, -1, -1, -1, -1, -1 }, -1 },
+	.capabilities = AST_FMT_FULL_MASK_INIT,
 	.requester = agent_request,
 	.devicestate = agent_devicestate,
 	.send_digit_begin = agent_digit_begin,
@@ -953,12 +953,11 @@
 		ast_copy_string(tmp->exten, p->chan->exten, sizeof(tmp->exten));
 		/* XXX Is this really all we copy form the originating channel?? */
 	} else {
-		struct ast_extended_codec codec = { .audio[0] = AST_FORMAT_SLINEAR };
-		tmp->nativeformats = codec;
-		tmp->writeformat = codec;
-		tmp->rawwriteformat = codec;
-		tmp->readformat = codec;
-		tmp->rawreadformat = codec;
+		tmp->nativeformats = AST_FMT_SLINEAR;
+		tmp->writeformat = AST_FMT_SLINEAR;
+		tmp->rawwriteformat = AST_FMT_SLINEAR;
+		tmp->readformat = AST_FMT_SLINEAR;
+		tmp->rawreadformat = AST_FMT_SLINEAR;
 	}
 	/* Safe, agentlock already held */
 	tmp->tech_pvt = p;

Modified: team/group/codec_bits/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/channels/chan_local.c?view=diff&rev=108858&r1=108857&r2=108858
==============================================================================
--- team/group/codec_bits/channels/chan_local.c (original)
+++ team/group/codec_bits/channels/chan_local.c Fri Mar 14 16:57:29 2008
@@ -79,7 +79,7 @@
 static const struct ast_channel_tech local_tech = {
 	.type = "Local",
 	.description = tdesc,
-	.capabilities = { { -1, -1, -1, -1, -1, -1, -1, -1 }, { -1, -1, -1, -1, -1, -1, -1 }, -1 },
+	.capabilities = AST_FMT_FULL_MASK_INIT,
 	.requester = local_request,
 	.send_digit_begin = local_digit_begin,
 	.send_digit_end = local_digit_end,

Modified: team/group/codec_bits/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/channels/chan_mgcp.c?view=diff&rev=108858&r1=108857&r2=108858
==============================================================================
--- team/group/codec_bits/channels/chan_mgcp.c (original)
+++ team/group/codec_bits/channels/chan_mgcp.c Fri Mar 14 16:57:29 2008
@@ -207,7 +207,7 @@
 
 static int restart_monitor(void);
 
-static struct ast_extended_codec capability = { { AST_FORMAT_ULAW, }, };
+static struct ast_extended_codec capability = AST_FMT_ULAW_INIT;
 static int nonCodecCapability = AST_RTP_DTMF;
 
 static char ourhost[MAXHOSTNAMELEN];
@@ -430,7 +430,7 @@
 static const struct ast_channel_tech mgcp_tech = {
 	.type = "MGCP",
 	.description = tdesc,
-	.capabilities = { { AST_FORMAT_ULAW, }, },
+	.capabilities = AST_FMT_ULAW_INIT,
 	.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
 	.requester = mgcp_request,
 	.devicestate = mgcp_devicestate,

Modified: team/group/codec_bits/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/channels/chan_oss.c?view=diff&rev=108858&r1=108857&r2=108858
==============================================================================
--- team/group/codec_bits/channels/chan_oss.c (original)
+++ team/group/codec_bits/channels/chan_oss.c Fri Mar 14 16:57:29 2008
@@ -349,7 +349,7 @@
 static struct ast_channel_tech oss_tech = {
 	.type = "Console",
 	.description = tdesc,
-	.capabilities = { { AST_FORMAT_SLINEAR, }, }, /* overwritten later */
+	.capabilities = AST_FMT_SLINEAR_INIT, /* overwritten later */
 	.requester = oss_request,
 	.send_digit_begin = oss_digit_begin,
 	.send_digit_end = oss_digit_end,
@@ -720,7 +720,8 @@
 		return f;
 	/* ok we can build and deliver the frame to the caller */
 	f->frametype = AST_FRAME_VOICE;
-	f->subclass = AST_FORMAT_SLINEAR;
+	f->subclass = 0;
+	f->codec = AST_FMT_SLINEAR;
 	f->samples = FRAME_SIZE;
 	f->datalen = FRAME_SIZE * 2;
 	f->data = o->oss_read_buf + AST_FRIENDLY_OFFSET;
@@ -787,7 +788,6 @@
 static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx, int state)
 {
 	struct ast_channel *c;
-	const struct ast_extended_codec slin = { { AST_FORMAT_SLINEAR, }, };
 
 	c = ast_channel_alloc(1, state, o->cid_num, o->cid_name, "", ext, ctx, 0, "Console/%s", o->device + 5);
 	if (c == NULL)
@@ -796,14 +796,14 @@
 	if (o->sounddev < 0)
 		setformat(o, O_RDWR);
 	ast_channel_set_fd(c, 0, o->sounddev); /* -1 if device closed, override later */
-	c->nativeformats = slin;
+	c->nativeformats = AST_FMT_SLINEAR;
 	/* if the console makes the call, add video to the offer */
 	if (state == AST_STATE_RINGING) {
 		c->nativeformats = ast_extended_codec_or(c->nativeformats, console_video_formats);
 	}
 
-	c->readformat = slin;
-	c->writeformat = slin;
+	c->readformat = AST_FMT_SLINEAR;
+	c->writeformat = AST_FMT_SLINEAR;
 	c->tech_pvt = o;
 
 	if (!ast_strlen_zero(o->language))
@@ -839,7 +839,6 @@
 		AST_APP_ARG(flags);
 	);
 	char *parse = ast_strdupa(data);
-	const struct ast_extended_codec slin = { { AST_FORMAT_SLINEAR, }, };
 
 	AST_NONSTANDARD_APP_ARGS(args, parse, '/');
 	o = find_desc(args.name);
@@ -850,7 +849,7 @@
 		/* XXX we could default to 'dsp' perhaps ? */
 		return NULL;
 	}
-	if (ast_extended_codec_not(ast_extended_codec_and(format, slin))) {
+	if (ast_extended_codec_not(ast_extended_codec_and(format, AST_FMT_SLINEAR))) {
 		struct ast_str *str = NULL;
 		ast_log(LOG_NOTICE, "Format %s unsupported\n", ast_codec2bitstring(format, &str));
 		ast_free(str);

Modified: team/group/codec_bits/channels/chan_phone.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/channels/chan_phone.c?view=diff&rev=108858&r1=108857&r2=108858
==============================================================================
--- team/group/codec_bits/channels/chan_phone.c (original)
+++ team/group/codec_bits/channels/chan_phone.c Fri Mar 14 16:57:29 2008
@@ -96,7 +96,8 @@
 
 static int silencesupression = 0;
 
-static struct ast_extended_codec prefformat = { { AST_FORMAT_G729A | AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW }, };
+static struct ast_extended_codec prefformat = { { AST_FORMAT_AUDIO_G729A | AST_FORMAT_AUDIO_G723_1 | AST_FORMAT_AUDIO_SLINEAR | AST_FORMAT_AUDIO_ULAW }, };
+static const struct ast_extended_codec fullformat = { { AST_FORMAT_AUDIO_G729A | AST_FORMAT_AUDIO_G723_1 | AST_FORMAT_AUDIO_SLINEAR | AST_FORMAT_AUDIO_ULAW }, };
 
 /* Protect the interface list (of phone_pvt's) */
 AST_MUTEX_DEFINE_STATIC(iflock);
@@ -168,7 +169,7 @@
 static const struct ast_channel_tech phone_tech = {
 	.type = "Phone",
 	.description = tdesc,
-	.capabilities = { { AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW | AST_FORMAT_G729A }, },
+	.capabilities = { { AST_FORMAT_AUDIO_G729A | AST_FORMAT_AUDIO_G723_1 | AST_FORMAT_AUDIO_SLINEAR | AST_FORMAT_AUDIO_ULAW }, },
 	.requester = phone_request,
 	.send_digit_begin = phone_digit_begin,
 	.send_digit_end = phone_digit_end,
@@ -393,38 +394,38 @@
 	p = ast->tech_pvt;
 	ioctl(p->fd, PHONE_CPT_STOP);
 	/* Nothing to answering really, just start recording */
-	if (ast->rawreadformat.audio[0] == AST_FORMAT_G729A) {
+	if (ast->rawreadformat.audio[0] == AST_FORMAT_AUDIO_G729A) {
 		/* Prefer g729 */
 		ioctl(p->fd, PHONE_REC_STOP);
-		if (p->lastinput.audio[0] != AST_FORMAT_G729A) {
-			p->lastinput.audio[0] = AST_FORMAT_G729A;
+		if (p->lastinput.audio[0] != AST_FORMAT_AUDIO_G729A) {
+			p->lastinput.audio[0] = AST_FORMAT_AUDIO_G729A;
 			if (ioctl(p->fd, PHONE_REC_CODEC, G729)) {
 				ast_log(LOG_WARNING, "Failed to set codec to g729\n");
 				return -1;
 			}
 		}
-	} else if (ast->rawreadformat.audio[0] == AST_FORMAT_G723_1) {
+	} else if (ast->rawreadformat.audio[0] == AST_FORMAT_AUDIO_G723_1) {
 		ioctl(p->fd, PHONE_REC_STOP);
-		if (p->lastinput.audio[0] != AST_FORMAT_G723_1) {
-			p->lastinput.audio[0] = AST_FORMAT_G723_1;
+		if (p->lastinput.audio[0] != AST_FORMAT_AUDIO_G723_1) {
+			p->lastinput.audio[0] = AST_FORMAT_AUDIO_G723_1;
 			if (ioctl(p->fd, PHONE_REC_CODEC, G723_63)) {
 				ast_log(LOG_WARNING, "Failed to set codec to g723.1\n");
 				return -1;
 			}
 		}
-	} else if (ast->rawreadformat.audio[0] == AST_FORMAT_SLINEAR) {
+	} else if (ast->rawreadformat.audio[0] == AST_FORMAT_AUDIO_SLINEAR) {
 		ioctl(p->fd, PHONE_REC_STOP);
-		if (p->lastinput.audio[0] != AST_FORMAT_SLINEAR) {
-			p->lastinput.audio[0] = AST_FORMAT_SLINEAR;
+		if (p->lastinput.audio[0] != AST_FORMAT_AUDIO_SLINEAR) {
+			p->lastinput.audio[0] = AST_FORMAT_AUDIO_SLINEAR;
 			if (ioctl(p->fd, PHONE_REC_CODEC, LINEAR16)) {
 				ast_log(LOG_WARNING, "Failed to set codec to signed linear 16\n");
 				return -1;
 			}
 		}
-	} else if (ast->rawreadformat.audio[0] == AST_FORMAT_ULAW) {
+	} else if (ast->rawreadformat.audio[0] == AST_FORMAT_AUDIO_ULAW) {
 		ioctl(p->fd, PHONE_REC_STOP);
-		if (p->lastinput.audio[0] != AST_FORMAT_ULAW) {
-			p->lastinput.audio[0] = AST_FORMAT_ULAW;
+		if (p->lastinput.audio[0] != AST_FORMAT_AUDIO_ULAW) {
+			p->lastinput.audio[0] = AST_FORMAT_AUDIO_ULAW;
 			if (ioctl(p->fd, PHONE_REC_CODEC, ULAW)) {
 				ast_log(LOG_WARNING, "Failed to set codec to uLaw\n");
 				return -1;
@@ -601,7 +602,7 @@
 	p->fr.codec = p->lastinput;
 	p->fr.offset = AST_FRIENDLY_OFFSET;
 	/* Byteswap from little-endian to native-endian */
-	if (p->fr.codec.audio[0] == AST_FORMAT_SLINEAR)
+	if (p->fr.codec.audio[0] == AST_FORMAT_AUDIO_SLINEAR)
 		ast_frame_byteswap_le(&p->fr);
 	return &p->fr;
 }
@@ -663,10 +664,11 @@
 			ast_log(LOG_WARNING, "Don't know what to do with  frame type '%d'\n", frame->frametype);
 		return 0;
 	}
-	if (!(frame->subclass &
-		(AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW | AST_FORMAT_G729A)) && 
+	if (ast_extended_codec_not(ast_extended_codec_and(frame->codec, fullformat)) &&
 	    p->mode != MODE_FXS) {
-		ast_log(LOG_WARNING, "Cannot handle frames in %d format\n", frame->subclass);
+		struct ast_str *str = NULL;
+		ast_log(LOG_WARNING, "Cannot handle frames in %s format\n", ast_codec2bitstring(frame->codec, &str));
+		ast_free(str);
 		return -1;
 	}
 #if 0
@@ -681,8 +683,8 @@
 		return 0;
 	}
 #endif	
-	if (frame->codec.audio[0] == AST_FORMAT_G729A) {
-		if (p->lastformat.audio[0] != AST_FORMAT_G729A) {
+	if (frame->codec.audio[0] == AST_FORMAT_AUDIO_G729A) {
+		if (p->lastformat.audio[0] != AST_FORMAT_AUDIO_G729A) {
 			ioctl(p->fd, PHONE_PLAY_STOP);
 			ioctl(p->fd, PHONE_REC_STOP);
 			if (ioctl(p->fd, PHONE_PLAY_CODEC, G729)) {
@@ -693,8 +695,8 @@
 				ast_log(LOG_WARNING, "Unable to set G729 mode\n");
 				return -1;
 			}
-			p->lastformat.audio[0] = AST_FORMAT_G729A;
-			p->lastinput.audio[0] = AST_FORMAT_G729A;
+			p->lastformat.audio[0] = AST_FORMAT_AUDIO_G729A;
+			p->lastinput.audio[0] = AST_FORMAT_AUDIO_G729A;
 			/* Reset output buffer */
 			p->obuflen = 0;
 			codecset = 1;
@@ -704,8 +706,8 @@
 			return -1;
 		}
 		maxfr = 80;
-        } else if (frame->codec.audio[0] == AST_FORMAT_G723_1) {
-		if (p->lastformat.audio[0] != AST_FORMAT_G723_1) {
+        } else if (frame->codec.audio[0] == AST_FORMAT_AUDIO_G723_1) {
+		if (p->lastformat.audio[0] != AST_FORMAT_AUDIO_G723_1) {
 			ioctl(p->fd, PHONE_PLAY_STOP);
 			ioctl(p->fd, PHONE_REC_STOP);
 			if (ioctl(p->fd, PHONE_PLAY_CODEC, G723_63)) {
@@ -716,8 +718,8 @@
 				ast_log(LOG_WARNING, "Unable to set G723.1 mode\n");
 				return -1;
 			}
-			p->lastformat.audio[0] = AST_FORMAT_G723_1;
-			p->lastinput.audio[0] = AST_FORMAT_G723_1;
+			p->lastformat.audio[0] = AST_FORMAT_AUDIO_G723_1;
+			p->lastinput.audio[0] = AST_FORMAT_AUDIO_G723_1;
 			/* Reset output buffer */
 			p->obuflen = 0;
 			codecset = 1;
@@ -727,8 +729,8 @@
 			return -1;
 		}
 		maxfr = 24;
-	} else if (frame->codec.audio[0] == AST_FORMAT_SLINEAR) {
-		if (p->lastformat.audio[0] != AST_FORMAT_SLINEAR) {
+	} else if (frame->codec.audio[0] == AST_FORMAT_AUDIO_SLINEAR) {
+		if (p->lastformat.audio[0] != AST_FORMAT_AUDIO_SLINEAR) {
 			ioctl(p->fd, PHONE_PLAY_STOP);
 			ioctl(p->fd, PHONE_REC_STOP);
 			if (ioctl(p->fd, PHONE_PLAY_CODEC, LINEAR16)) {
@@ -739,15 +741,15 @@
 				ast_log(LOG_WARNING, "Unable to set 16-bit linear mode\n");
 				return -1;
 			}
-			p->lastformat.audio[0] = AST_FORMAT_SLINEAR;
-			p->lastinput.audio[0] = AST_FORMAT_SLINEAR;
+			p->lastformat.audio[0] = AST_FORMAT_AUDIO_SLINEAR;
+			p->lastinput.audio[0] = AST_FORMAT_AUDIO_SLINEAR;
 			codecset = 1;
 			/* Reset output buffer */
 			p->obuflen = 0;
 		}
 		maxfr = 480;
-	} else if (frame->codec.audio[0] == AST_FORMAT_ULAW) {
-		if (p->lastformat.audio[0] != AST_FORMAT_ULAW) {
+	} else if (frame->codec.audio[0] == AST_FORMAT_AUDIO_ULAW) {
+		if (p->lastformat.audio[0] != AST_FORMAT_AUDIO_ULAW) {
 			ioctl(p->fd, PHONE_PLAY_STOP);
 			ioctl(p->fd, PHONE_REC_STOP);
 			if (ioctl(p->fd, PHONE_PLAY_CODEC, ULAW)) {
@@ -758,8 +760,8 @@
 				ast_log(LOG_WARNING, "Unable to set uLaw mode\n");
 				return -1;
 			}
-			p->lastformat.audio[0] = AST_FORMAT_ULAW;
-			p->lastinput.audio[0] = AST_FORMAT_ULAW;
+			p->lastformat.audio[0] = AST_FORMAT_AUDIO_ULAW;
+			p->lastinput.audio[0] = AST_FORMAT_AUDIO_ULAW;
 			codecset = 1;
 			/* Reset output buffer */
 			p->obuflen = 0;
@@ -769,12 +771,12 @@
 		if (memcmp(&p->lastformat, &frame->codec, sizeof(frame->codec)) != 0) {
 			ioctl(p->fd, PHONE_PLAY_STOP);
 			ioctl(p->fd, PHONE_REC_STOP);
-			if (ioctl(p->fd, PHONE_PLAY_CODEC, frame->subclass)) {
+			if (ioctl(p->fd, PHONE_PLAY_CODEC, frame->codec.audio[0])) {
 				ast_log(LOG_WARNING, "Unable to set %d mode\n",
 					frame->subclass);
 				return -1;
 			}
-			if (ioctl(p->fd, PHONE_REC_CODEC, frame->subclass)) {
+			if (ioctl(p->fd, PHONE_REC_CODEC, frame->codec.audio[0])) {
 				ast_log(LOG_WARNING, "Unable to set %d mode\n",
 					frame->subclass);
 				return -1;
@@ -821,7 +823,7 @@
 		} else {
 			int swap = 0;
 #if __BYTE_ORDER == __BIG_ENDIAN
-			if (frame->subclass == AST_FORMAT_SLINEAR)
+			if (frame->codec.audio[0] == AST_FORMAT_AUDIO_SLINEAR)
 				swap = 1; /* Swap big-endian samples to little-endian as we copy */
 #endif
 			res = phone_write_buf(p, pos, expected, maxfr, swap);
@@ -852,7 +854,6 @@
 {
 	struct ast_channel *tmp;
 	struct phone_codec_data codec;
-	const struct ast_extended_codec slin = { { AST_FORMAT_SLINEAR, }, };
 	tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "", i->ext, i->context, 0, "Phone/%s", i->dev + 5);
 	if (tmp) {
 		tmp->tech = cur_tech;
@@ -864,12 +865,12 @@
 				tmp->nativeformats =
 				tmp->rawreadformat =
 				tmp->rawwriteformat =
-				slin;
+				AST_FMT_SLINEAR;
 			else {
 				tmp->nativeformats =
 				tmp->rawreadformat =
 				tmp->rawwriteformat =
-				ast_extended_codec_and(prefformat, ast_extended_codec_compl(slin));
+				ast_extended_codec_and(prefformat, ast_extended_codec_compl(AST_FMT_SLINEAR));
 			}
 		}
 		else {
@@ -1223,7 +1224,7 @@
 	struct phone_pvt *p;
 	struct ast_channel *tmp = NULL;
 	char *name = data;
-	const struct ast_extended_codec normal = { { AST_FORMAT_G729A | AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW }, };
+	const struct ast_extended_codec normal = fullformat;
 
 	/* Search for an unowned channel */
 	if (ast_mutex_lock(&iflock)) {
@@ -1409,20 +1410,20 @@
 		} else if (!strcasecmp(v->name, "format")) {
 			if (!strcasecmp(v->value, "g729")) {
 				memset(&prefformat, 0, sizeof(prefformat));
-				prefformat.audio[0] = AST_FORMAT_G729A;
+				prefformat.audio[0] = AST_FORMAT_AUDIO_G729A;
 			} else if (!strcasecmp(v->value, "g723.1")) {
 				memset(&prefformat, 0, sizeof(prefformat));
-				prefformat.audio[0] = AST_FORMAT_G723_1;
+				prefformat.audio[0] = AST_FORMAT_AUDIO_G723_1;
 			} else if (!strcasecmp(v->value, "slinear")) {
 				if (mode == MODE_FXS)
-				    prefformat.audio[0] |= AST_FORMAT_SLINEAR;
+				    prefformat.audio[0] |= AST_FORMAT_AUDIO_SLINEAR;
 				else {
 					memset(&prefformat, 0, sizeof(prefformat));
-					prefformat.audio[0] = AST_FORMAT_SLINEAR;
+					prefformat.audio[0] = AST_FORMAT_AUDIO_SLINEAR;
 				}
 			} else if (!strcasecmp(v->value, "ulaw")) {
 				memset(&prefformat, 0, sizeof(prefformat));
-				prefformat.audio[0] = AST_FORMAT_ULAW;
+				prefformat.audio[0] = AST_FORMAT_AUDIO_ULAW;
 			} else
 				ast_log(LOG_WARNING, "Unknown format '%s'\n", v->value);
 		} else if (!strcasecmp(v->name, "echocancel")) {

Modified: team/group/codec_bits/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/channels/chan_sip.c?view=diff&rev=108858&r1=108857&r2=108858
==============================================================================
--- team/group/codec_bits/channels/chan_sip.c (original)
+++ team/group/codec_bits/channels/chan_sip.c Fri Mar 14 16:57:29 2008
@@ -717,7 +717,7 @@
 
 
 /*! \brief Codecs that we support by default: */
-static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
+static struct ast_extended_codec global_capability = { { AST_FORMAT_AUDIO_ULAW | AST_FORMAT_AUDIO_ALAW | AST_FORMAT_AUDIO_GSM, }, { AST_FORMAT_VIDEO_H263, } };
 static enum st_mode global_st_mode;           /*!< Mode of operation for Session-Timers           */
 static enum st_refresher global_st_refresher; /*!< Session-Timer refresher                        */
 static int global_min_se;                     /*!< Lowest threshold for session refresh interval  */
@@ -1227,13 +1227,13 @@
 	unsigned int sipoptions;		/*!< Supported SIP options on the other end */
 	unsigned int reqsipoptions;		/*!< Required SIP options on the other end */
 	struct ast_codec_pref prefs;		/*!< codec prefs */
-	int capability;				/*!< Special capability (codec) */
-	int jointcapability;			/*!< Supported capability at both ends (codecs) */
-	int peercapability;			/*!< Supported peer capability */
-	int prefcodec;				/*!< Preferred codec (outbound only) */
+	struct ast_extended_codec capability;				/*!< Special capability (codec) */
+	struct ast_extended_codec jointcapability;			/*!< Supported capability at both ends (codecs) */
+	struct ast_extended_codec peercapability;			/*!< Supported peer capability */
+	struct ast_extended_codec prefcodec;				/*!< Preferred codec (outbound only) */
 	int noncodeccapability;			/*!< DTMF RFC2833 telephony-event */
 	int jointnoncodeccapability;            /*!< Joint Non codec capability */
-	int redircodecs;			/*!< Redirect codecs */
+	struct ast_extended_codec redircodecs;			/*!< Redirect codecs */
 	int maxcallbitrate;			/*!< Maximum Call Bitrate for Video Calls */	
 	struct sip_proxy *outboundproxy;	/*!< Outbound proxy for this dialog */
 	struct t38properties t38;		/*!< T38 settings */
@@ -1397,7 +1397,7 @@
 
 	int amaflags;			/*!< AMA flags for billing */
 	int callingpres;		/*!< Calling id presentation */
-	int capability;			/*!< Codec capability */
+	struct ast_extended_codec capability;			/*!< Codec capability */
 	int inUse;			/*!< Number of calls in use */
 	int call_limit;			/*!< Limit of concurrent calls */
 	enum transfermodes allowtransfer;	/*! SIP Refer restriction scheme */
@@ -1470,7 +1470,7 @@
 	char selfdestruct;		/*!< P: Automatic peers need to destruct themselves */
 
 	int expire;			/*!<  When to expire this peer registration */
-	int capability;			/*!<  Codec capability */
+	struct ast_extended_codec capability;			/*!<  Codec capability */
 	int rtptimeout;			/*!<  RTP timeout */
 	int rtpholdtimeout;		/*!<  RTP Hold Timeout */
 	int rtpkeepalive;		/*!<  Send RTP packets for keepalive */
@@ -1676,7 +1676,7 @@
 	in coming releases. */
 
 /*--- PBX interface functions */
-static struct ast_channel *sip_request_call(const char *type, int format, void *data, int *cause);
+static struct ast_channel *sip_request_call(const char *type, struct ast_extended_codec format, void *data, int *cause);
 static int sip_devicestate(void *data);
 static int sip_sendtext(struct ast_channel *ast, const char *text);
 static int sip_call(struct ast_channel *ast, char *dest, int timeout);
@@ -1764,7 +1764,7 @@
 static const char *get_sdp(struct sip_request *req, const char *name);
 static int find_sdp(struct sip_request *req);
 static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action);
-static void add_codec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate,
+static void add_codec_to_sdp(const struct sip_pvt *p, struct ast_extended_codec codec, int sample_rate,
 			     struct ast_str **m_buf, struct ast_str **a_buf,
 			     int debug, int *min_packet_size);
 static void add_noncodec_to_sdp(const struct sip_pvt *p, int format, int sample_rate,
@@ -1999,11 +1999,11 @@
 static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
 
 /*----- RTP interface functions */
-static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp,  struct ast_rtp *trtp, int codecs, int nat_active);
+static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp,  struct ast_rtp *trtp, struct ast_extended_codec codecs, int nat_active);
 static enum ast_rtp_get_result sip_get_rtp_peer(struct ast_channel *chan, struct ast_rtp **rtp);
 static enum ast_rtp_get_result sip_get_vrtp_peer(struct ast_channel *chan, struct ast_rtp **rtp);
 static enum ast_rtp_get_result sip_get_trtp_peer(struct ast_channel *chan, struct ast_rtp **rtp);
-static int sip_get_codec(struct ast_channel *chan);
+static struct ast_extended_codec sip_get_codec(struct ast_channel *chan);
 static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p, int *faxdetect);
 
 /*------ T38 Support --------- */
@@ -2032,7 +2032,7 @@
 static const struct ast_channel_tech sip_tech = {
 	.type = "SIP",
 	.description = "Session Initiation Protocol (SIP)",
-	.capabilities = AST_FORMAT_AUDIO_MASK,	/* all audio formats */
+	.capabilities = { { -1, -1, -1, -1, -1, -1, -1, -1 }, },	/* all audio formats */
 	.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
 	.requester = sip_request_call,			/* called with chan unlocked */
 	.devicestate = sip_devicestate,			/* called with chan unlocked (not chan-specific) */
@@ -3941,7 +3941,7 @@
 	ast_copy_flags(&dialog->flags[0], &peer->flags[0], SIP_FLAGS_TO_COPY);
 	ast_copy_flags(&dialog->flags[1], &peer->flags[1], SIP_PAGE2_FLAGS_TO_COPY);
 	dialog->capability = peer->capability;
-	if ((!ast_test_flag(&dialog->flags[1], SIP_PAGE2_VIDEOSUPPORT) || !(dialog->capability & AST_FORMAT_VIDEO_MASK)) && dialog->vrtp) {
+	if ((!ast_test_flag(&dialog->flags[1], SIP_PAGE2_VIDEOSUPPORT) || FMT_NOT(FMT_AND(dialog->capability, AST_FMT_VIDEO_MASK))) && dialog->vrtp) {
 		ast_rtp_destroy(dialog->vrtp);
 		dialog->vrtp = NULL;
 	}
@@ -4210,7 +4210,7 @@
 	p->jointnoncodeccapability = p->noncodeccapability;
 
 	/* If there are no audio formats left to offer, punt */
-	if (!(p->jointcapability & AST_FORMAT_AUDIO_MASK)) {
+	if (FMT_NOT(FMT_AND(p->jointcapability, AST_FMT_AUDIO_MASK))) {
 		ast_log(LOG_WARNING, "No audio format found to offer. Cancelling call to %s\n", p->username);
 		res = -1;
 	} else {
@@ -4845,7 +4845,7 @@
 /*! \brief Try setting codec suggested by the SIP_CODEC channel variable */
 static void try_suggested_sip_codec(struct sip_pvt *p)
 {
-	int fmt;
+	struct ast_extended_codec fmt;
 	const char *codec;
 
 	codec = pbx_builtin_getvar_helper(p->owner, "SIP_CODEC");
@@ -4853,11 +4853,11 @@
 		return;
 
 	fmt = ast_getformatbyname(codec);
-	if (fmt) {
+	if (FMT_NZ(fmt)) {
 		ast_log(LOG_NOTICE, "Changing codec to '%s' for this call because of ${SIP_CODEC} variable\n", codec);
-		if (p->jointcapability & fmt) {
-			p->jointcapability &= fmt;
-			p->capability &= fmt;
+		if (FMT_NZ(FMT_AND(p->jointcapability, fmt))) {
+			p->jointcapability = FMT_AND(p->jointcapability, fmt);
+			p->capability = FMT_AND(p->capability, fmt);
 		} else
 			ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because it is not shared by both ends.\n");
 	} else
@@ -4898,16 +4898,17 @@
 
 	switch (frame->frametype) {
 	case AST_FRAME_VOICE:
-		if (!(frame->subclass & ast->nativeformats)) {
+		if (FMT_NOT(FMT_AND(frame->codec, ast->nativeformats))) {
 			char s1[512], s2[512], s3[512];
-			ast_log(LOG_WARNING, "Asked to transmit frame type %d, while native formats is %s(%d) read/write = %s(%d)/%s(%d)\n",
-				frame->subclass, 
-				ast_getformatname_multiple(s1, sizeof(s1) - 1, ast->nativeformats & AST_FORMAT_AUDIO_MASK),
-				ast->nativeformats & AST_FORMAT_AUDIO_MASK,
+			struct ast_str *str1 = ast_str_alloca(128), *str2 = ast_str_alloca(128), *str3 = ast_str_alloca(128), *str4 = ast_str_alloca(128);
+			ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s(%s) read/write = %s(%s)/%s(%s)\n",
+				ast_codec2bitstring(frame->codec, &str1), 
+				ast_getformatname_multiple(s1, sizeof(s1) - 1, FMT_AND(ast->nativeformats, AST_FMT_AUDIO_MASK)),
+				ast_codec2bitstring(FMT_AND(ast->nativeformats, AST_FMT_AUDIO_MASK), &str2),
 				ast_getformatname_multiple(s2, sizeof(s2) - 1, ast->readformat),
-				ast->readformat,
+				ast_codec2bitstring(ast->readformat, &str3),
 				ast_getformatname_multiple(s3, sizeof(s3) - 1, ast->writeformat),
-				ast->writeformat);
+				ast_codec2bitstring(ast->writeformat, &str4));
 			return 0;
 		}
 		if (p) {
@@ -5216,10 +5217,7 @@
 {
 	struct ast_channel *tmp;
 	struct ast_variable *v = NULL;
-	int fmt;
-	int what;
-	int video;
-	int text;
+	struct ast_extended_codec fmt, what, video, text;
 	int needvideo = 0;
 	int needtext = 0;
 	char buf[SIPBUFSIZE];
@@ -5251,27 +5249,27 @@
 
 	/* Select our native format based on codec preference until we receive
 	   something from another device to the contrary. */
-	if (i->jointcapability) { 	/* The joint capabilities of us and peer */
+	if (FMT_NZ(i->jointcapability)) { 	/* The joint capabilities of us and peer */
 		what = i->jointcapability;
-		video = i->jointcapability & AST_FORMAT_VIDEO_MASK;
-		text = i->jointcapability & AST_FORMAT_TEXT_MASK;
-	} else if (i->capability) {		/* Our configured capability for this peer */
+		video = FMT_AND(i->jointcapability, AST_FMT_VIDEO_MASK);
+		text = FMT_AND(i->jointcapability, AST_FMT_TEXT_MASK);
+	} else if (FMT_NZ(i->capability)) {		/* Our configured capability for this peer */
 		what = i->capability;
-		video = i->capability & AST_FORMAT_VIDEO_MASK;
-		text = i->capability & AST_FORMAT_TEXT_MASK;
+		video = FMT_AND(i->capability, AST_FMT_VIDEO_MASK);
+		text = FMT_AND(i->capability, AST_FMT_TEXT_MASK);
 	} else {
 		what = global_capability;	/* Global codec support */
-		video = global_capability & AST_FORMAT_VIDEO_MASK;
-		text = global_capability & AST_FORMAT_TEXT_MASK;
+		video = FMT_AND(global_capability, AST_FMT_VIDEO_MASK);
+		text = FMT_AND(global_capability, AST_FMT_TEXT_MASK);
 	}
 
 	/* Set the native formats for audio  and merge in video */
-	tmp->nativeformats = ast_codec_choose(&i->prefs, what, NULL, 1) | video | text;
+	tmp->nativeformats = FMT_OR(ast_codec_choose(&i->prefs, what, 1), FMT_OR(video, text));
 	ast_debug(3, "*** Our native formats are %s \n", ast_getformatname_multiple(buf, SIPBUFSIZE, tmp->nativeformats));
 	ast_debug(3, "*** Joint capabilities are %s \n", ast_getformatname_multiple(buf, SIPBUFSIZE, i->jointcapability));
 	ast_debug(3, "*** Our capabilities are %s \n", ast_getformatname_multiple(buf, SIPBUFSIZE, i->capability));
-	ast_debug(3, "*** AST_CODEC_CHOOSE formats are %s \n", ast_getformatname_multiple(buf, SIPBUFSIZE, ast_codec_choose(&i->prefs, what, NULL, 1)));
-	if (i->prefcodec)
+	ast_debug(3, "*** AST_CODEC_CHOOSE formats are %s \n", ast_getformatname_multiple(buf, SIPBUFSIZE, ast_codec_choose(&i->prefs, what, 1)));
+	if (FMT_NZ(i->prefcodec))
 		ast_debug(3, "*** Our preferred formats from the incoming channel are %s \n", ast_getformatname_multiple(buf, SIPBUFSIZE, i->prefcodec));
 
 	/* XXX Why are we choosing a codec from the native formats?? */
@@ -5282,17 +5280,17 @@
 	   We also check for vrtp. If it's not there, we are not allowed do any video anyway.
 	 */
 	if (i->vrtp) {
-		if (i->prefcodec)
-			needvideo = i->prefcodec & AST_FORMAT_VIDEO_MASK;	/* Outbound call */
+		if (FMT_NZ(i->prefcodec))
+			needvideo = FMT_NZ(FMT_AND(i->prefcodec, AST_FMT_VIDEO_MASK));	/* Outbound call */
  		else
-			needvideo = i->jointcapability & AST_FORMAT_VIDEO_MASK;	/* Inbound call */
+			needvideo = FMT_NZ(FMT_AND(i->jointcapability, AST_FMT_VIDEO_MASK));	/* Inbound call */
 	}
 
 	if (i->trtp) {
-		if (i->prefcodec)
-			needtext = i->prefcodec & AST_FORMAT_TEXT_MASK;	/* Outbound call */
+		if (FMT_NZ(i->prefcodec))
+			needtext = FMT_NZ(FMT_AND(i->prefcodec, AST_FMT_TEXT_MASK));	/* Outbound call */
  		else
-			needtext = i->jointcapability & AST_FORMAT_TEXT_MASK;	/* Inbound call */
+			needtext = FMT_NZ(FMT_AND(i->jointcapability, AST_FMT_TEXT_MASK));	/* Inbound call */
 	}
 
 	if (needvideo) 
@@ -5582,15 +5580,15 @@
 	if (!p->owner || (f && f->frametype != AST_FRAME_VOICE))
 		return f;
 
-	if (f && f->subclass != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
-		if (!(f->subclass & p->jointcapability)) {
+	if (f && !FMT_EQ(f->codec, FMT_AND(p->owner->nativeformats, AST_FMT_AUDIO_MASK))) {
+		if (FMT_NOT(FMT_AND(f->codec, p->jointcapability))) {
 			ast_debug(1, "Bogus frame of format '%s' received from '%s'!\n",
-				ast_getformatname(f->subclass), p->owner->name);
+				ast_getformatname(f->codec), p->owner->name);
 			return &ast_null_frame;
 		}
-		ast_debug(1, "Oooh, format changed to %d %s\n",
-			f->subclass, ast_getformatname(f->subclass));
-		p->owner->nativeformats = (p->owner->nativeformats & (AST_FORMAT_VIDEO_MASK | AST_FORMAT_TEXT_MASK)) | f->subclass;
+		ast_debug(1, "Oooh, format changed to %s\n",
+			ast_getformatname(f->codec));
+		p->owner->nativeformats = FMT_OR(FMT_AND(p->owner->nativeformats, FMT_OR(AST_FMT_VIDEO_MASK, AST_FMT_TEXT_MASK)), f->codec);
 		ast_set_read_format(p->owner, p->owner->readformat);
 		ast_set_write_format(p->owner, p->owner->writeformat);
 	}
@@ -6308,9 +6306,8 @@
 	int old = 0;
 
 	/* Peer capability is the capability in the SDP, non codec is RFC2833 DTMF (101) */	
-	int peercapability = 0, peernoncodeccapability = 0;
-	int vpeercapability = 0, vpeernoncodeccapability = 0;
-	int tpeercapability = 0, tpeernoncodeccapability = 0;
+	struct ast_extended_codec peercapability = AST_FMT_NULL_MASK, vpeercapability = AST_FMT_NULL_MASK, tpeercapability = AST_FMT_NULL_MASK;
+	int peernoncodeccapability = 0, vpeernoncodeccapability = 0, tpeernoncodeccapability = 0;
 	struct sockaddr_in sin;		/*!< media socket address */
 	struct sockaddr_in vsin;	/*!< Video socket address */
 	struct sockaddr_in tsin;	/*!< Text socket address */
@@ -6328,12 +6325,12 @@
 	int sendonly = -1;
 	int numberofports;
 	struct ast_rtp *newaudiortp, *newvideortp, *newtextrtp;	/* Buffers for codec handling */
-	int newjointcapability;				/* Negotiated capability */
-	int newpeercapability;
+	struct ast_extended_codec newjointcapability;				/* Negotiated capability */
+	struct ast_extended_codec newpeercapability;
 	int newnoncodeccapability;
 	int numberofmediastreams = 0;
 	int debug = sip_debug_test_pvt(p);
-		
+
 	int found_rtpmap_codecs[32];
 	int last_rtpmap_codec=0;
 
@@ -6667,13 +6664,15 @@
 				if (p->autoframing) {
 					struct ast_codec_pref *pref = ast_rtp_codec_getpref(p->rtp);
 					int codec_n;
-					int format = 0;
+					struct ast_extended_codec format;
+					struct ast_str *str = NULL;
 					for (codec_n = 0; codec_n < last_rtpmap_codec; codec_n++) {
 						format = ast_rtp_codec_getformat(found_rtpmap_codecs[codec_n]);
-						if (!format)	/* non-codec or not found */
+						if (FMT_NOT(format))	/* non-codec or not found */
 							continue;
-						ast_debug(1, "Setting framing for %d to %ld\n", format, framing);
-						ast_codec_pref_setsize(pref, format, NULL, framing);
+						ast_debug(1, "Setting framing for '%s' to %ld\n", ast_codec2bitstring(format, &str), framing);
+						ast_free(str);
+						ast_codec_pref_setsize(pref, format, framing);
 					}
 					ast_rtp_codec_setpref(p->rtp, pref);
 				}
@@ -6835,11 +6834,10 @@
 	ast_rtp_get_current_formats(newvideortp, &vpeercapability, &vpeernoncodeccapability);
 	ast_rtp_get_current_formats(newtextrtp, &tpeercapability, &tpeernoncodeccapability);
  
-	newjointcapability = p->capability & (peercapability | vpeercapability | tpeercapability);
-	newpeercapability = (peercapability | vpeercapability | tpeercapability);
+	newpeercapability = FMT_OR(peercapability, FMT_OR(vpeercapability, tpeercapability));
+	newjointcapability = FMT_AND(p->capability, newpeercapability);
 	newnoncodeccapability = p->noncodeccapability & peernoncodeccapability;
-		
-		
+
 	if (debug) {
 		/* shame on whoever coded this.... */
 		char s1[SIPBUFSIZE], s2[SIPBUFSIZE], s3[SIPBUFSIZE], s4[SIPBUFSIZE], s5[SIPBUFSIZE];
@@ -6856,7 +6854,7 @@
 			    ast_rtp_lookup_mime_multiple(s2, SIPBUFSIZE, peernoncodeccapability, 0, 0),
 			    ast_rtp_lookup_mime_multiple(s3, SIPBUFSIZE, newnoncodeccapability, 0, 0));
 	}
-	if (!newjointcapability) {
+	if (FMT_NOT(newjointcapability)) {
 		/* If T.38 was not negotiated either, totally bail out... */
 		if (!p->t38.jointcapability || !p->t38.peercapability) {
 			ast_log(LOG_NOTICE, "No compatible codecs, not accepting this offer!\n");
@@ -6922,18 +6920,19 @@
 
 	ast_debug(4, "We have an owner, now see if we need to change this call\n");
 
-	if (!(p->owner->nativeformats & p->jointcapability) && (p->jointcapability & AST_FORMAT_AUDIO_MASK)) {
+	if (FMT_NOT(FMT_AND(p->owner->nativeformats, p->jointcapability)) && FMT_NZ(FMT_AND(p->jointcapability, AST_FMT_AUDIO_MASK))) {
 		if (debug) {
 			char s1[SIPBUFSIZE], s2[SIPBUFSIZE];
 			ast_debug(1, "Oooh, we need to change our audio formats since our peer supports only %s and not %s\n", 
 				ast_getformatname_multiple(s1, SIPBUFSIZE, p->jointcapability),
 				ast_getformatname_multiple(s2, SIPBUFSIZE, p->owner->nativeformats));
 		}
-		p->owner->nativeformats = ast_codec_choose(&p->prefs, p->jointcapability, NULL, 1) | (p->capability & vpeercapability) | (p->capability & tpeercapability);
+		p->owner->nativeformats = FMT_OR(ast_codec_choose(&p->prefs, p->jointcapability, 1),
+			FMT_AND(p->capability, FMT_OR(vpeercapability, tpeercapability)));
 		ast_set_read_format(p->owner, p->owner->readformat);
 		ast_set_write_format(p->owner, p->owner->writeformat);
 	}
-	
+
 	if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) && sin.sin_addr.s_addr && (!sendonly || sendonly == -1)) {
 		ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
 		/* Activate a re-invite */
@@ -7701,7 +7700,7 @@
 }
 
 /*! \brief Add codec offer to SDP offer/answer body in INVITE or 200 OK */
-static void add_codec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate,
+static void add_codec_to_sdp(const struct sip_pvt *p, struct ast_extended_codec codec, int sample_rate,
 			     struct ast_str **m_buf, struct ast_str **a_buf,
 			     int debug, int *min_packet_size)
 {
@@ -7710,27 +7709,27 @@
 
 
 	if (debug)
-		ast_verbose("Adding codec 0x%x (%s) to SDP\n", codec, ast_getformatname(codec));
-	if ((rtp_code = ast_rtp_lookup_code(p->rtp, 1, codec)) == -1)
+		ast_verbose("Adding codec '%s' to SDP\n", ast_getformatname(codec));
+	if ((rtp_code = ast_rtp_lookup_codec(p->rtp, 1, codec)) == -1)
 		return;
 
 	if (p->rtp) {
 		struct ast_codec_pref *pref = ast_rtp_codec_getpref(p->rtp);
-		fmt = ast_codec_pref_getsize(pref, codec, NULL);
+		fmt = ast_codec_pref_getsize(pref, codec);
 	} else /* I dont see how you couldn't have p->rtp, but good to check for and error out if not there like earlier code */
 		return;
 	ast_str_append(m_buf, 0, " %d", rtp_code);
 	ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d\r\n", rtp_code,
-			 ast_rtp_lookup_mime_subtype(1, codec,
+			 ast_rtp_lookup_codec_mime_subtype(codec,
 						     ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0),
 			 sample_rate);
-	if (codec == AST_FORMAT_G729A) {
+	if (codec.audio[0] == AST_FORMAT_AUDIO_G729A) {
 		/* Indicate that we don't support VAD (G.729 annex B) */
 		ast_str_append(a_buf, 0, "a=fmtp:%d annexb=no\r\n", rtp_code);
-	} else if (codec == AST_FORMAT_G723_1) {
+	} else if (codec.audio[0] == AST_FORMAT_AUDIO_G723_1) {
 		/* Indicate that we don't support VAD (G.723.1 annex A) */
 		ast_str_append(a_buf, 0, "a=fmtp:%d annexa=no\r\n", rtp_code);
-	} else if (codec == AST_FORMAT_ILBC) {
+	} else if (codec.audio[0] == AST_FORMAT_AUDIO_ILBC) {
 		/* Add information about us using only 20/30 ms packetization */
 		ast_str_append(a_buf, 0, "a=fmtp:%d mode=%d\r\n", rtp_code, fmt.cur_ms);
 	}
@@ -7745,7 +7744,7 @@
 
 /*! \brief Add video codec offer to SDP offer/answer body in INVITE or 200 OK */
 /* This is different to the audio one now so we can add more caps later */
-static void add_vcodec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate,
+static void add_vcodec_to_sdp(const struct sip_pvt *p, struct ast_extended_codec codec, int sample_rate,
 			     struct ast_str **m_buf, struct ast_str **a_buf,
 			     int debug, int *min_packet_size)
 {
@@ -7755,19 +7754,19 @@
 		return;
 
 	if (debug)
-		ast_verbose("Adding video codec 0x%x (%s) to SDP\n", codec, ast_getformatname(codec));
-
-	if ((rtp_code = ast_rtp_lookup_code(p->vrtp, 1, codec)) == -1)
+		ast_verbose("Adding video codec '%s' to SDP\n", ast_getformatname(codec));
+
+	if ((rtp_code = ast_rtp_lookup_codec(p->vrtp, 1, codec)) == -1)
 		return;
 
 	ast_str_append(m_buf, 0, " %d", rtp_code);
 	ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d\r\n", rtp_code,
-			 ast_rtp_lookup_mime_subtype(1, codec, 0), sample_rate);
+			 ast_rtp_lookup_codec_mime_subtype(codec, 0), sample_rate);
 	/* Add fmtp code here */
 }
 
 /*! \brief Add text codec offer to SDP offer/answer body in INVITE or 200 OK */
-static void add_tcodec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate,
+static void add_tcodec_to_sdp(const struct sip_pvt *p, struct ast_extended_codec codec, int sample_rate,
 			     struct ast_str **m_buf, struct ast_str **a_buf,
 			     int debug, int *min_packet_size)
 {
@@ -7777,14 +7776,14 @@
 		return;
 
 	if (debug)
-		ast_verbose("Adding text codec 0x%x (%s) to SDP\n", codec, ast_getformatname(codec));
-
-	if ((rtp_code = ast_rtp_lookup_code(p->trtp, 1, codec)) == -1)
+		ast_verbose("Adding text codec '%s' to SDP\n", ast_getformatname(codec));
+
+	if ((rtp_code = ast_rtp_lookup_codec(p->trtp, 1, codec)) == -1)
 		return;
 
 	ast_str_append(m_buf, 0, " %d", rtp_code);
 	ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d\r\n", rtp_code,
-			 ast_rtp_lookup_mime_subtype(1, codec, 0), sample_rate);
+			 ast_rtp_lookup_codec_mime_subtype(codec, 0), sample_rate);
 	/* Add fmtp code here */
 }
 
@@ -7909,13 +7908,13 @@
 	int rtp_code;
 
 	if (debug)
-		ast_verbose("Adding non-codec 0x%x (%s) to SDP\n", format, ast_rtp_lookup_mime_subtype(0, format, 0));
+		ast_verbose("Adding non-codec 0x%x (%s) to SDP\n", format, ast_rtp_lookup_noncodec_mime_subtype(format, 0));
 	if ((rtp_code = ast_rtp_lookup_code(p->rtp, 0, format)) == -1)
 		return;
 
 	ast_str_append(m_buf, 0, " %d", rtp_code);
 	ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d\r\n", rtp_code,

[... 614 lines stripped ...]



More information about the asterisk-commits mailing list