[asterisk-commits] tilghman: branch tilghman/codec_bits3 r225350 - /team/tilghman/codec_bits3/ch...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 22 00:08:38 CDT 2009


Author: tilghman
Date: Thu Oct 22 00:08:32 2009
New Revision: 225350

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=225350
Log:
Still nowhere near done, but commit day's work

Modified:
    team/tilghman/codec_bits3/channels/chan_alsa.c
    team/tilghman/codec_bits3/channels/chan_console.c
    team/tilghman/codec_bits3/channels/chan_dahdi.c
    team/tilghman/codec_bits3/channels/chan_gtalk.c
    team/tilghman/codec_bits3/channels/chan_jingle.c
    team/tilghman/codec_bits3/channels/chan_mgcp.c
    team/tilghman/codec_bits3/channels/chan_misdn.c
    team/tilghman/codec_bits3/channels/chan_multicast_rtp.c
    team/tilghman/codec_bits3/channels/chan_oss.c
    team/tilghman/codec_bits3/channels/chan_phone.c
    team/tilghman/codec_bits3/channels/chan_sip.c
    team/tilghman/codec_bits3/channels/sig_analog.c

Modified: team/tilghman/codec_bits3/channels/chan_alsa.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_alsa.c?view=diff&rev=225350&r1=225349&r2=225350
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_alsa.c (original)
+++ team/tilghman/codec_bits3/channels/chan_alsa.c Thu Oct 22 00:08:32 2009
@@ -130,7 +130,7 @@
 
 static int autoanswer = 1;
 
-static struct ast_channel *alsa_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
+static struct ast_channel *alsa_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
 static int alsa_digit(struct ast_channel *c, char digit, unsigned int duration);
 static int alsa_text(struct ast_channel *c, const char *text);
 static int alsa_hangup(struct ast_channel *c);
@@ -565,13 +565,14 @@
 	return tmp;
 }
 
