[svn-commits] tilghman: branch tilghman/codec_bits3 r225765 - in /team/tilghman/codec_bits3...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Oct 25 18:22:47 CDT 2009


Author: tilghman
Date: Sun Oct 25 18:22:37 2009
New Revision: 225765

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=225765
Log:
Yay, it compiles!  Ship it!  (kidding)

Modified:
    team/tilghman/codec_bits3/include/asterisk/slinfactory.h
    team/tilghman/codec_bits3/main/indications.c
    team/tilghman/codec_bits3/main/manager.c
    team/tilghman/codec_bits3/main/pbx.c
    team/tilghman/codec_bits3/main/rtp_engine.c
    team/tilghman/codec_bits3/main/slinfactory.c
    team/tilghman/codec_bits3/main/translate.c
    team/tilghman/codec_bits3/main/udptl.c

Modified: team/tilghman/codec_bits3/include/asterisk/slinfactory.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/include/asterisk/slinfactory.h?view=diff&rev=225765&r1=225764&r2=225765
==============================================================================
--- team/tilghman/codec_bits3/include/asterisk/slinfactory.h (original)
+++ team/tilghman/codec_bits3/include/asterisk/slinfactory.h Sun Oct 25 18:22:37 2009
@@ -37,8 +37,8 @@
 	short *offset;                           /*!< Offset into the hold where audio begins */
 	size_t holdlen;                          /*!< Number of samples currently in the hold */
 	unsigned int size;                       /*!< Number of samples currently in the factory */
-	unsigned int format;                     /*!< Current format the translation path is converting from */
-	unsigned int output_format;		 /*!< The output format desired */
+	format_t format;                         /*!< Current format the translation path is converting from */
+	format_t output_format;                  /*!< The output format desired */
 };
 
 /*!

Modified: team/tilghman/codec_bits3/main/indications.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/main/indications.c?view=diff&rev=225765&r1=225764&r2=225765
==============================================================================
--- team/tilghman/codec_bits3/main/indications.c (original)
+++ team/tilghman/codec_bits3/main/indications.c Sun Oct 25 18:22:37 2009
@@ -209,7 +209,7 @@
 	}
 
 	ps->f.frametype = AST_FRAME_VOICE;
-	ps->f.subclass = AST_FORMAT_SLINEAR;
+	ps->f.subclass.codec = AST_FORMAT_SLINEAR;
 	ps->f.datalen = len;
 	ps->f.samples = samples;
 	ps->f.offset = AST_FRIENDLY_OFFSET;

Modified: team/tilghman/codec_bits3/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/main/manager.c?view=diff&rev=225765&r1=225764&r2=225765
==============================================================================
--- team/tilghman/codec_bits3/main/manager.c (original)
+++ team/tilghman/codec_bits3/main/manager.c Sun Oct 25 18:22:37 2009
@@ -3088,12 +3088,12 @@
 	}
 
 	for (feature_code = atxfer_feature->exten; feature_code && *feature_code; ++feature_code) {
-		struct ast_frame f = { AST_FRAME_DTMF, *feature_code };
+		struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = *feature_code };
 		ast_queue_frame(chan, &f);
 	}
 
 	for (feature_code = (char *)exten; feature_code && *feature_code; ++feature_code) {
-		struct ast_frame f = { AST_FRAME_DTMF, *feature_code };
+		struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = *feature_code };
 		ast_queue_frame(chan, &f);
 	}
 
@@ -3200,7 +3200,7 @@
 	/*! data can contain a channel name, extension number, username, password, etc. */
 	char data[512];
 	int timeout;
-	int format;				/*!< Codecs used for a call */
+	format_t format;				/*!< Codecs used for a call */
 	char app[AST_MAX_APP];
 	char appdata[AST_MAX_EXTENSION];
 	char cid_name[AST_MAX_EXTENSION];
@@ -3285,7 +3285,7 @@
 	int reason = 0;
 	char tmp[256];
 	char tmp2[256];
