[asterisk-commits] tilghman: branch tilghman/codec_bits3 r225761 - in /team/tilghman/codec_bits3...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Oct 25 12:50:25 CDT 2009


Author: tilghman
Date: Sun Oct 25 12:50:19 2009
New Revision: 225761

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=225761
Log:
Quite a few more architectural changes

Modified:
    team/tilghman/codec_bits3/channels/chan_iax2.c
    team/tilghman/codec_bits3/channels/chan_skinny.c
    team/tilghman/codec_bits3/channels/chan_unistim.c
    team/tilghman/codec_bits3/include/asterisk/channel.h
    team/tilghman/codec_bits3/include/asterisk/pbx.h
    team/tilghman/codec_bits3/include/asterisk/translate.h
    team/tilghman/codec_bits3/main/channel.c
    team/tilghman/codec_bits3/main/pbx.c
    team/tilghman/codec_bits3/main/translate.c
    team/tilghman/codec_bits3/pbx/pbx_spool.c

Modified: team/tilghman/codec_bits3/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_iax2.c?view=diff&rev=225761&r1=225760&r2=225761
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_iax2.c (original)
+++ team/tilghman/codec_bits3/channels/chan_iax2.c Sun Oct 25 12:50:19 2009
@@ -11718,7 +11718,7 @@
 {
 	int callno;
 	int res;
-	int fmt, native;
+	format_t fmt, native;
 	struct sockaddr_in sin;
 	struct ast_channel *c;
 	struct parsed_dial_string pds;

Modified: team/tilghman/codec_bits3/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_skinny.c?view=diff&rev=225761&r1=225760&r2=225761
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_skinny.c (original)
+++ team/tilghman/codec_bits3/channels/chan_skinny.c Sun Oct 25 12:50:19 2009
@@ -141,7 +141,7 @@
 static const char tdesc[] = "Skinny Client Control Protocol (Skinny)";
 static const char config[] = "skinny.conf";
 
-static int default_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW;
+static format_t default_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW;
 static struct ast_codec_pref default_prefs;
 
 enum skinny_codecs {
@@ -1229,9 +1229,9 @@
 	int instance;					\
 	int group;					\
 	int needdestroy;				\
-	int confcapability;				\
+	format_t confcapability;				\
 	struct ast_codec_pref confprefs;		\
-	int capability;					\
+	format_t capability;					\
 	struct ast_codec_pref prefs;			\
 	int nonCodecCapability;				\
 	int onhooktime;					\
@@ -1309,9 +1309,9 @@
 	int registered;						\
 	int lastlineinstance;					\
 	int lastcallreference;					\
-	int confcapability;					\
+	format_t confcapability;					\
 	struct ast_codec_pref confprefs;			\
-	int capability;						\
+	format_t capability;						\
 	int earlyrtp;						\
 	int transfer;						\
 	int callwaiting;					\
@@ -1371,7 +1371,7 @@
 	AST_LIST_ENTRY(skinnysession) list;
 };
 
-static struct ast_channel *skinny_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
+static struct ast_channel *skinny_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
 static AST_LIST_HEAD_STATIC(sessions, skinnysession);
 
 static int skinny_devicestate(void *data);
@@ -2704,7 +2704,7 @@
 
 }
 