-static struct ast_channel *alsa_request(const char *type, int fmt, const struct ast_channel *requestor, void *data, int *cause)
-{
-	int oldformat = fmt;
+static struct ast_channel *alsa_request(const char *type, format_t fmt, const struct ast_channel *requestor, void *data, int *cause)
+{
+	format_t oldformat = fmt;
+	char buf[256];
 	struct ast_channel *tmp = NULL;
 
 	if (!(fmt &= AST_FORMAT_SLINEAR)) {
-		ast_log(LOG_NOTICE, "Asked to get a channel of format '%d'\n", oldformat);
+		ast_log(LOG_NOTICE, "Asked to get a channel of format '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), oldformat));
 		return NULL;
 	}
 

Modified: team/tilghman/codec_bits3/channels/chan_console.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_console.c?view=diff&rev=225350&r1=225349&r2=225350
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_console.c (original)
+++ team/tilghman/codec_bits3/channels/chan_console.c Thu Oct 22 00:08:32 2009
@@ -182,7 +182,7 @@
 static struct ast_jb_conf global_jbconf;
 
 /*! Channel Technology Callbacks @{ */
-static struct ast_channel *console_request(const char *type, int format,
+static struct ast_channel *console_request(const char *type, format_t format,
 	const struct ast_channel *requestor, void *data, int *cause);
 static int console_digit_begin(struct ast_channel *c, char digit);
 static int console_digit_end(struct ast_channel *c, char digit, unsigned int duration);
@@ -440,11 +440,12 @@
 	return chan;
 }
 
-static struct ast_channel *console_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
-{
-	int oldformat = format;
+static struct ast_channel *console_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
+{
+	format_t oldformat = format;
 	struct ast_channel *chan = NULL;
 	struct console_pvt *pvt;
+	char buf[512];
 
 	if (!(pvt = find_pvt(data))) {
 		ast_log(LOG_ERROR, "Console device '%s' not found\n", (char *) data);
@@ -453,7 +454,7 @@
 
 	format &= SUPPORTED_FORMATS;
 	if (!format) {
-		ast_log(LOG_NOTICE, "Channel requested with unsupported format(s): '%d'\n", oldformat);
+		ast_log(LOG_NOTICE, "Channel requested with unsupported format(s): '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), oldformat));
 		goto return_unref;
 	}
 

Modified: team/tilghman/codec_bits3/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_dahdi.c?view=diff&rev=225350&r1=225349&r2=225350
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_dahdi.c (original)
+++ team/tilghman/codec_bits3/channels/chan_dahdi.c Thu Oct 22 00:08:32 2009
@@ -1412,7 +1412,7 @@
 }
 
 
-static struct ast_channel *dahdi_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
+static struct ast_channel *dahdi_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
 static int dahdi_digit_begin(struct ast_channel *ast, char digit);
 static int dahdi_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
 static int dahdi_sendtext(struct ast_channel *c, const char *text);
@@ -1937,7 +1937,7 @@
 	struct dahdi_pvt *p = pvt;
 	int idx = analogsub_to_dahdisub(analog_index);
 
-	ast_debug(1, "DTMF digit: %c on %s\n", f->subclass, ast->name);
+	ast_debug(1, "DTMF digit: %c on %s\n", (int) f->subclass, ast->name);
 
 	if (f->subclass == 'f') {
 		/* Fax tone -- Handle and return NULL */
@@ -6630,7 +6630,7 @@
 	struct dahdi_pvt *p = ast->tech_pvt;
 	struct ast_frame *f = *dest;
 
-	ast_debug(1, "DTMF digit: %c on %s\n", f->subclass, ast->name);
+	ast_debug(1, "DTMF digit: %c on %s\n", (int) f->subclass, ast->name);
 
 	if (p->confirmanswer) {
 		ast_debug(1, "Confirm answer on %s!\n", ast->name);
@@ -8084,6 +8084,7 @@
 static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame)
 {
 	struct dahdi_pvt *p = ast->tech_pvt;
+	char buf[256];
 	int res;
 	int idx;
 	idx = dahdi_get_index(ast, p, 0);
@@ -8101,7 +8102,7 @@
 	if ((frame->subclass != AST_FORMAT_SLINEAR) &&
 		(frame->subclass != AST_FORMAT_ULAW) &&
 		(frame->subclass != AST_FORMAT_ALAW)) {
-		ast_log(LOG_WARNING, "Cannot handle frames in %d format\n", frame->subclass);
+		ast_log(LOG_WARNING, "Cannot handle frames in %s format\n", ast_getformatname_multiple(buf, sizeof(buf), frame->subclass));
 		return -1;
 	}
 	if (p->dialing) {
@@ -9172,7 +9173,7 @@
 						break;
 					if (f->frametype == AST_FRAME_DTMF) {
 						dtmfbuf[k++] = f->subclass;
-						ast_debug(1, "CID got digit '%c'\n", f->subclass);
+						ast_debug(1, "CID got digit '%c'\n", (int) f->subclass);
 						res = 2000;
 					}
 					ast_frfree(f);
@@ -9409,8 +9410,8 @@
 					}
 					f = ast_read(chan);
 					if (f->frametype == AST_FRAME_DTMF) {
-						dtmfbuf[k++] = f->subclass;
-						ast_log(LOG_DEBUG, "CID got digit '%c'\n", f->subclass);
+						dtmfbuf[k++] = (int) f->subclass;
+						ast_log(LOG_DEBUG, "CID got digit '%c'\n", (int) f->subclass);
 						res = 2000;
 					}
 					ast_frfree(f);
@@ -11633,7 +11634,7 @@
 	return p;
 }
 
-static struct ast_channel *dahdi_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
+static struct ast_channel *dahdi_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	ast_group_t groupmatch = 0;
 	int channelmatch = -1;

Modified: team/tilghman/codec_bits3/channels/chan_gtalk.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_gtalk.c?view=diff&rev=225350&r1=225349&r2=225350
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_gtalk.c (original)
+++ team/tilghman/codec_bits3/channels/chan_gtalk.c Thu Oct 22 00:08:32 2009
@@ -115,8 +115,8 @@
 	struct ast_channel *owner;       /*!< Master Channel */
 	struct ast_rtp_instance *rtp;             /*!< RTP audio session */
 	struct ast_rtp_instance *vrtp;            /*!< RTP video session */
-	int jointcapability;             /*!< Supported capability at both ends (codecs ) */
-	int peercapability;
+	format_t jointcapability;             /*!< Supported capability at both ends (codecs ) */
+	format_t peercapability;
 	struct gtalk_pvt *next;	/* Next entity */
 };
 
@@ -146,7 +146,7 @@
 	char context[AST_MAX_CONTEXT];
 	char parkinglot[AST_MAX_CONTEXT];	/*!<  Parkinglot */
 	char accountcode[AST_MAX_ACCOUNT_CODE];	/*!< Account code */
-	int capability;
+	format_t capability;
 	ast_group_t callgroup;	/*!< Call group */
 	ast_group_t pickupgroup;	/*!< Pickup group */
 	int callingpres;		/*!< Calling presentation */
@@ -161,12 +161,12 @@
 
 static const char desc[] = "Gtalk Channel";
 
-static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
+static format_t global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
 
 AST_MUTEX_DEFINE_STATIC(gtalklock); /*!< Protect the interface list (of gtalk_pvt's) */
 
 /* Forward declarations */
-static struct ast_channel *gtalk_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
+static struct ast_channel *gtalk_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
 static int gtalk_digit(struct ast_channel *ast, char digit, unsigned int duration);
 static int gtalk_sendtext(struct ast_channel *ast, const char *text);
 static int gtalk_digit_begin(struct ast_channel *ast, char digit);
@@ -393,7 +393,7 @@
 	iks_insert_attrib(dcodecs, "xmlns", "http://www.google.com/session/phone");
 	iks_insert_attrib(dcodecs, "xml:lang", "en");
 
-	for (x = 0; x < 32; x++) {
+	for (x = 0; x < 64; x++) {
 		if (!(pref_codec = ast_codec_pref_index(&client->prefs, x)))
 			break;
 		if (!(client->capability & pref_codec))
@@ -532,13 +532,13 @@
 	return res;
 }
 
-static int gtalk_get_codec(struct ast_channel *chan)
+static format_t gtalk_get_codec(struct ast_channel *chan)
 {
 	struct gtalk_pvt *p = chan->tech_pvt;
 	return p->peercapability;
 }
 
-static int gtalk_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, int codecs, int nat_active)
+static int gtalk_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, format_t codecs, int nat_active)
 {
 	struct gtalk_pvt *p;
 
@@ -703,17 +703,17 @@
 					struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
 					f.subclass = dtmf[0];
 					ast_queue_frame(tmp->owner, &f);
-					ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
+					ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass);
 				} else if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-down")) {
 					struct ast_frame f = {AST_FRAME_DTMF_END, };
 					f.subclass = dtmf[0];
 					ast_queue_frame(tmp->owner, &f);
-					ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
+					ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass);
 				} else if(iks_find_attrib(pak->x, "dtmf")) { /* 250 millasecond default */
 					struct ast_frame f = {AST_FRAME_DTMF, };
 					f.subclass = dtmf[0];
 					ast_queue_frame(tmp->owner, &f);
-					ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
+					ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass);
 				}
 			}
 		} else if ((dtmfnode = iks_find_with_attrib(pak->x, "gtalk", "action", "session-info"))) {
@@ -723,12 +723,12 @@
 						struct ast_frame f = {AST_FRAME_DTMF_END, };
 						f.subclass = dtmf[0];
 						ast_queue_frame(tmp->owner, &f);
-						ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
+						ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass);
 					} else if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) {
 						struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
 						f.subclass = dtmf[0];
 						ast_queue_frame(tmp->owner, &f);
-						ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
+						ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass);
 					}
 				}
 			}