-	int format = AST_FORMAT_SLINEAR;
+	format_t format = AST_FORMAT_SLINEAR;
 
 	pthread_t th;
 	if (ast_strlen_zero(name)) {

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=225765&r1=225764&r2=225765
==============================================================================
--- team/tilghman/codec_bits3/main/pbx.c (original)
+++ team/tilghman/codec_bits3/main/pbx.c Sun Oct 25 18:22:37 2009
@@ -8155,8 +8155,8 @@
 		if (!f)
 			break;
 		if (f->frametype == AST_FRAME_CONTROL) {
-			if ((f->subclass == AST_CONTROL_BUSY)  ||
-			    (f->subclass == AST_CONTROL_CONGESTION) ) {
+			if ((f->subclass.integer == AST_CONTROL_BUSY)  ||
+			    (f->subclass.integer == AST_CONTROL_CONGESTION) ) {
 				ast_frfree(f);
 				break;
 			}

Modified: team/tilghman/codec_bits3/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/main/rtp_engine.c?view=diff&rev=225765&r1=225764&r2=225765
==============================================================================
--- team/tilghman/codec_bits3/main/rtp_engine.c (original)
+++ team/tilghman/codec_bits3/main/rtp_engine.c Sun Oct 25 18:22:37 2009
@@ -601,7 +601,7 @@
 	return result;
 }
 
-void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, int *astformats, int *nonastformats)
+void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, format_t *astformats, int *nonastformats)
 {
 	int i;
 
@@ -619,7 +619,7 @@
 	}
 }
 
-int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const int code)
+int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const format_t code)
 {
 	int i;
 
@@ -638,7 +638,7 @@
 	return -1;
 }
 
-const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const int code, enum ast_rtp_options options)
+const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const format_t code, enum ast_rtp_options options)
 {
 	int i;
 
@@ -668,7 +668,7 @@
 	return 0;
 }
 
-char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, const int capability, const int asterisk_format, enum ast_rtp_options options)
+char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, const format_t capability, const int asterisk_format, enum ast_rtp_options options)
 {
 	int format, found = 0;
 
@@ -676,7 +676,7 @@
 		return NULL;
 	}
 