-static int skinny_set_rtp_peer(struct ast_channel *c, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, int codecs, int nat_active)
+static int skinny_set_rtp_peer(struct ast_channel *c, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, format_t codecs, int nat_active)
 {
 	struct skinny_subchannel *sub;
 	struct skinny_line *l;
@@ -2748,7 +2748,7 @@
 		fmt = ast_codec_pref_getsize(&l->prefs, ast_best_codec(l->capability));
 
 		if (skinnydebug)
-			ast_verb(1, "Setting payloadType to '%d' (%d ms)\n", fmt.bits, fmt.cur_ms);
+			ast_verb(1, "Setting payloadType to '%s' (%d ms)\n", ast_getformatname(fmt.bits), fmt.cur_ms);
 
 		req->data.startmedia.conferenceId = htolel(sub->callid);
 		req->data.startmedia.passThruPartyId = htolel(sub->callid);
@@ -4021,9 +4021,9 @@
 	if (ast) {
 		/* We already hold the channel lock */
 		if (f->frametype == AST_FRAME_VOICE) {
-			if (f->subclass != ast->nativeformats) {
-				ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
-				ast->nativeformats = f->subclass;
+			if (f->subclass.codec != ast->nativeformats) {
+				ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass.codec));
+				ast->nativeformats = f->subclass.codec;
 				ast_set_read_format(ast, ast->readformat);
 				ast_set_write_format(ast, ast->writeformat);
 			}
@@ -4054,9 +4054,13 @@
 			return 0;
 		}
 	} 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);
+		if (!(frame->subclass.codec & ast->nativeformats)) {
+			char buf[256];
+			ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
+				ast_getformatname(frame->subclass.codec),
+				ast_getformatname_multiple(buf, sizeof(buf), ast->nativeformats),
+				ast_getformatname(ast->readformat),
+				ast_getformatname(ast->writeformat));
 			return -1;
 		}
 	}
@@ -4400,8 +4404,12 @@
 			// Should throw an error
 			tmp->nativeformats = default_capability;
 		fmt = ast_best_codec(tmp->nativeformats);
-		if (skinnydebug)
-			ast_verb(1, "skinny_new: tmp->nativeformats=%d fmt=%d\n", tmp->nativeformats, fmt);
+		if (skinnydebug) {
+			char buf[256];
+			ast_verb(1, "skinny_new: tmp->nativeformats=%s fmt=%s\n",
+				ast_getformatname_multiple(buf, sizeof(buf), tmp->nativeformats),
+				ast_getformatname(fmt));
+		}
 		if (sub->rtp) {
 			ast_channel_set_fd(tmp, 0, ast_rtp_instance_fd(sub->rtp, 0));
 		}
@@ -4746,7 +4754,7 @@
 		ast_log(LOG_WARNING, "Unsupported digit %d\n", digit);
 	}
 
-	f.subclass = dgt;
+	f.subclass.integer = dgt;
 
 	f.src = "skinny";
 
@@ -5301,6 +5309,7 @@
 	uint32_t count = 0;
 	int codecs = 0;
 	int i;
+	char buf[256];
 
 	count = letohl(req->data.caps.count);
 	if (count > SKINNY_MAX_CAPABILITIES) {
@@ -5319,7 +5328,7 @@
 	}
 
 	d->capability = d->confcapability & codecs;