@@ -1396,7 +1396,7 @@
 		/* We already hold the channel lock */
 		if (f->frametype == AST_FRAME_VOICE) {
 			if (f->subclass != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
-				ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
+				ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass));
 				p->owner->nativeformats =
 					(p->owner->nativeformats & AST_FORMAT_VIDEO_MASK) | f->subclass;
 				ast_set_read_format(p->owner, p->owner->readformat);
@@ -1428,14 +1428,17 @@
 {
 	struct gtalk_pvt *p = ast->tech_pvt;
 	int res = 0;
+	char buf[256];
 
 	switch (frame->frametype) {
 	case AST_FRAME_VOICE:
 		if (!(frame->subclass & ast->nativeformats)) {
 			ast_log(LOG_WARNING,
-					"Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n",
-					frame->subclass, ast->nativeformats, ast->readformat,
-					ast->writeformat);
+					"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
+					ast_getformatname(frame->subclass),
+					ast_getformatname_multiple(buf, sizeof(buf), ast->nativeformats),
+					ast_getformatname(ast->readformat),
+					ast_getformatname(ast->writeformat));
 			return 0;
 		}
 		if (p) {
@@ -1655,7 +1658,7 @@
 }
 
 /*! \brief Part of PBX interface */
-static struct ast_channel *gtalk_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
+static struct ast_channel *gtalk_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	struct gtalk_pvt *p = NULL;
 	struct gtalk *client = NULL;

Modified: team/tilghman/codec_bits3/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_jingle.c?view=diff&rev=225350&r1=225349&r2=225350
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_jingle.c (original)
+++ team/tilghman/codec_bits3/channels/chan_jingle.c Thu Oct 22 00:08:32 2009
@@ -103,7 +103,7 @@
 	iksrule *ringrule;               /*!< Rule for matching RING request */
 	int initiator;                   /*!< If we're the initiator */
 	int alreadygone;
-	int capability;
+	format_t capability;
 	struct ast_codec_pref prefs;
 	struct jingle_candidate *theircandidates;
 	struct jingle_candidate *ourcandidates;
@@ -115,8 +115,8 @@
 	struct ast_rtp_instance *rtp;             /*!< RTP audio session */
 	char video_content_name[100];    /*!< name attribute of content tag */
 	struct ast_rtp_instance *vrtp;            /*!< RTP video session */
-	int jointcapability;             /*!< Supported capability at both ends (codecs ) */
-	int peercapability;
+	format_t jointcapability;             /*!< Supported capability at both ends (codecs ) */
+	format_t peercapability;
 	struct jingle_pvt *next;	/* Next entity */
 };
 