-	ast_str_append(&buf, 0, "0x%x (", capability);
+	ast_str_append(&buf, 0, "0x%llx (", (unsigned long long) capability);
 
 	for (format = 1; format < AST_RTP_MAX; format <<= 1) {
 		if (capability & format) {
@@ -851,13 +851,13 @@
 			res = AST_BRIDGE_COMPLETE;
 			break;
 		} else if ((fr->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
-			if ((fr->subclass == AST_CONTROL_HOLD) ||
-			    (fr->subclass == AST_CONTROL_UNHOLD) ||
-			    (fr->subclass == AST_CONTROL_VIDUPDATE) ||
-			    (fr->subclass == AST_CONTROL_SRCUPDATE) ||
-			    (fr->subclass == AST_CONTROL_T38_PARAMETERS)) {
+			if ((fr->subclass.integer == AST_CONTROL_HOLD) ||
+			    (fr->subclass.integer == AST_CONTROL_UNHOLD) ||
+			    (fr->subclass.integer == AST_CONTROL_VIDUPDATE) ||
+			    (fr->subclass.integer == AST_CONTROL_SRCUPDATE) ||
+			    (fr->subclass.integer == AST_CONTROL_T38_PARAMETERS)) {
 				/* If we are going on hold, then break callback mode and P2P bridging */
-				if (fr->subclass == AST_CONTROL_HOLD) {
+				if (fr->subclass.integer == AST_CONTROL_HOLD) {
 					if (instance0->engine->local_bridge) {
 						instance0->engine->local_bridge(instance0, NULL);
 					}
@@ -866,7 +866,7 @@
 					}
 					instance0->bridged = NULL;
 					instance1->bridged = NULL;
-				} else if (fr->subclass == AST_CONTROL_UNHOLD) {
+				} else if (fr->subclass.integer == AST_CONTROL_UNHOLD) {
 					if (instance0->engine->local_bridge) {
 						instance0->engine->local_bridge(instance0, instance1);
 					}
@@ -876,12 +876,12 @@
 					instance0->bridged = instance1;
 					instance1->bridged = instance0;
 				}
-				ast_indicate_data(other, fr->subclass, fr->data.ptr, fr->datalen);
+				ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
 				ast_frfree(fr);
 			} else {
 				*fo = fr;
 				*rc = who;
-				ast_debug(1, "rtp-engine-local-bridge: Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass, who->name);
+				ast_debug(1, "rtp-engine-local-bridge: Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass.integer, who->name);
 				res = AST_BRIDGE_COMPLETE;
 				break;
 			}
@@ -923,12 +923,12 @@
 
 static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0, struct ast_channel *c1, struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1,
 						 struct ast_rtp_instance *vinstance0, struct ast_rtp_instance *vinstance1, struct ast_rtp_instance *tinstance0,
-						 struct ast_rtp_instance *tinstance1, struct ast_rtp_glue *glue0, struct ast_rtp_glue *glue1, int codec0, int codec1, int timeoutms,
+						 struct ast_rtp_instance *tinstance1, struct ast_rtp_glue *glue0, struct ast_rtp_glue *glue1, format_t codec0, format_t codec1, int timeoutms,
 						 int flags, struct ast_frame **fo, struct ast_channel **rc, void *pvt0, void *pvt1)
 {
 	enum ast_bridge_result res = AST_BRIDGE_FAILED;
 	struct ast_channel *who = NULL, *other = NULL, *cs[3] = { NULL, };
-	int oldcodec0 = codec0, oldcodec1 = codec1;
+	format_t oldcodec0 = codec0, oldcodec1 = codec1;
 	struct sockaddr_in ac1 = {0,}, vac1 = {0,}, tac1 = {0,}, ac0 = {0,}, vac0 = {0,}, tac0 = {0,};
 	struct sockaddr_in t1 = {0,}, vt1 = {0,}, tt1 = {0,}, t0 = {0,}, vt0 = {0,}, tt0 = {0,};
 	struct ast_frame *fr = NULL;
@@ -1009,18 +1009,18 @@
 		    (vinstance1 && inaddrcmp(&vt1, &vac1)) ||
 		    (tinstance1 && inaddrcmp(&tt1, &tac1)) ||
 		    (codec1 != oldcodec1)) {
-			ast_debug(1, "Oooh, '%s' changed end address to %s:%d (format %d)\n",
-				  c1->name, ast_inet_ntoa(t1.sin_addr), ntohs(t1.sin_port), codec1);
-			ast_debug(1, "Oooh, '%s' changed end vaddress to %s:%d (format %d)\n",
-				  c1->name, ast_inet_ntoa(vt1.sin_addr), ntohs(vt1.sin_port), codec1);
-			ast_debug(1, "Oooh, '%s' changed end taddress to %s:%d (format %d)\n",
-				  c1->name, ast_inet_ntoa(tt1.sin_addr), ntohs(tt1.sin_port), codec1);
-			ast_debug(1, "Oooh, '%s' was %s:%d/(format %d)\n",
-				  c1->name, ast_inet_ntoa(ac1.sin_addr), ntohs(ac1.sin_port), oldcodec1);
-			ast_debug(1, "Oooh, '%s' was %s:%d/(format %d)\n",
-				  c1->name, ast_inet_ntoa(vac1.sin_addr), ntohs(vac1.sin_port), oldcodec1);
-			ast_debug(1, "Oooh, '%s' was %s:%d/(format %d)\n",
-				  c1->name, ast_inet_ntoa(tac1.sin_addr), ntohs(tac1.sin_port), oldcodec1);
+			ast_debug(1, "Oooh, '%s' changed end address to %s:%d (format %s)\n",
+				  c1->name, ast_inet_ntoa(t1.sin_addr), ntohs(t1.sin_port), ast_getformatname(codec1));
+			ast_debug(1, "Oooh, '%s' changed end vaddress to %s:%d (format %s)\n",
+				  c1->name, ast_inet_ntoa(vt1.sin_addr), ntohs(vt1.sin_port), ast_getformatname(codec1));
+			ast_debug(1, "Oooh, '%s' changed end taddress to %s:%d (format %s)\n",
+				  c1->name, ast_inet_ntoa(tt1.sin_addr), ntohs(tt1.sin_port), ast_getformatname(codec1));
+			ast_debug(1, "Oooh, '%s' was %s:%d/(format %s)\n",
+				  c1->name, ast_inet_ntoa(ac1.sin_addr), ntohs(ac1.sin_port), ast_getformatname(oldcodec1));
+			ast_debug(1, "Oooh, '%s' was %s:%d/(format %s)\n",
+				  c1->name, ast_inet_ntoa(vac1.sin_addr), ntohs(vac1.sin_port), ast_getformatname(oldcodec1));
+			ast_debug(1, "Oooh, '%s' was %s:%d/(format %s)\n",
+				  c1->name, ast_inet_ntoa(tac1.sin_addr), ntohs(tac1.sin_port), ast_getformatname(oldcodec1));
 			if (glue0->update_peer(c0, t1.sin_addr.s_addr ? instance1 : NULL, vt1.sin_addr.s_addr ? vinstance1 : NULL, tt1.sin_addr.s_addr ? tinstance1 : NULL, codec1, 0)) {
 				ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", c0->name, c1->name);
 			}
@@ -1033,10 +1033,10 @@
 		    (vinstance0 && inaddrcmp(&vt0, &vac0)) ||
 		    (tinstance0 && inaddrcmp(&tt0, &tac0)) ||
 		    (codec0 != oldcodec0)) {
-			ast_debug(1, "Oooh, '%s' changed end address to %s:%d (format %d)\n",
-				  c0->name, ast_inet_ntoa(t0.sin_addr), ntohs(t0.sin_port), codec0);
-			ast_debug(1, "Oooh, '%s' was %s:%d/(format %d)\n",
-				  c0->name, ast_inet_ntoa(ac0.sin_addr), ntohs(ac0.sin_port), oldcodec0);
+			ast_debug(1, "Oooh, '%s' changed end address to %s:%d (format %s)\n",
+				  c0->name, ast_inet_ntoa(t0.sin_addr), ntohs(t0.sin_port), ast_getformatname(codec0));
+			ast_debug(1, "Oooh, '%s' was %s:%d/(format %s)\n",
+				  c0->name, ast_inet_ntoa(ac0.sin_addr), ntohs(ac0.sin_port), ast_getformatname(oldcodec0));
 			if (glue1->update_peer(c1, t0.sin_addr.s_addr ? instance0 : NULL, vt0.sin_addr.s_addr ? vinstance0 : NULL, tt0.sin_addr.s_addr ? tinstance0 : NULL, codec0, 0)) {
 				ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", c1->name, c0->name);
 			}
@@ -1070,19 +1070,19 @@
 			res = AST_BRIDGE_COMPLETE;
 			break;
 		} else if ((fr->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
-			if ((fr->subclass == AST_CONTROL_HOLD) ||
-			    (fr->subclass == AST_CONTROL_UNHOLD) ||
-			    (fr->subclass == AST_CONTROL_VIDUPDATE) ||
-			    (fr->subclass == AST_CONTROL_SRCUPDATE) ||
-			    (fr->subclass == AST_CONTROL_T38_PARAMETERS)) {
-				if (fr->subclass == AST_CONTROL_HOLD) {
+			if ((fr->subclass.integer == AST_CONTROL_HOLD) ||
+			    (fr->subclass.integer == AST_CONTROL_UNHOLD) ||
+			    (fr->subclass.integer == AST_CONTROL_VIDUPDATE) ||
+			    (fr->subclass.integer == AST_CONTROL_SRCUPDATE) ||
+			    (fr->subclass.integer == AST_CONTROL_T38_PARAMETERS)) {
+				if (fr->subclass.integer == AST_CONTROL_HOLD) {
 					/* If we someone went on hold we want the other side to reinvite back to us */
 					if (who == c0) {
 						glue1->update_peer(c1, NULL, NULL, NULL, 0, 0);
 					} else {
 						glue0->update_peer(c0, NULL, NULL, NULL, 0, 0);
 					}
-				} else if (fr->subclass == AST_CONTROL_UNHOLD) {
+				} else if (fr->subclass.integer == AST_CONTROL_UNHOLD) {
 					/* If they went off hold they should go back to being direct */
 					if (who == c0) {
 						glue1->update_peer(c1, instance0, vinstance0, tinstance0, codec0, 0);
@@ -1102,12 +1102,12 @@
 				if (glue1->get_codec && c1->tech_pvt) {
 					oldcodec1 = codec1 = glue1->get_codec(c1);
 				}
-				ast_indicate_data(other, fr->subclass, fr->data.ptr, fr->datalen);
+				ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
 				ast_frfree(fr);
 			} else {
 				*fo = fr;
 				*rc = who;
-				ast_debug(1, "Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass, who->name);
+				ast_debug(1, "Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass.integer, who->name);
 				return AST_BRIDGE_COMPLETE;
 			}
 		} else {
@@ -1286,7 +1286,7 @@
 	struct ast_rtp_glue *glue0, *glue1;
 	enum ast_rtp_glue_result audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID, video_glue0_res = AST_RTP_GLUE_RESULT_FORBID, text_glue0_res = AST_RTP_GLUE_RESULT_FORBID;
 	enum ast_rtp_glue_result audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID, video_glue1_res = AST_RTP_GLUE_RESULT_FORBID, text_glue1_res = AST_RTP_GLUE_RESULT_FORBID;
-	int codec0 = 0, codec1 = 0;
+	format_t codec0 = 0, codec1 = 0;
 	int res = 0;
 
 	/* Lock both channels so we can look for the glue that binds them together */
@@ -1370,7 +1370,7 @@
 	struct ast_rtp_glue *glue0, *glue1;
 	enum ast_rtp_glue_result audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID, video_glue0_res = AST_RTP_GLUE_RESULT_FORBID, text_glue0_res = AST_RTP_GLUE_RESULT_FORBID;
 	enum ast_rtp_glue_result audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID, video_glue1_res = AST_RTP_GLUE_RESULT_FORBID, text_glue1_res = AST_RTP_GLUE_RESULT_FORBID;
-	int codec0 = 0, codec1 = 0;
+	format_t codec0 = 0, codec1 = 0;
 	int res = 0;
 
 	/* If there is no second channel just immediately bail out, we are of no use in that scenario */
@@ -1538,12 +1538,12 @@
 	}
 }
 
-int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, int format)
+int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, format_t format)
 {
 	return instance->engine->set_read_format ? instance->engine->set_read_format(instance, format) : -1;
 }
 
-int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, int format)
+int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, format_t format)
 {
 	return instance->engine->set_write_format ? instance->engine->set_write_format(instance, format) : -1;
 }
@@ -1584,9 +1584,9 @@
 	return res;
 }
 
-int ast_rtp_instance_available_formats(struct ast_rtp_instance *instance, int to_endpoint, int to_asterisk)
-{
-	int formats;
+format_t ast_rtp_instance_available_formats(struct ast_rtp_instance *instance, int to_endpoint, int to_asterisk)
+{
+	format_t formats;
 
 	if (instance->engine->available_formats && (formats = instance->engine->available_formats(instance, to_endpoint, to_asterisk))) {
 		return formats;

Modified: team/tilghman/codec_bits3/main/slinfactory.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/main/slinfactory.c?view=diff&rev=225765&r1=225764&r2=225765
==============================================================================
--- team/tilghman/codec_bits3/main/slinfactory.c (original)
+++ team/tilghman/codec_bits3/main/slinfactory.c Sun Oct 25 18:22:37 2009
@@ -85,19 +85,19 @@
 		return 0;
 	}
 
-	if (f->subclass != sf->output_format) {
-		if (sf->trans && f->subclass != sf->format) {
+	if (f->subclass.codec != sf->output_format) {
+		if (sf->trans && f->subclass.codec != sf->format) {
 			ast_translator_free_path(sf->trans);
 			sf->trans = NULL;
 		}
 
 		if (!sf->trans) {
-			if (!(sf->trans = ast_translator_build_path(sf->output_format, f->subclass))) {
-				ast_log(LOG_WARNING, "Cannot build a path from %s to %s\n", ast_getformatname(f->subclass),
+			if (!(sf->trans = ast_translator_build_path(sf->output_format, f->subclass.codec))) {
+				ast_log(LOG_WARNING, "Cannot build a path from %s to %s\n", ast_getformatname(f->subclass.codec),
 					ast_getformatname(sf->output_format));
 				return 0;
 			}
-			sf->format = f->subclass;
+			sf->format = f->subclass.codec;
 		}
 
 		if (!(begin_frame = ast_translate(sf->trans, f, 0))) {

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=225765&r1=225764&r2=225765
==============================================================================
--- team/tilghman/codec_bits3/main/translate.c (original)
+++ team/tilghman/codec_bits3/main/translate.c Sun Oct 25 18:22:37 2009
@@ -70,14 +70,14 @@
  */
 
 /*! \brief returns the index of the lowest bit set */
-static force_inline int powerof(unsigned int d)
-{
-	int x = ffs(d);
+static force_inline int powerof(format_t d)
+{
+	int x = ffsll(d);
 
 	if (x)
 		return x - 1;
 
-	ast_log(LOG_WARNING, "No bits set? %d\n", d);
+	ast_log(LOG_WARNING, "No bits set? %llu\n", (unsigned long long) d);
 
 	return -1;
 }
@@ -221,7 +221,7 @@
 	}
 
 	f->frametype = AST_FRAME_VOICE;
-	f->subclass = 1 << (pvt->t->dstfmt);
+	f->subclass.codec = 1 << (pvt->t->dstfmt);
 	f->mallocd = 0;
 	f->offset = AST_FRIENDLY_OFFSET;
 	f->src = pvt->t->name;
@@ -247,7 +247,7 @@
 }
 
 /*! \brief Build a chain of translators based upon the given source and dest formats */
-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)
 {
 	struct ast_trans_pvt *head = NULL, *tail = NULL;
 	
@@ -271,7 +271,8 @@
 			return NULL;
 		}
 		if (!(cur = newpvt(t))) {
-			ast_log(LOG_WARNING, "Failed to build translator step from %d to %d\n", source, dest);
+			ast_log(LOG_WARNING, "Failed to build translator step from %s to %s\n",
+				ast_getformatname(source), ast_getformatname(dest));
 			if (head)
 				ast_translator_free_path(head);	
 			AST_RWLIST_UNLOCK(&translators);
@@ -327,7 +328,7 @@
 			path->nextout = f->delivery;
 		}
 		/* Predict next incoming sample */
-		path->nextin = ast_tvadd(path->nextin, ast_samp2tv(f->samples, ast_format_rate(f->subclass)));
+		path->nextin = ast_tvadd(path->nextin, ast_samp2tv(f->samples, ast_format_rate(f->subclass.codec)));
 	}
 	delivery = f->delivery;
 	for ( ; out && p ; p = p->next) {
@@ -351,7 +352,7 @@
 		
 		/* Predict next outgoing timestamp from samples in this
 		   frame. */
-		path->nextout = ast_tvadd(path->nextout, ast_samp2tv(out->samples, ast_format_rate(out->subclass)));
+		path->nextout = ast_tvadd(path->nextout, ast_samp2tv(out->samples, ast_format_rate(out->subclass.codec)));
 	} else {
 		out->delivery = ast_tv(0, 0);
 		ast_set2_flag(out, has_timing_info, AST_FRFLAG_HAS_TIMING_INFO);
@@ -638,8 +639,8 @@
 			return -1;
 		}
 		if (t->dstfmt != powerof(AST_FORMAT_SLINEAR))
-			ast_log(LOG_WARNING, "plc_samples %d format %x\n",
-				t->plc_samples, t->dstfmt);
+			ast_log(LOG_WARNING, "plc_samples %d format %llx\n",
+				t->plc_samples, (unsigned long long) t->dstfmt);
 	}
 	if (t->srcfmt >= MAX_FORMAT) {
 		ast_log(LOG_WARNING, "Source format %s is larger than MAX_FORMAT\n", ast_getformatname(t->srcfmt));
@@ -792,7 +793,7 @@
 	}
 }
 
-unsigned int ast_translate_path_steps(unsigned int dest, unsigned int src)
+unsigned int ast_translate_path_steps(format_t dest, format_t src)
 {
 	unsigned int res = -1;
 
@@ -814,12 +815,12 @@
 	return res;
 }
 
-unsigned int ast_translate_available_formats(unsigned int dest, unsigned int src)
-{
-	unsigned int res = dest;
+format_t ast_translate_available_formats(format_t dest, format_t src)
+{
+	format_t res = dest;
 	unsigned int x;
-	unsigned int src_audio = src & AST_FORMAT_AUDIO_MASK;
-	unsigned int src_video = src & AST_FORMAT_VIDEO_MASK;
+	format_t src_audio = src & AST_FORMAT_AUDIO_MASK;
+	format_t src_video = src & AST_FORMAT_VIDEO_MASK;
 
 	/* if we don't have a source format, we just have to try all
 	   possible destination formats */
@@ -840,7 +841,11 @@
 	   known audio formats to determine whether there exists
 	   a translation path from the source format to the
 	   destination format. */
-	for (x = 1; src_audio && (x & AST_FORMAT_AUDIO_MASK); x <<= 1) {
+	for (x = 1LL; src_audio && x > 0; x <<= 1) {
+		if (!(x & AST_FORMAT_AUDIO_MASK)) {
+			continue;
+		}
+
 		/* if this is not a desired format, nothing to do */
 		if (!(dest & x))
 			continue;
@@ -866,7 +871,11 @@
 	   known video formats to determine whether there exists
 	   a translation path from the source format to the
 	   destination format. */
-	for (; src_video && (x & AST_FORMAT_VIDEO_MASK); x <<= 1) {
+	for (x = 1LL; src_video && x > 0; x <<= 1) {
+		if (!(x & AST_FORMAT_VIDEO_MASK)) {
+			continue;
+		}
+
 		/* if this is not a desired format, nothing to do */
 		if (!(dest & x))
 			continue;

Modified: team/tilghman/codec_bits3/main/udptl.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/main/udptl.c?view=diff&rev=225765&r1=225764&r2=225765
==============================================================================
--- team/tilghman/codec_bits3/main/udptl.c (original)
+++ team/tilghman/codec_bits3/main/udptl.c Sun Oct 25 18:22:37 2009
@@ -368,7 +368,7 @@
 					/* Decode the secondary IFP packet */
 					//fprintf(stderr, "Secondary %d, len %d\n", seq_no - i, lengths[i - 1]);
 					s->f[ifp_no].frametype = AST_FRAME_MODEM;
-					s->f[ifp_no].subclass = AST_MODEM_T38;
+					s->f[ifp_no].subclass.codec = AST_MODEM_T38;
 
 					s->f[ifp_no].mallocd = 0;
 					s->f[ifp_no].seqno = seq_no - i;
@@ -470,7 +470,7 @@
 			if (repaired[l]) {
 				//fprintf(stderr, "Fixed packet %d, len %d\n", j, l);
 				s->f[ifp_no].frametype = AST_FRAME_MODEM;
-				s->f[ifp_no].subclass = AST_MODEM_T38;
+				s->f[ifp_no].subclass.codec = AST_MODEM_T38;
 			
 				s->f[ifp_no].mallocd = 0;
 				s->f[ifp_no].seqno = j;
@@ -491,7 +491,7 @@
 	if (seq_no >= s->rx_seq_no) {
 		/* Decode the primary IFP packet */
 		s->f[ifp_no].frametype = AST_FRAME_MODEM;
-		s->f[ifp_no].subclass = AST_MODEM_T38;
+		s->f[ifp_no].subclass.codec = AST_MODEM_T38;
 		
 		s->f[ifp_no].mallocd = 0;
 		s->f[ifp_no].seqno = seq_no;
@@ -988,7 +988,7 @@
 		return 0;
 	
 	if ((f->frametype != AST_FRAME_MODEM) ||
-	    (f->subclass != AST_MODEM_T38)) {
+	    (f->subclass.codec != AST_MODEM_T38)) {
 		ast_log(LOG_WARNING, "UDPTL can only send T.38 data.\n");
 		return -1;
 	}




More information about the svn-commits mailing list