-	ast_verb(0, "Device capability set to '%d'\n", d->capability);
+	ast_verb(0, "Device capability set to '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), d->capability));
 	AST_LIST_TRAVERSE(&d->lines, l, list) {
 		ast_mutex_lock(&l->lock);
 		l->capability = l->confcapability & d->capability;
@@ -5646,7 +5655,7 @@
 	fmt = ast_codec_pref_getsize(&l->prefs, ast_best_codec(l->capability));
 
 	if (skinnydebug)
-		ast_verb(1, "Setting payloadType to '%d' (%d ms)\n", fmt.bits, fmt.cur_ms);
+		ast_verb(1, "Setting payloadType to '%s' (%d ms)\n", ast_getformatname(fmt.bits), fmt.cur_ms);
 
 	req->data.startmedia.conferenceId = htolel(sub->callid);
 	req->data.startmedia.passThruPartyId = htolel(sub->callid);
@@ -6576,9 +6585,9 @@
 	return get_devicestate(l);
 }
 
-static struct ast_channel *skinny_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
-{
-	int oldformat;
+static struct ast_channel *skinny_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
+{
+	format_t oldformat;
 	
 	struct skinny_line *l;
 	struct ast_channel *tmpc = NULL;
@@ -6588,7 +6597,7 @@
 	oldformat = format;
 	
 	if (!(format &= AST_FORMAT_AUDIO_MASK)) {
-		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;
 	}
 

Modified: team/tilghman/codec_bits3/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_unistim.c?view=diff&rev=225761&r1=225760&r2=225761
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_unistim.c (original)
+++ team/tilghman/codec_bits3/channels/chan_unistim.c Sun Oct 25 12:50:19 2009
@@ -676,7 +676,7 @@
 static int unload_module(void);
 static int reload_config(void);
 static void show_main_page(struct unistimsession *pte);
-static struct ast_channel *unistim_request(const char *type, int format, const struct ast_channel *requestor, 
+static struct ast_channel *unistim_request(const char *type, format_t format, const struct ast_channel *requestor, 
 	void *data, int *cause);
 static int unistim_call(struct ast_channel *ast, char *dest, int timeout);
 static int unistim_hangup(struct ast_channel *ast);
@@ -2035,7 +2035,7 @@
 	struct sockaddr_in us = { 0, };
 	struct sockaddr_in public = { 0, };
 	struct sockaddr_in sin = { 0, };
-	int codec;
+	format_t codec;
 	struct sockaddr_in sout = { 0, };
 
 	/* Sanity checks */
@@ -2085,13 +2085,14 @@
 	sin.sin_port = htons(sub->parent->parent->rtp_port);
 	ast_rtp_instance_set_remote_address(sub->rtp, &sin);
 	if (!(sub->owner->nativeformats & sub->owner->readformat)) {
-		int fmt;
+		format_t fmt;
+		char tmp[256];
 		fmt = ast_best_codec(sub->owner->nativeformats);
 		ast_log(LOG_WARNING,
-				"Our read/writeformat has been changed to something incompatible : %s (%d), using %s (%d) best codec from %d\n",
+				"Our read/writeformat has been changed to something incompatible: %s, using %s best codec from %s\n",
 				ast_getformatname(sub->owner->readformat),
-				sub->owner->readformat, ast_getformatname(fmt), fmt,
-				sub->owner->nativeformats);
+				ast_getformatname(fmt),
+				ast_getformatname_multiple(tmp, sizeof(tmp), sub->owner->nativeformats));
 		sub->owner->readformat = fmt;
 		sub->owner->writeformat = fmt;
 	}
@@ -2102,20 +2103,19 @@
 	else
 		memcpy(&public, &public_ip, sizeof(public));    /* override  */
 	if (unistimdebug) {
-		ast_verb(0, "RTP started : Our IP/port is : %s:%hd with codec %s (%d)\n",
+		ast_verb(0, "RTP started : Our IP/port is : %s:%hd with codec %s\n",
 			 ast_inet_ntoa(us.sin_addr),
-			 htons(us.sin_port), ast_getformatname(sub->owner->readformat),
-			 sub->owner->readformat);
+			 htons(us.sin_port), ast_getformatname(sub->owner->readformat));
 		ast_verb(0, "Starting phone RTP stack. Our public IP is %s\n",
 					ast_inet_ntoa(public.sin_addr));
 	}
 	if ((sub->owner->readformat == AST_FORMAT_ULAW) ||
 		(sub->owner->readformat == AST_FORMAT_ALAW)) {
 		if (unistimdebug)
-			ast_verb(0, "Sending packet_send_rtp_packet_size for codec %d\n", codec);
+			ast_verb(0, "Sending packet_send_rtp_packet_size for codec %s\n", ast_getformatname(codec));
 		memcpy(buffsend + SIZE_HEADER, packet_send_rtp_packet_size,
 			   sizeof(packet_send_rtp_packet_size));
-		buffsend[10] = codec;
+		buffsend[10] = (int) codec & 0xffffffffLL;
 		send_client(SIZE_HEADER + sizeof(packet_send_rtp_packet_size), buffsend,
 				   sub->parent->parent->session);
 	}
@@ -2214,8 +2214,8 @@
 		else if (sub->owner->readformat == AST_FORMAT_G729A)
 			buffsend[42] = 2;       /* 1 = 10ms (10 bytes), 2 = 20ms (20 bytes) */
 		else
-			ast_log(LOG_WARNING, "Unsupported codec %s (%d) !\n",
-					ast_getformatname(sub->owner->readformat), sub->owner->readformat);
+			ast_log(LOG_WARNING, "Unsupported codec %s!\n",
+					ast_getformatname(sub->owner->readformat));
 		/* Source port for transmit RTP and Destination port for receiving RTP */
 		buffsend[45] = (htons(sin.sin_port) & 0xff00) >> 8;
 		buffsend[46] = (htons(sin.sin_port) & 0x00ff);
@@ -2474,7 +2474,7 @@
 
 static int unistim_do_senddigit(struct unistimsession *pte, char digit)
 {
-	struct ast_frame f = { .frametype = AST_FRAME_DTMF, .subclass = digit, .src = "unistim" };
+	struct ast_frame f = { .frametype = AST_FRAME_DTMF, .subclass.integer = digit, .src = "unistim" };
 	struct unistim_subchannel *sub;
 	sub = pte->device->lines->subs[SUB_REAL];
 	if (!sub->owner || sub->alreadygone) {
@@ -3936,14 +3936,13 @@
 	if (sub->owner) {
 		/* We already hold the channel lock */
 		if (f->frametype == AST_FRAME_VOICE) {
-			if (f->subclass != sub->owner->nativeformats) {
+			if (f->subclass.codec != sub->owner->nativeformats) {
 				ast_debug(1,
-						"Oooh, format changed from %s (%d) to %s (%d)\n",
+						"Oooh, format changed from %s to %s\n",
 						ast_getformatname(sub->owner->nativeformats),
-						sub->owner->nativeformats, ast_getformatname(f->subclass),
-						f->subclass);
-
-				sub->owner->nativeformats = f->subclass;
+						ast_getformatname(f->subclass.codec));
+
+				sub->owner->nativeformats = f->subclass.codec;
 				ast_set_read_format(sub->owner, sub->owner->readformat);
 				ast_set_write_format(sub->owner, sub->owner->writeformat);
 			}
@@ -3979,13 +3978,14 @@
 			return 0;
 		}
 	} else {
-		if (!(frame->subclass & ast->nativeformats)) {
+		if (!(frame->subclass.codec & ast->nativeformats)) {
+			char tmp[256];
 			ast_log(LOG_WARNING,
-					"Asked to transmit frame type %s (%d), while native formats is %s (%d) (read/write = %s (%d)/%d)\n",
-					ast_getformatname(frame->subclass), frame->subclass,
-					ast_getformatname(ast->nativeformats), ast->nativeformats,
-					ast_getformatname(ast->readformat), ast->readformat,
-					ast->writeformat);
+					"Asked to transmit frame type %s, while native formats is %s (read/write = (%s/%s)\n",
+					ast_getformatname(frame->subclass.codec),
+					ast_getformatname_multiple(tmp, sizeof(tmp), ast->nativeformats),
+					ast_getformatname(ast->readformat),
+					ast_getformatname(ast->writeformat));
 			return -1;
 		}
 	}
@@ -4240,7 +4240,7 @@
 
 	send_tone(pte, 0, 0);
 	f.frametype = AST_FRAME_DTMF;
-	f.subclass = digit;
+	f.subclass.integer = digit;
 	f.src = "unistim";
 	ast_queue_frame(sub->owner, &f);
 
@@ -4450,9 +4450,14 @@
 	if (!tmp->nativeformats)
 		tmp->nativeformats = CAPABILITY;
 	fmt = ast_best_codec(tmp->nativeformats);
-	if (unistimdebug)
-		ast_verb(0, "Best codec = %d from nativeformats %d (line cap=%d global=%d)\n", fmt,
-			 tmp->nativeformats, l->capability, CAPABILITY);
+	if (unistimdebug) {
+		char tmp1[256], tmp2[256], tmp3[256];
+		ast_verb(0, "Best codec = %s from nativeformats %s (line cap=%s global=%s)\n",
+			ast_getformatname(fmt),
+			ast_getformatname_multiple(tmp1, sizeof(tmp1), tmp->nativeformats),
+			ast_getformatname_multiple(tmp2, sizeof(tmp2), l->capability),
+			ast_getformatname_multiple(tmp3, sizeof(tmp3), CAPABILITY));
+	}
 	if ((sub->rtp) && (sub->subtype == 0)) {
 		if (unistimdebug)
 			ast_verb(0, "New unistim channel with a previous rtp handle ?\n");
@@ -4617,10 +4622,10 @@
 
 /*--- unistim_request: PBX interface function ---*/
 /* UNISTIM calls initiated by the PBX arrive here */
-static struct ast_channel *unistim_request(const char *type, int format, const struct ast_channel *requestor, void *data,
+static struct ast_channel *unistim_request(const char *type, format_t format, const struct ast_channel *requestor, void *data,
 										   int *cause)
 {
-	int oldformat;
+	format_t oldformat;
 	struct unistim_subchannel *sub;
 	struct ast_channel *tmpc = NULL;
 	char tmp[256];
@@ -4629,12 +4634,14 @@
 	oldformat = format;
 	format &= CAPABILITY;
 	ast_log(LOG_NOTICE,
-			"Asked to get a channel of format %s while capability is %d result : %s (%d) \n",
-			ast_getformatname(oldformat), CAPABILITY, ast_getformatname(format), format);
+			"Asked to get a channel of format %s while capability is %s result : %s\n",
+			ast_getformatname(oldformat),
+			ast_getformatname_multiple(tmp, sizeof(tmp), CAPABILITY),
+			ast_getformatname(format));
 	if (!format) {
 		ast_log(LOG_NOTICE,
 				"Asked to get a channel of unsupported format %s while capability is %s\n",
-				ast_getformatname(oldformat), ast_getformatname(CAPABILITY));
+				ast_getformatname(oldformat), ast_getformatname_multiple(tmp, sizeof(tmp), CAPABILITY));
 		return NULL;
 	}
 

Modified: team/tilghman/codec_bits3/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/include/asterisk/channel.h?view=diff&rev=225761&r1=225760&r2=225761
==============================================================================
--- team/tilghman/codec_bits3/include/asterisk/channel.h (original)
+++ team/tilghman/codec_bits3/include/asterisk/channel.h Sun Oct 25 12:50:19 2009
@@ -1156,7 +1156,7 @@
  * \return Returns an ast_channel on success or no answer, NULL on failure.  Check the value of chan->_state
  * to know if the call was answered or not.
  */
-struct ast_channel *ast_request_and_dial(const char *type, int format, const struct ast_channel *requestor, void *data,
+struct ast_channel *ast_request_and_dial(const char *type, format_t format, const struct ast_channel *requestor, void *data,
 	int timeout, int *reason, const char *cid_num, const char *cid_name);
 
 /*!
@@ -1173,7 +1173,7 @@
  * \return Returns an ast_channel on success or no answer, NULL on failure.  Check the value of chan->_state
  * to know if the call was answered or not.
  */
-struct ast_channel *__ast_request_and_dial(const char *type, int format, const struct ast_channel *requestor, void *data,
+struct ast_channel *__ast_request_and_dial(const char *type, format_t format, const struct ast_channel *requestor, void *data,
 	int timeout, int *reason, const char *cid_num, const char *cid_name, struct outgoing_helper *oh);
 
 /*!

Modified: team/tilghman/codec_bits3/include/asterisk/pbx.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/include/asterisk/pbx.h?view=diff&rev=225761&r1=225760&r2=225761
==============================================================================
--- team/tilghman/codec_bits3/include/asterisk/pbx.h (original)
+++ team/tilghman/codec_bits3/include/asterisk/pbx.h Sun Oct 25 12:50:19 2009
@@ -879,11 +879,11 @@
 
 /*! Synchronously or asynchronously make an outbound call and send it to a
    particular extension */
-int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
+int ast_pbx_outgoing_exten(const char *type, format_t format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
 
 /*! Synchronously or asynchronously make an outbound call and send it to a
    particular application with given extension */
-int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
+int ast_pbx_outgoing_app(const char *type, format_t format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
 
 /*!
  * \brief Evaluate a condition

Modified: team/tilghman/codec_bits3/include/asterisk/translate.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/include/asterisk/translate.h?view=diff&rev=225761&r1=225760&r2=225761
==============================================================================
--- team/tilghman/codec_bits3/include/asterisk/translate.h (original)
+++ team/tilghman/codec_bits3/include/asterisk/translate.h Sun Oct 25 12:50:19 2009
@@ -25,7 +25,7 @@
 #define _ASTERISK_TRANSLATE_H
 
 #define MAX_AUDIO_FORMAT 15 /* Do not include video here */
-#define MAX_FORMAT 32	/* Do include video here */
+#define MAX_FORMAT 64	/* Do include video here */
 
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
@@ -69,51 +69,51 @@
  * Generic plc is only available for dstfmt = SLINEAR
  */
 struct ast_translator {
-	const char name[80];		/*!< Name of translator */
-	int srcfmt;			/*!< Source format (note: bit position,
-					  converted to index during registration) */
-	int dstfmt;			/*!< Destination format (note: bit position,
-					  converted to index during registration) */
+	const char name[80];                   /*!< Name of translator */
+	format_t srcfmt;                       /*!< Source format (note: bit position,
+	                                        *   converted to index during registration) */
+	format_t dstfmt;                       /*!< Destination format (note: bit position,
+	                                        *   converted to index during registration) */
 
 	int (*newpvt)(struct ast_trans_pvt *); /*!< initialize private data 
-					associated with the translator */
+                                            *   associated with the translator */
 
 	int (*framein)(struct ast_trans_pvt *pvt, struct ast_frame *in);
-					/*!< Input frame callback. Store 
-					     (and possibly convert) input frame. */
+	                                       /*!< Input frame callback. Store 
+	                                        *   (and possibly convert) input frame. */
 
 	struct ast_frame * (*frameout)(struct ast_trans_pvt *pvt);
-					/*!< Output frame callback. Generate a frame 
-					    with outbuf content. */
+	                                       /*!< Output frame callback. Generate a frame 
+	                                        *   with outbuf content. */
 
 	void (*destroy)(struct ast_trans_pvt *pvt);
-					/*!< cleanup private data, if needed 
-						(often unnecessary). */
-
-	struct ast_frame * (*sample)(void);	/*!< Generate an example frame */
-
-	/*! \brief size of outbuf, in samples. Leave it 0 if you want the framein
+	                                       /*!< cleanup private data, if needed 
+	                                        *   (often unnecessary). */
+
+	struct ast_frame * (*sample)(void);    /*!< Generate an example frame */
+
+	/*!\brief size of outbuf, in samples. Leave it 0 if you want the framein
 	 * callback deal with the frame. Set it appropriately if you
 	 * want the code to checks if the incoming frame fits the
 	 * outbuf (this is e.g. required for plc).
 	 */
-	int buffer_samples;	/*< size of outbuf, in samples */
+	int buffer_samples;                    /*< size of outbuf, in samples */
 
 	/*! \brief size of outbuf, in bytes. Mandatory. The wrapper code will also
 	 * allocate an AST_FRIENDLY_OFFSET space before.
 	 */
 	int buf_size;
 
-	int desc_size;			/*!< size of private descriptor in pvt->pvt, if any */
-	int plc_samples;		/*!< set to the plc block size if used, 0 otherwise */
-	int useplc;			/*!< current status of plc, changed at runtime */
-	int native_plc;			/*!< true if the translator can do native plc */
-
-	struct ast_module *module;	/* opaque reference to the parent module */
-
-	int cost;			/*!< Cost in milliseconds for encoding/decoding 1 second of sound */
-	int active;			/*!< Whether this translator should be used or not */
-	AST_LIST_ENTRY(ast_translator) list;	/*!< link field */
+	int desc_size;                         /*!< size of private descriptor in pvt->pvt, if any */
+	int plc_samples;                       /*!< set to the plc block size if used, 0 otherwise */
+	int useplc;                            /*!< current status of plc, changed at runtime */
+	int native_plc;                        /*!< true if the translator can do native plc */
+
+	struct ast_module *module;             /*!< opaque reference to the parent module */
+
+	int cost;                              /*!< Cost in milliseconds for encoding/decoding 1 second of sound */
+	int active;                            /*!< Whether this translator should be used or not */
+	AST_LIST_ENTRY(ast_translator) list;   /*!< link field */
 };
 
 /*! \brief
@@ -205,7 +205,7 @@
  * \return Returns 0 on success, -1 if no path could be found.  
  * \note Modifies dests and srcs in place 
  */
-int ast_translator_best_choice(int *dsts, int *srcs);
+format_t ast_translator_best_choice(format_t *dsts, format_t *srcs);
 
 /*! 
  * \brief Builds a translator path
@@ -214,7 +214,7 @@
  * \param source source format
  * \return ast_trans_pvt on success, NULL on failure
  * */
-struct ast_trans_pvt *ast_translator_build_path(int dest, int source);
+struct ast_trans_pvt *ast_translator_build_path(format_t dest, format_t source);
 
 /*!
  * \brief Frees a translator path
@@ -240,7 +240,7 @@
  * \param src source format
  * \return the number of translation steps required, or -1 if no path is available
  */
-unsigned int ast_translate_path_steps(unsigned int dest, unsigned int src);
+unsigned int ast_translate_path_steps(format_t dest, format_t src);
 
 /*!
  * \brief Mask off unavailable formats from a format bitmask
@@ -254,7 +254,7 @@
  * \note Only a single audio format and a single video format can be
  * present in 'src', or the function will produce unexpected results.
  */
-unsigned int ast_translate_available_formats(unsigned int dest, unsigned int src);
+format_t ast_translate_available_formats(format_t dest, format_t src);
 
 #if defined(__cplusplus) || defined(c_plusplus)
 }

Modified: team/tilghman/codec_bits3/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/main/channel.c?view=diff&rev=225761&r1=225760&r2=225761
==============================================================================
--- team/tilghman/codec_bits3/main/channel.c (original)
+++ team/tilghman/codec_bits3/main/channel.c Sun Oct 25 12:50:19 2009
@@ -4263,7 +4263,7 @@
 	}
 }
 
-struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, int format, struct outgoing_helper *oh, int *outstate)
+struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, format_t format, struct outgoing_helper *oh, int *outstate)
 {
 	char tmpchan[256];
 	struct ast_channel *new = NULL;
@@ -4339,7 +4339,7 @@
 	return new;
 }
 
-struct ast_channel *__ast_request_and_dial(const char *type, int format, const struct ast_channel *requestor, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, struct outgoing_helper *oh)
+struct ast_channel *__ast_request_and_dial(const char *type, format_t format, const struct ast_channel *requestor, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, struct outgoing_helper *oh)
 {
 	int dummy_outstate;
 	int cause = 0;
@@ -4478,21 +4478,21 @@
 	return chan;
 }
 
-struct ast_channel *ast_request_and_dial(const char *type, int format, const struct ast_channel *requestor, void *data, int timeout, int *outstate, const char *cidnum, const char *cidname)
+struct ast_channel *ast_request_and_dial(const char *type, format_t format, const struct ast_channel *requestor, void *data, int timeout, int *outstate, const char *cidnum, const char *cidname)
 {
 	return __ast_request_and_dial(type, format, requestor, data, timeout, outstate, cidnum, cidname, NULL);
 }
 
-struct ast_channel *ast_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
+struct ast_channel *ast_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	struct chanlist *chan;
 	struct ast_channel *c;
-	int capabilities;
-	int fmt;
+	format_t capabilities;
+	format_t fmt;
 	int res;
 	int foo;
-	int videoformat = format & AST_FORMAT_VIDEO_MASK;
-	int textformat = format & AST_FORMAT_TEXT_MASK;
+	format_t videoformat = format & AST_FORMAT_VIDEO_MASK;
+	format_t textformat = format & AST_FORMAT_TEXT_MASK;
 
 	if (!cause)
 		cause = &foo;

Modified: team/tilghman/codec_bits3/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/main/pbx.c?view=diff&rev=225761&r1=225760&r2=225761
==============================================================================
--- team/tilghman/codec_bits3/main/pbx.c (original)
+++ team/tilghman/codec_bits3/main/pbx.c Sun Oct 25 12:50:19 2009
@@ -8224,7 +8224,7 @@
 	return 0;  /* success */
 }
 
-int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel)
+int ast_pbx_outgoing_exten(const char *type, format_t format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel)
 {
 	struct ast_channel *chan;
 	struct async_stat *as;
@@ -8390,7 +8390,7 @@
 	return NULL;
 }
 
-int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel)
+int ast_pbx_outgoing_app(const char *type, format_t format, void *data, int timeout, const char *app, const char *appdata, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel)
 {
 	struct ast_channel *chan;
 	struct app_tmp *tmp;

Modified: team/tilghman/codec_bits3/main/translate.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/main/translate.c?view=diff&rev=225761&r1=225760&r2=225761
==============================================================================
--- team/tilghman/codec_bits3/main/translate.c (original)
+++ team/tilghman/codec_bits3/main/translate.c Sun Oct 25 12:50:19 2009
@@ -745,15 +745,15 @@
 }
 
 /*! \brief Calculate our best translator source format, given costs, and a desired destination */
-int ast_translator_best_choice(int *dst, int *srcs)
+format_t ast_translator_best_choice(format_t *dst, format_t *srcs)
 {
 	int x,y;
-	int best = -1;
-	int bestdst = 0;
-	int cur, cursrc;
+	format_t best = -1;
+	format_t bestdst = 0;
+	format_t cur, cursrc;
 	int besttime = INT_MAX;
 	int beststeps = INT_MAX;
-	int common = ((*dst) & (*srcs)) & AST_FORMAT_AUDIO_MASK;	/* are there common formats ? */
+	format_t common = ((*dst) & (*srcs)) & AST_FORMAT_AUDIO_MASK;	/* are there common formats ? */
 
 	if (common) { /* yes, pick one and return */
 		for (cur = 1, y = 0; y <= MAX_AUDIO_FORMAT; cur <<= 1, y++) {

Modified: team/tilghman/codec_bits3/pbx/pbx_spool.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/pbx/pbx_spool.c?view=diff&rev=225761&r1=225760&r2=225761
==============================================================================
--- team/tilghman/codec_bits3/pbx/pbx_spool.c (original)
+++ team/tilghman/codec_bits3/pbx/pbx_spool.c Sun Oct 25 12:50:19 2009
@@ -66,7 +66,7 @@
 	int retrytime;                            /*!< How long to wait between retries (in seconds) */
 	int waittime;                             /*!< How long to wait for an answer */
 	long callingpid;                          /*!< PID which is currently calling */
-	int format;                               /*!< Formats (codecs) for this call */
+	format_t format;                          /*!< Formats (codecs) for this call */
 	AST_DECLARE_STRING_FIELDS (
 		AST_STRING_FIELD(fn);                 /*!< File name of call file */
 		AST_STRING_FIELD(tech);               /*!< Which channel technology to use for outgoing call */




More information about the asterisk-commits mailing list