@@ -146,7 +146,7 @@
 	char user[100];
 	char context[100];
 	char accountcode[AST_MAX_ACCOUNT_CODE];	/*!< Account code */
-	int capability;
+	format_t capability;
 	ast_group_t callgroup;	/*!< Call group */
 	ast_group_t pickupgroup;	/*!< Pickup group */
 	int callingpres;		/*!< Calling presentation */
@@ -163,12 +163,12 @@
 static const char desc[] = "Jingle Channel";
 static const char channel_type[] = "Jingle";
 
-static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
+static format_t global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
 
 AST_MUTEX_DEFINE_STATIC(jinglelock); /*!< Protect the interface list (of jingle_pvt's) */
 
 /* Forward declarations */
-static struct ast_channel *jingle_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
+static struct ast_channel *jingle_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
 static int jingle_sendtext(struct ast_channel *ast, const char *text);
 static int jingle_digit_begin(struct ast_channel *ast, char digit);
 static int jingle_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
@@ -300,7 +300,7 @@
 	struct aji_client *c = client->connection;
 	iks *iq, *jingle, *dcodecs, *payload_red, *payload_audio, *payload_cn;
 	int x;
-	int pref_codec = 0;
+	format_t pref_codec = 0;
 	int alreadysent = 0;
 
 	if (p->initiator)
@@ -312,7 +312,7 @@
 	if (iq && jingle && dcodecs) {
 		iks_insert_attrib(dcodecs, "xmlns", JINGLE_AUDIO_RTP_NS);
 
-		for (x = 0; x < 32; x++) {
+		for (x = 0; x < 64; x++) {
 			if (!(pref_codec = ast_codec_pref_index(&client->prefs, x)))
 				break;
 			if (!(client->capability & pref_codec))
@@ -404,13 +404,13 @@
 	return res;
 }
 
-static int jingle_get_codec(struct ast_channel *chan)
+static format_t jingle_get_codec(struct ast_channel *chan)
 {
 	struct jingle_pvt *p = chan->tech_pvt;
 	return p->peercapability;
 }
 
-static int jingle_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *tpeer, int codecs, int nat_active)
+static int jingle_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *tpeer, format_t codecs, int nat_active)
 {
 	struct jingle_pvt *p;
 
@@ -513,17 +513,17 @@
 					struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
 					f.subclass = dtmf[0];
 					ast_queue_frame(tmp->owner, &f);
-					ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
+					ast_verbose("JINGLE! DTMF-relay event received: %c\n", (int) f.subclass);
 				} else if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-down")) {
 					struct ast_frame f = {AST_FRAME_DTMF_END, };
 					f.subclass = dtmf[0];
 					ast_queue_frame(tmp->owner, &f);
-					ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
+					ast_verbose("JINGLE! DTMF-relay event received: %c\n", (int) f.subclass);
 				} else if(iks_find_attrib(pak->x, "dtmf")) { /* 250 millasecond default */
 					struct ast_frame f = {AST_FRAME_DTMF, };
 					f.subclass = dtmf[0];
 					ast_queue_frame(tmp->owner, &f);
-					ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
+					ast_verbose("JINGLE! DTMF-relay event received: %c\n", (int) f.subclass);
 				}
 			}
 		} else if ((dtmfnode = iks_find_with_attrib(pak->x, JINGLE_NODE, "action", "session-info"))) {
@@ -533,12 +533,12 @@
 						struct ast_frame f = {AST_FRAME_DTMF_END, };
 						f.subclass = dtmf[0];
 						ast_queue_frame(tmp->owner, &f);
-						ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
+						ast_verbose("JINGLE! DTMF-relay event received: %c\n", (int) f.subclass);
 					} else if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) {
 						struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
 						f.subclass = dtmf[0];
 						ast_queue_frame(tmp->owner, &f);
-						ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
+						ast_verbose("JINGLE! DTMF-relay event received: %c\n", (int) f.subclass);
 					}
 				}
 			}
@@ -1170,7 +1170,7 @@
 		/* We already hold the channel lock */
 		if (f->frametype == AST_FRAME_VOICE) {
 			if (f->subclass != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
-				ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
+				ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass));
 				p->owner->nativeformats =
 					(p->owner->nativeformats & AST_FORMAT_VIDEO_MASK) | f->subclass;
 				ast_set_read_format(p->owner, p->owner->readformat);
@@ -1202,14 +1202,17 @@
 {
 	struct jingle_pvt *p = ast->tech_pvt;
 	int res = 0;
+	char buf[256];
 
 	switch (frame->frametype) {
 	case AST_FRAME_VOICE:
 		if (!(frame->subclass & ast->nativeformats)) {
 			ast_log(LOG_WARNING,
-					"Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n",
-					frame->subclass, ast->nativeformats, ast->readformat,
-					ast->writeformat);
+					"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
+					ast_getformatname(frame->subclass),
+					ast_getformatname_multiple(buf, sizeof(buf), ast->nativeformats),
+					ast_getformatname(ast->readformat),
+					ast_getformatname(ast->writeformat));
 			return 0;
 		}
 		if (p) {
@@ -1479,7 +1482,7 @@
 }
 
 /*! \brief Part of PBX interface */
-static struct ast_channel *jingle_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
+static struct ast_channel *jingle_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	struct jingle_pvt *p = NULL;
 	struct jingle *client = NULL;

Modified: team/tilghman/codec_bits3/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_mgcp.c?view=diff&rev=225350&r1=225349&r2=225350
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_mgcp.c (original)
+++ team/tilghman/codec_bits3/channels/chan_mgcp.c Thu Oct 22 00:08:32 2009
@@ -1221,7 +1221,7 @@
 		/* We already hold the channel lock */
 		if (f->frametype == AST_FRAME_VOICE) {
 			if (f->subclass != sub->owner->nativeformats) {
-				ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
+				ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass));
 				sub->owner->nativeformats = f->subclass;
 				ast_set_read_format(sub->owner, sub->owner->readformat);
 				ast_set_write_format(sub->owner, sub->owner->writeformat);
@@ -1253,6 +1253,8 @@
 {
 	struct mgcp_subchannel *sub = ast->tech_pvt;
 	int res = 0;
+	char buf[256];
+
 	if (frame->frametype != AST_FRAME_VOICE) {
 		if (frame->frametype == AST_FRAME_IMAGE)
 			return 0;
@@ -1262,8 +1264,11 @@
 		}
 	} else {
 		if (!(frame->subclass & ast->nativeformats)) {
-			ast_log(LOG_WARNING, "Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n",
-				frame->subclass, ast->nativeformats, ast->readformat, ast->writeformat);
+			ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
+				ast_getformatname(frame->subclass),
+				ast_getformatname_multiple(buf, sizeof(buf), ast->nativeformats),
+				ast_getformatname(ast->readformat),
+				ast_getformatname(ast->writeformat));
 			return -1;
 		}
 	}
@@ -3534,7 +3539,7 @@
 	oldformat = format;
 	format &= capability;
 	if (!format) {
-		ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", format);
+		ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(tmp, sizeof(tmp), format));
 		return NULL;
 	}
 	ast_copy_string(tmp, dest, sizeof(tmp));

Modified: team/tilghman/codec_bits3/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_misdn.c?view=diff&rev=225350&r1=225349&r2=225350
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_misdn.c (original)
+++ team/tilghman/codec_bits3/channels/chan_misdn.c Thu Oct 22 00:08:32 2009
@@ -6977,7 +6977,7 @@
 		return frame;
 	}
 
-	ast_debug(1, "Detected inband DTMF digit: %c\n", f->subclass);
+	ast_debug(1, "Detected inband DTMF digit: %c\n", (int) f->subclass);
 
  	if (tmp->faxdetect && (f->subclass == 'f')) {
  		/* Fax tone -- Handle and return NULL */
@@ -7029,7 +7029,7 @@
   	}
 
  	if (tmp->ast_dsp && (f->subclass != 'f')) {
- 		chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", f->subclass);
+ 		chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", (int) f->subclass);
  	}
 
 	return f;
@@ -7156,7 +7156,7 @@
 	}
 
 	if (!(frame->subclass & prefformat)) {
-		chan_misdn_log(-1, ch->bc->port, "Got Unsupported Frame with Format:%d\n", frame->subclass);
+		chan_misdn_log(-1, ch->bc->port, "Got Unsupported Frame with Format:%s\n", ast_getformatname(frame->subclass));
 		return 0;
 	}
 
@@ -7301,7 +7301,7 @@
 			if (!f) {
 				chan_misdn_log(4, ch1->bc->port, "Read Null Frame\n");
 			} else {
-				chan_misdn_log(4, ch1->bc->port, "Read Frame Control class:%d\n", f->subclass);
+				chan_misdn_log(4, ch1->bc->port, "Read Frame Control class:%d\n", (int) f->subclass);
 			}
 
 			*fo = f;
@@ -7310,7 +7310,7 @@
 		}
 
 		if (f->frametype == AST_FRAME_DTMF) {
-			chan_misdn_log(1, 0, "Read DTMF %d from %s\n", f->subclass, who->exten);
+			chan_misdn_log(1, 0, "Read DTMF %d from %s\n", (int) f->subclass, who->exten);
 
 			*fo = f;
 			*rc = who;
@@ -7437,7 +7437,7 @@
 	return cl;
 }
 
-static struct ast_channel *misdn_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
+static struct ast_channel *misdn_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	struct ast_channel *ast;
 	char group[BUFFERSIZE + 1] = "";

Modified: team/tilghman/codec_bits3/channels/chan_multicast_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_multicast_rtp.c?view=diff&rev=225350&r1=225349&r2=225350
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_multicast_rtp.c (original)
+++ team/tilghman/codec_bits3/channels/chan_multicast_rtp.c Thu Oct 22 00:08:32 2009
@@ -52,7 +52,7 @@
 static const char tdesc[] = "Multicast RTP Paging Channel Driver";
 
 /* Forward declarations */
-static struct ast_channel *multicast_rtp_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
+static struct ast_channel *multicast_rtp_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
 static int multicast_rtp_call(struct ast_channel *ast, char *dest, int timeout);
 static int multicast_rtp_hangup(struct ast_channel *ast);
 static struct ast_frame *multicast_rtp_read(struct ast_channel *ast);
@@ -107,13 +107,13 @@
 }
 
 /*! \brief Function called when we should prepare to call the destination */
-static struct ast_channel *multicast_rtp_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
+static struct ast_channel *multicast_rtp_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	char *tmp = ast_strdupa(data), *multicast_type = tmp, *destination, *control;
 	struct ast_rtp_instance *instance;
 	struct sockaddr_in control_address = { .sin_family = AF_INET, }, destination_address = { .sin_family = AF_INET, };
 	struct ast_channel *chan;
-	int fmt = ast_best_codec(format);
+	format_t fmt = ast_best_codec(format);
 
 	/* If no type was given we can't do anything */
 	if (ast_strlen_zero(multicast_type)) {

Modified: team/tilghman/codec_bits3/channels/chan_oss.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_oss.c?view=diff&rev=225350&r1=225349&r2=225350
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_oss.c (original)
+++ team/tilghman/codec_bits3/channels/chan_oss.c Thu Oct 22 00:08:32 2009
@@ -325,7 +325,7 @@
 
 static int setformat(struct chan_oss_pvt *o, int mode);
 
-static struct ast_channel *oss_request(const char *type, int format, const struct ast_channel *requestor,
+static struct ast_channel *oss_request(const char *type, format_t format, const struct ast_channel *requestor,
 									   void *data, int *cause);
 static int oss_digit_begin(struct ast_channel *c, char digit);
 static int oss_digit_end(struct ast_channel *c, char digit, unsigned int duration);
@@ -824,7 +824,7 @@
 	return c;
 }
 
-static struct ast_channel *oss_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
+static struct ast_channel *oss_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	struct ast_channel *c;
 	struct chan_oss_pvt *o;
@@ -833,6 +833,7 @@
 		AST_APP_ARG(flags);
 	);
 	char *parse = ast_strdupa(data);
+	char buf[256];
 
 	AST_NONSTANDARD_APP_ARGS(args, parse, '/');
 	o = find_desc(args.name);
@@ -844,7 +845,7 @@
 		return NULL;
 	}
 	if ((format & AST_FORMAT_SLINEAR) == 0) {
-		ast_log(LOG_NOTICE, "Format 0x%x unsupported\n", format);
+		ast_log(LOG_NOTICE, "Format %s unsupported\n", ast_getformatname_multiple(buf, sizeof(buf), format));
 		return NULL;
 	}
 	if (o->owner) {

Modified: team/tilghman/codec_bits3/channels/chan_phone.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_phone.c?view=diff&rev=225350&r1=225349&r2=225350
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_phone.c (original)
+++ team/tilghman/codec_bits3/channels/chan_phone.c Thu Oct 22 00:08:32 2009
@@ -125,8 +125,8 @@
 	int fd;							/* Raw file descriptor for this device */
 	struct ast_channel *owner;		/* Channel we belong to, possibly NULL */
 	int mode;						/* Is this in the  */
-	int lastformat;					/* Last output format */
-	int lastinput;					/* Last input format */
+	format_t lastformat;            /* Last output format */
+	format_t lastinput;             /* Last input format */
 	int ministate;					/* Miniature state, for dialtone mode */
 	char dev[256];					/* Device name */
 	struct phone_pvt *next;			/* Next channel in list */
@@ -150,7 +150,7 @@
 static char cid_num[AST_MAX_EXTENSION];
 static char cid_name[AST_MAX_EXTENSION];
 
-static struct ast_channel *phone_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
+static struct ast_channel *phone_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
 static int phone_digit_begin(struct ast_channel *ast, char digit);
 static int phone_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
 static int phone_call(struct ast_channel *ast, char *dest, int timeout);
@@ -433,8 +433,8 @@
 		if (p->lastinput != ast->rawreadformat) {
 			p->lastinput = ast->rawreadformat;
 			if (ioctl(p->fd, PHONE_REC_CODEC, ast->rawreadformat)) {
-				ast_log(LOG_WARNING, "Failed to set codec to %d\n", 
-					ast->rawreadformat);
+				ast_log(LOG_WARNING, "Failed to set codec to %s\n", 
+					ast_getformatname(ast->rawreadformat));
 				return -1;
 			}
 		}
@@ -662,7 +662,7 @@
 	if (!(frame->subclass &
 		(AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW | AST_FORMAT_G729A)) && 
 	    p->mode != MODE_FXS) {
-		ast_log(LOG_WARNING, "Cannot handle frames in %d format\n", frame->subclass);
+		ast_log(LOG_WARNING, "Cannot handle frames in %s format\n", ast_getformatname(frame->subclass));
 		return -1;
 	}
 #if 0
@@ -765,14 +765,14 @@
 		if (p->lastformat != frame->subclass) {
 			ioctl(p->fd, PHONE_PLAY_STOP);
 			ioctl(p->fd, PHONE_REC_STOP);
-			if (ioctl(p->fd, PHONE_PLAY_CODEC, frame->subclass)) {
-				ast_log(LOG_WARNING, "Unable to set %d mode\n",
-					frame->subclass);
-				return -1;
-			}
-			if (ioctl(p->fd, PHONE_REC_CODEC, frame->subclass)) {
-				ast_log(LOG_WARNING, "Unable to set %d mode\n",
-					frame->subclass);
+			if (ioctl(p->fd, PHONE_PLAY_CODEC, (int) frame->subclass)) {
+				ast_log(LOG_WARNING, "Unable to set %s mode\n",
+					ast_getformatname(frame->subclass));
+				return -1;
+			}
+			if (ioctl(p->fd, PHONE_REC_CODEC, (int) frame->subclass)) {
+				ast_log(LOG_WARNING, "Unable to set %s mode\n",
+					ast_getformatname(frame->subclass));
 				return -1;
 			}
 			p->lastformat = frame->subclass;
@@ -1211,9 +1211,9 @@
 	return tmp;
 }
 
-static struct ast_channel *phone_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
-{
-	int oldformat;
+static struct ast_channel *phone_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
+{
+	format_t oldformat;
 	struct phone_pvt *p;
 	struct ast_channel *tmp = NULL;
 	char *name = data;
@@ -1245,7 +1245,8 @@
 		oldformat = format;
 		format &= (AST_FORMAT_G729A | AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW);
 		if (!format) {
-			ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", oldformat);
+			char buf[256];
+			ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), oldformat));
 			return NULL;
 		}
 	}

Modified: team/tilghman/codec_bits3/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_sip.c?view=diff&rev=225350&r1=225349&r2=225350
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_sip.c (original)
+++ team/tilghman/codec_bits3/channels/chan_sip.c Thu Oct 22 00:08:32 2009
@@ -1212,7 +1212,7 @@
 	char default_context[AST_MAX_CONTEXT];
 	char default_subscribecontext[AST_MAX_CONTEXT];
 	struct ast_ha *contact_ha;  /*! \brief Global list of addresses dynamic peers are not allowed to use */
-	int capability;			/*!< Supported codecs */
+	format_t capability;			/*!< Supported codecs */
 };
 
 static struct sip_settings sip_cfg;		/*!< SIP configuration data.
@@ -1761,13 +1761,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) */
+	format_t capability;				/*!< Special capability (codec) */
+	format_t jointcapability;			/*!< Supported capability at both ends (codecs) */
+	format_t peercapability;			/*!< Supported peer capability */
+	format_t prefcodec;				/*!< Preferred codec (outbound only) */
 	int noncodeccapability;			/*!< DTMF RFC2833 telephony-event */
 	int jointnoncodeccapability;            /*!< Joint Non codec capability */
-	int redircodecs;			/*!< Redirect codecs */
+	format_t redircodecs;			/*!< Redirect codecs */
 	int maxcallbitrate;			/*!< Maximum Call Bitrate for Video Calls */	
 	int t38_maxdatagram;			/*!< T.38 FaxMaxDatagram override */
 	int request_queue_sched_id;		/*!< Scheduler ID of any scheduled action to process queued requests */
@@ -2031,7 +2031,7 @@
 
 	int maxcallbitrate;		/*!<  Maximum Bitrate for a video call */
 	int expire;			/*!<  When to expire this peer registration */
-	int capability;			/*!<  Codec capability */
+	format_t capability;			/*!<  Codec capability */
 	int rtptimeout;			/*!<  RTP timeout */
 	int rtpholdtimeout;		/*!<  RTP Hold Timeout */
 	int rtpkeepalive;		/*!<  Send RTP packets for keepalive */
@@ -2373,7 +2373,7 @@
 	in coming releases. */
 
 /*--- PBX interface functions */
-static struct ast_channel *sip_request_call(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
+static struct ast_channel *sip_request_call(const char *type, format_t format, const struct ast_channel *requestor, 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);
@@ -2734,7 +2734,7 @@
 static struct sip_st_dlg* sip_st_alloc(struct sip_pvt *const p);
 
 /*------- RTP Glue functions -------- */
-static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, int codecs, int nat_active);
+static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, format_t codecs, int nat_active);
 
 /*!--- SIP MWI Subscription support */
 static int sip_subscribe_mwi(const char *value, int lineno);
@@ -6307,14 +6307,11 @@
 	case AST_FRAME_VOICE:
 		if (!(frame->subclass & 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,
-				ast_getformatname_multiple(s2, sizeof(s2) - 1, ast->readformat),
-				ast->readformat,
-				ast_getformatname_multiple(s3, sizeof(s3) - 1, ast->writeformat),
-				ast->writeformat);
+			ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s read/write = %s/%s\n",
+				ast_getformatname(frame->subclass),
+				ast_getformatname_multiple(s1, sizeof(s1), ast->nativeformats & AST_FORMAT_AUDIO_MASK),
+				ast_getformatname_multiple(s2, sizeof(s2), ast->readformat),
+				ast_getformatname_multiple(s3, sizeof(s3), ast->writeformat));
 			return 0;
 		}
 		if (p) {
@@ -7065,7 +7062,7 @@
 	/* Don't forward RFC2833 if we're not supposed to */
 	if (f && (f->frametype == AST_FRAME_DTMF_BEGIN || f->frametype == AST_FRAME_DTMF_END) &&
 	    (ast_test_flag(&p->flags[0], SIP_DTMF) != SIP_DTMF_RFC2833)) {
-		ast_debug(1, "Ignoring DTMF (%c) RTP frame because dtmfmode is not RFC2833\n", f->subclass);
+		ast_debug(1, "Ignoring DTMF (%c) RTP frame because dtmfmode is not RFC2833\n", (int) f->subclass);
 		return &ast_null_frame;
 	}
 
@@ -7079,8 +7076,8 @@
 				ast_getformatname(f->subclass), p->owner->name);
 			return &ast_null_frame;
 		}
-		ast_debug(1, "Oooh, format changed to %d %s\n",
-			f->subclass, ast_getformatname(f->subclass));
+		ast_debug(1, "Oooh, format changed to %s\n",
+			ast_getformatname(f->subclass));
 		p->owner->nativeformats = (p->owner->nativeformats & (AST_FORMAT_VIDEO_MASK | AST_FORMAT_TEXT_MASK)) | f->subclass;
 		ast_set_read_format(p->owner, p->owner->readformat);
 		ast_set_write_format(p->owner, p->owner->writeformat);
@@ -7089,11 +7086,11 @@
 	if (f && p->dsp) {
 		f = ast_dsp_process(p->owner, p->dsp, f);
 		if (f && f->frametype == AST_FRAME_DTMF) {
-			if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && f->subclass == 'f') {
+			if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && ((int) f->subclass) == 'f') {
 				ast_debug(1, "Fax CNG detected on %s\n", ast->name);
 				*faxdetect = 1;
 			} else {
-				ast_debug(1, "* Detected inband DTMF '%c'\n", f->subclass);
+				ast_debug(1, "* Detected inband DTMF '%c'\n", (int) f->subclass);
 			}
 		}
 	}
@@ -8182,9 +8179,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;
+	format_t peercapability = 0, vpeercapability = 0, tpeercapability = 0;
+	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 */
@@ -8202,8 +8198,8 @@
 	int sendonly = -1;
 	int numberofports;
 	struct ast_rtp_codecs newaudiortp, newvideortp, newtextrtp;
-	int newjointcapability;				/* Negotiated capability */
-	int newpeercapability;
+	format_t newjointcapability;				/* Negotiated capability */
+	format_t newpeercapability;
 	int newnoncodeccapability;

[... 104 lines stripped ...]



More information about the asterisk-commits mailing list