[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r301841 - in /team/dvossel/f...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 14 13:20:54 CST 2011


Author: dvossel
Date: Fri Jan 14 13:20:48 2011
New Revision: 301841

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=301841
Log:
conversion of all files in app directory

Modified:
    team/dvossel/fixtheworld_phase1_step3/apps/app_alarmreceiver.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_amd.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_chanspy.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_confbridge.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_dahdibarge.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_dictate.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_dumpchan.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_echo.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_fax.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_festival.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_followme.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_ices.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_meetme.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_milliwatt.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_mixmonitor.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_mp3.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_nbscat.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_originate.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_parkandannounce.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_record.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_rpt.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_sms.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_speech_utils.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_talkdetect.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_test.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_voicemail.c
    team/dvossel/fixtheworld_phase1_step3/apps/app_waitforsilence.c
    team/dvossel/fixtheworld_phase1_step3/include/asterisk/format.h
    team/dvossel/fixtheworld_phase1_step3/include/asterisk/slinfactory.h
    team/dvossel/fixtheworld_phase1_step3/include/asterisk/speech.h
    team/dvossel/fixtheworld_phase1_step3/main/format.c
    team/dvossel/fixtheworld_phase1_step3/main/format_cap.c
    team/dvossel/fixtheworld_phase1_step3/res/res_speech.c

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_alarmreceiver.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_alarmreceiver.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_alarmreceiver.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_alarmreceiver.c Fri Jan 14 13:20:48 2011
@@ -191,7 +191,7 @@
 
 		if (f->frametype == AST_FRAME_VOICE) {
 			wf.frametype = AST_FRAME_VOICE;
-			wf.subclass.codec = AST_FORMAT_ULAW;
+			ast_format_set(&wf.subclass.format, AST_FORMAT_ULAW, 0);
 			wf.offset = AST_FRIENDLY_OFFSET;
 			wf.mallocd = 0;
 			wf.data.ptr = tone_block.buf;
@@ -578,12 +578,12 @@
 	/* Set write and read formats to ULAW */
 	ast_verb(4, "AlarmReceiver: Setting read and write formats to ULAW\n");
 
-	if (ast_set_write_format(chan,AST_FORMAT_ULAW)) {
+	if (ast_set_write_format_by_id(chan,AST_FORMAT_ULAW)) {
 		ast_log(LOG_WARNING, "AlarmReceiver: Unable to set write format to Mu-law on %s\n",chan->name);
 		return -1;
 	}
 
-	if (ast_set_read_format(chan,AST_FORMAT_ULAW)) {
+	if (ast_set_read_format_by_id(chan,AST_FORMAT_ULAW)) {
 		ast_log(LOG_WARNING, "AlarmReceiver: Unable to set read format to Mu-law on %s\n",chan->name);
 		return -1;
 	}

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_amd.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_amd.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_amd.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_amd.c Fri Jan 14 13:20:48 2011
@@ -148,7 +148,8 @@
 	int res = 0;
 	struct ast_frame *f = NULL;
 	struct ast_dsp *silenceDetector = NULL;
-	int dspsilence = 0, readFormat, framelength = 0;
+	int dspsilence = 0, framelength = 0;
+	struct ast_format readFormat;
 	int inInitialSilence = 1;
 	int inGreeting = 0;
 	int voiceDuration = 0;
@@ -188,10 +189,11 @@
 		AST_APP_ARG(argMaximumWordLength);
 	);
 
+	ast_format_clear(&readFormat);
 	ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", chan->name,
 		S_COR(chan->caller.ani.number.valid, chan->caller.ani.number.str, "(N/A)"),
 		S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, "(N/A)"),
-		ast_getformatname(chan->readformat));
+		ast_getformatname(&chan->readformat));
 
 	/* Lets parse the arguments. */
 	if (!ast_strlen_zero(parse)) {
@@ -240,8 +242,8 @@
 				minimumWordLength, betweenWordsSilence, maximumNumberOfWords, silenceThreshold, maximumWordLength);
 
 	/* Set read format to signed linear so we get signed linear frames in */
-	readFormat = chan->readformat;
-	if (ast_set_read_format(chan, AST_FORMAT_SLINEAR) < 0 ) {
+	ast_format_copy(&readFormat, &chan->readformat);
+	if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR) < 0 ) {
 		ast_log(LOG_WARNING, "AMD: Channel [%s]. Unable to set to linear mode, giving up\n", chan->name );
 		pbx_builtin_setvar_helper(chan , "AMDSTATUS", "");
 		pbx_builtin_setvar_helper(chan , "AMDCAUSE", "");
@@ -399,7 +401,7 @@
 	pbx_builtin_setvar_helper(chan , "AMDCAUSE" , amdCause);
 
 	/* Restore channel read format */
-	if (readFormat && ast_set_read_format(chan, readFormat))
+	if (readFormat.id && ast_set_read_format(chan, &readFormat))
 		ast_log(LOG_WARNING, "AMD: Unable to restore read format on '%s'\n", chan->name);
 
 	/* Free the DSP used to detect silence */

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_chanspy.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_chanspy.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_chanspy.c Fri Jan 14 13:20:48 2011
@@ -427,6 +427,9 @@
 {
 	struct chanspy_translation_helper *csth = data;
 	struct ast_frame *f, *cur;
+	struct ast_format format_slin;
+
+	ast_format_set(&format_slin, AST_FORMAT_SLINEAR, 0);
 
 	ast_audiohook_lock(&csth->spy_audiohook);
 	if (csth->spy_audiohook.status != AST_AUDIOHOOK_STATUS_RUNNING) {
@@ -437,9 +440,9 @@
 
 	if (ast_test_flag(&csth->spy_audiohook, OPTION_READONLY)) {
 		/* Option 'o' was set, so don't mix channel audio */
-		f = ast_audiohook_read_frame(&csth->spy_audiohook, samples, AST_AUDIOHOOK_DIRECTION_READ, AST_FORMAT_SLINEAR);
+		f = ast_audiohook_read_frame(&csth->spy_audiohook, samples, AST_AUDIOHOOK_DIRECTION_READ, &format_slin);
 	} else {
-		f = ast_audiohook_read_frame(&csth->spy_audiohook, samples, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR);
+		f = ast_audiohook_read_frame(&csth->spy_audiohook, samples, AST_AUDIOHOOK_DIRECTION_BOTH, &format_slin);
 	}
 
 	ast_audiohook_unlock(&csth->spy_audiohook);
@@ -1006,7 +1009,7 @@
 		.volume = '#',
 		.exit = '\0',
 	};
-	int oldwf = 0;
+	struct ast_format oldwf;
 	int volfactor = 0;
 	int res;
 	char *mailbox = NULL;
@@ -1019,6 +1022,7 @@
 	char *parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
+	ast_format_clear(&oldwf);
 
 	if (args.spec && !strcmp(args.spec, "all"))
 		args.spec = NULL;
@@ -1082,8 +1086,8 @@
 		ast_clear_flag(&flags, AST_FLAGS_ALL);
 	}
 
-	oldwf = chan->writeformat;
-	if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
+	ast_format_copy(&oldwf, &chan->writeformat);
+	if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
 		ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
 		return -1;
 	}
@@ -1103,7 +1107,7 @@
 	if (fd)
 		close(fd);
 
-	if (oldwf && ast_set_write_format(chan, oldwf) < 0)
+	if (oldwf.id && ast_set_write_format(chan, &oldwf) < 0)
 		ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
 
 	if (ast_test_flag(&flags, OPTION_EXITONHANGUP)) {
@@ -1125,7 +1129,7 @@
 		.volume = '#',
 		.exit = '\0',
 	};
-	int oldwf = 0;
+	struct ast_format oldwf;
 	int volfactor = 0;
 	int res;
 	char *mailbox = NULL;
@@ -1137,12 +1141,13 @@
 	char *parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
+	ast_format_clear(&oldwf);
+
 	if (!ast_strlen_zero(args.context) && (ptr = strchr(args.context, '@'))) {
 		exten = args.context;
 		*ptr++ = '\0';
 		args.context = ptr;
 	}
-
 	if (ast_strlen_zero(args.context))
 		args.context = ast_strdupa(chan->context);
 
@@ -1206,7 +1211,7 @@
 	}
 
 	oldwf = chan->writeformat;
-	if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
+	if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
 		ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
 		return -1;
 	}
@@ -1227,7 +1232,7 @@
 	if (fd)
 		close(fd);
 
-	if (oldwf && ast_set_write_format(chan, oldwf) < 0)
+	if (oldwf.id && ast_set_write_format(chan, &oldwf) < 0)
 		ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
 
 	return res;
@@ -1242,12 +1247,12 @@
 		.volume = '\0',
 		.exit = '*',
 	};
-	int oldwf = 0;
+	struct ast_format oldwf;
 	int res;
 	char *mygroup = NULL;
 
 	ast_clear_flag(&flags, AST_FLAGS_ALL);
-
+	ast_format_clear(&oldwf);
 	if (!ast_strlen_zero(data)) {
 		mygroup = ast_strdupa(data);
 	}
@@ -1255,15 +1260,15 @@
 	ast_set_flag(&flags, OPTION_DTMF_CYCLE);
 	ast_set_flag(&flags, OPTION_DAHDI_SCAN);
 
-	oldwf = chan->writeformat;
-	if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
+	ast_format_copy(&oldwf, &chan->writeformat);
+	if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
 		ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
 		return -1;
 	}
 
 	res = common_exec(chan, &flags, 0, 0, &user_options, mygroup, NULL, spec, NULL, NULL, NULL, NULL);
 
-	if (oldwf && ast_set_write_format(chan, oldwf) < 0)
+	if (oldwf.id && ast_set_write_format(chan, &oldwf) < 0)
 		ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
 
 	return res;

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_confbridge.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_confbridge.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_confbridge.c Fri Jan 14 13:20:48 2011
@@ -567,11 +567,18 @@
 
 	if (!(conference_bridge->playback_chan)) {
 		int cause;
-
-		if (!(conference_bridge->playback_chan = ast_request("Bridge", AST_FORMAT_SLINEAR, NULL, "", &cause))) {
+		struct ast_cap *cap = ast_cap_alloc();
+		struct ast_format tmpfmt;
+		if (!cap) {
+			return -1;
+		}
+		ast_cap_add(cap, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
+		if (!(conference_bridge->playback_chan = ast_request("Bridge", cap, NULL, "", &cause))) {
 			ast_mutex_unlock(&conference_bridge->playback_lock);
+			cap = ast_cap_destroy(cap);
 			return -1;
 		}
+		cap = ast_cap_destroy(cap);
 
 		conference_bridge->playback_chan->bridge = conference_bridge->bridge;
 

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_dahdibarge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_dahdibarge.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_dahdibarge.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_dahdibarge.c Fri Jan 14 13:20:48 2011
@@ -113,13 +113,13 @@
 	char *buf = __buf + AST_FRIENDLY_OFFSET;
 
 	/* Set it into U-law mode (write) */
-	if (ast_set_write_format(chan, AST_FORMAT_ULAW) < 0) {
+	if (ast_set_write_format_by_id(chan, AST_FORMAT_ULAW) < 0) {
 		ast_log(LOG_WARNING, "Unable to set '%s' to write ulaw mode\n", chan->name);
 		goto outrun;
 	}
 
 	/* Set it into U-law mode (read) */
-	if (ast_set_read_format(chan, AST_FORMAT_ULAW) < 0) {
+	if (ast_set_read_format_by_id(chan, AST_FORMAT_ULAW) < 0) {
 		ast_log(LOG_WARNING, "Unable to set '%s' to read ulaw mode\n", chan->name);
 		goto outrun;
 	}
@@ -214,11 +214,11 @@
 				break;
 			} else if (fd != chan->fds[0]) {
 				if (f->frametype == AST_FRAME_VOICE) {
-					if (f->subclass.codec == AST_FORMAT_ULAW) {
+					if (f->subclass.format.id == AST_FORMAT_ULAW) {
 						/* Carefully write */
 						careful_write(fd, f->data.ptr, f->datalen);
 					} else
-						ast_log(LOG_WARNING, "Huh?  Got a non-ulaw (%s) frame in the conference\n", ast_getformatname(f->subclass.codec));
+						ast_log(LOG_WARNING, "Huh?  Got a non-ulaw (%s) frame in the conference\n", ast_getformatname(&f->subclass.format));
 				}
 			}
 			ast_frfree(f);
@@ -227,7 +227,7 @@
 			if (res > 0) {
 				memset(&fr, 0, sizeof(fr));
 				fr.frametype = AST_FRAME_VOICE;
-				fr.subclass.codec = AST_FORMAT_ULAW;
+				ast_format_set(&fr.subclass.format, AST_FORMAT_ULAW, 0);
 				fr.datalen = res;
 				fr.samples = res;
 				fr.data.ptr = buf;

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_dictate.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_dictate.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_dictate.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_dictate.c Fri Jan 14 13:20:48 2011
@@ -97,7 +97,6 @@
 	int ffactor = 320 * 80,
 		res = 0,
 		done = 0,
-		oldr = 0,
 		lastop = 0,
 		samples = 0,
 		speed = 1,
@@ -105,6 +104,8 @@
 		len = 0,
 		maxlen = 0,
 		mode = 0;
+	struct ast_format oldr;
+	ast_format_clear(&oldr);
 
 	snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
 	if (!ast_strlen_zero(data)) {
@@ -121,8 +122,8 @@
 	if (args.argc > 1 && args.filename) {
 		filename = args.filename;
 	}
-	oldr = chan->readformat;
-	if ((res = ast_set_read_format(chan, AST_FORMAT_SLINEAR)) < 0) {
+	ast_format_copy(&oldr, &chan->readformat);
+	if ((res = ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR)) < 0) {
 		ast_log(LOG_WARNING, "Unable to set to linear mode.\n");
 		return -1;
 	}
@@ -330,8 +331,8 @@
 			ast_frfree(f);
 		}
 	}
-	if (oldr) {
-		ast_set_read_format(chan, oldr);
+	if (oldr.id) {
+		ast_set_read_format(chan, &oldr);
 	}
 	return 0;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_dumpchan.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_dumpchan.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_dumpchan.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_dumpchan.c Fri Jan 14 13:20:48 2011
@@ -126,10 +126,10 @@
 			c->_state,
 			c->rings,
 			ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->nativeformats),
-			ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->writeformat),
-			ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->readformat),
-			ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->rawwriteformat),
-			ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->rawreadformat),
+			ast_getformatname(&c->writeformat),
+			ast_getformatname(&c->readformat),
+			ast_getformatname(&c->rawwriteformat),
+			ast_getformatname(&c->rawreadformat),
 			c->fds[0], c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
 			c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", (long)c->whentohangup.tv_sec,
 			hour,

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_echo.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_echo.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_echo.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_echo.c Fri Jan 14 13:20:48 2011
@@ -51,11 +51,11 @@
 static int echo_exec(struct ast_channel *chan, const char *data)
 {
 	int res = -1;
-	format_t format;
+	struct ast_format format;
 
-	format = ast_best_codec(chan->nativeformats);
-	ast_set_write_format(chan, format);
-	ast_set_read_format(chan, format);
+	ast_best_codec(chan->nativeformats, &format);
+	ast_set_write_format(chan, &format);
+	ast_set_read_format(chan, &format);
 
 	while (ast_waitfor(chan, -1) > -1) {
 		struct ast_frame *f = ast_read(chan);

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_fax.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_fax.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_fax.c Fri Jan 14 13:20:48 2011
@@ -329,9 +329,9 @@
     
 	struct ast_frame outf = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_SLINEAR,
 		.src = __FUNCTION__,
 	};
+	ast_format_set(&outf.subclass.format, AST_FORMAT_SLINEAR, 0);
 
 	if (samples > MAX_SAMPLES) {
 		ast_log(LOG_WARNING, "Only generating %d samples, where %d requested\n", MAX_SAMPLES, samples);
@@ -362,8 +362,8 @@
 static int transmit_audio(fax_session *s)
 {
 	int res = -1;
-	int original_read_fmt = AST_FORMAT_SLINEAR;
-	int original_write_fmt = AST_FORMAT_SLINEAR;
+	struct ast_format original_read_fmt;
+	struct ast_format original_write_fmt;
 	fax_state_t fax;
 	t30_state_t *t30state;
 	struct ast_frame *inf = NULL;
@@ -382,6 +382,9 @@
  *							     .transcoding_jbig = 1,
 */
 	};
+
+	ast_format_clear(&original_read_fmt);
+	ast_format_clear(&original_write_fmt);
 
 	/* if in called party mode, try to use T.38 */
 	if (s->caller_mode == FALSE) {
@@ -455,18 +458,18 @@
         t30state = &fax.t30_state;
 #endif
 
-	original_read_fmt = s->chan->readformat;
-	if (original_read_fmt != AST_FORMAT_SLINEAR) {
-		res = ast_set_read_format(s->chan, AST_FORMAT_SLINEAR);
+	ast_format_copy(&original_read_fmt, &s->chan->readformat);
+	if (original_read_fmt.id != AST_FORMAT_SLINEAR) {
+		res = ast_set_read_format_by_id(s->chan, AST_FORMAT_SLINEAR);
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Unable to set to linear read mode, giving up\n");
 			goto done;
 		}
 	}
 
-	original_write_fmt = s->chan->writeformat;
-	if (original_write_fmt != AST_FORMAT_SLINEAR) {
-		res = ast_set_write_format(s->chan, AST_FORMAT_SLINEAR);
+	ast_format_copy(&original_write_fmt, &s->chan->writeformat);
+	if (original_write_fmt.id != AST_FORMAT_SLINEAR) {
+		res = ast_set_write_format_by_id(s->chan, AST_FORMAT_SLINEAR);
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Unable to set to linear write mode, giving up\n");
 			goto done;
@@ -523,12 +526,12 @@
 			break;
 		}
 
-		ast_debug(10, "frame %d/%llu, len=%d\n", inf->frametype, (unsigned long long) inf->subclass.codec, inf->datalen);
+		ast_debug(10, "frame %d/%u, len=%d\n", inf->frametype, (unsigned int) inf->subclass.format.id, inf->datalen);
 
 		/* Check the frame type. Format also must be checked because there is a chance
 		   that a frame in old format was already queued before we set channel format
 		   to slinear so it will still be received by ast_read */
-		if (inf->frametype == AST_FRAME_VOICE && inf->subclass.codec == AST_FORMAT_SLINEAR) {
+		if (inf->frametype == AST_FRAME_VOICE && inf->subclass.format.id == AST_FORMAT_SLINEAR) {
 			if (fax_rx(&fax, inf->data.ptr, inf->samples) < 0) {
 				/* I know fax_rx never returns errors. The check here is for good style only */
 				ast_log(LOG_WARNING, "fax_rx returned error\n");
@@ -582,13 +585,13 @@
 	fax_release(&fax);
 
 done:
-	if (original_write_fmt != AST_FORMAT_SLINEAR) {
-		if (ast_set_write_format(s->chan, original_write_fmt) < 0)
+	if (original_write_fmt.id != AST_FORMAT_SLINEAR) {
+		if (ast_set_write_format(s->chan, &original_write_fmt) < 0)
 			ast_log(LOG_WARNING, "Unable to restore write format on '%s'\n", s->chan->name);
 	}
 
-	if (original_read_fmt != AST_FORMAT_SLINEAR) {
-		if (ast_set_read_format(s->chan, original_read_fmt) < 0)
+	if (original_read_fmt.id != AST_FORMAT_SLINEAR) {
+		if (ast_set_read_format(s->chan, &original_read_fmt) < 0)
 			ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", s->chan->name);
 	}
 

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_festival.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_festival.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_festival.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_festival.c Fri Jan 14 13:20:48 2011
@@ -165,7 +165,7 @@
 	int fds[2];
 	int pid = -1;
 	int needed = 0;
-	int owriteformat;
+	struct ast_format owriteformat;
 	struct ast_frame *f;
 	struct myframe {
 		struct ast_frame f;
@@ -175,6 +175,7 @@
 		.f = { 0, },
 	};
 
+	ast_format_clear(&owriteformat);
 	if (pipe(fds)) {
 		ast_log(LOG_WARNING, "Unable to create pipe\n");
 		return -1;
@@ -186,8 +187,8 @@
 	ast_stopstream(chan);
 	ast_indicate(chan, -1);
 	
-	owriteformat = chan->writeformat;
-	res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
+	ast_format_copy(&owriteformat, &chan->writeformat);
+	res = ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR);
 	if (res < 0) {
 		ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
 		return -1;
@@ -229,7 +230,7 @@
 				res = read(fds[0], myf.frdata, needed);
 				if (res > 0) {
 					myf.f.frametype = AST_FRAME_VOICE;
-					myf.f.subclass.codec = AST_FORMAT_SLINEAR;
+					ast_format_set(&myf.f.subclass.format, AST_FORMAT_SLINEAR, 0);
 					myf.f.datalen = res;
 					myf.f.samples = res / 2;
 					myf.f.offset = AST_FRIENDLY_OFFSET;
@@ -261,8 +262,8 @@
 	if (pid > -1)
 		kill(pid, SIGKILL);
 #endif
-	if (!res && owriteformat)
-		ast_set_write_format(chan, owriteformat);
+	if (!res && owriteformat.id)
+		ast_set_write_format(chan, &owriteformat);
 	return res;
 }
 

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_followme.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_followme.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_followme.c Fri Jan 14 13:20:48 2011
@@ -841,7 +841,7 @@
 				return;
 			}
 
-			outbound = ast_request("Local", ast_best_codec(caller->nativeformats), caller, dialarg, &dg);
+			outbound = ast_request("Local", caller->nativeformats, caller, dialarg, &dg);
 			if (outbound) {
 				ast_set_callerid(outbound,
 					S_COR(caller->caller.id.number.valid, caller->caller.id.number.str, NULL),

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_ices.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_ices.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_ices.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_ices.c Fri Jan 14 13:20:48 2011
@@ -111,12 +111,13 @@
 	int ms = -1;
 	int pid = -1;
 	int flags;
-	int oreadformat;
+	struct ast_format oreadformat;
 	struct timeval last;
 	struct ast_frame *f;
 	char filename[256]="";
 	char *c;
 
+	ast_format_clear(&oreadformat);
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "ICES requires an argument (configfile.xml)\n");
 		return -1;
@@ -143,8 +144,8 @@
 		return -1;
 	}
 
-	oreadformat = chan->readformat;
-	res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
+	ast_format_copy(&oreadformat, &chan->readformat);
+	res = ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR);
 	if (res < 0) {
 		close(fds[0]);
 		close(fds[1]);
@@ -195,8 +196,8 @@
 
 	if (pid > -1)
 		kill(pid, SIGKILL);
-	if (!res && oreadformat)
-		ast_set_read_format(chan, oreadformat);
+	if (!res && oreadformat.id)
+		ast_set_read_format(chan, &oreadformat);
 
 	return res;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_meetme.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_meetme.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_meetme.c Fri Jan 14 13:20:48 2011
@@ -1189,6 +1189,8 @@
 	struct ast_conference *cnf;
 	struct dahdi_confinfo dahdic = { 0, };
 	int confno_int = 0;
+	struct ast_cap *cap_slin = ast_cap_alloc();
+	struct ast_format tmp_fmt;
 
 	AST_LIST_LOCK(&confs);
 
@@ -1197,9 +1199,10 @@
 			break;
 	}
 
-	if (cnf || (!make && !dynamic))
+	if (cnf || (!make && !dynamic) || !cap_slin)
 		goto cnfout;
 
+	ast_cap_add(cap_slin, ast_format_set(&tmp_fmt, AST_FORMAT_SLINEAR, 0));
 	/* Make a new one */
 	if (!(cnf = ast_calloc(1, sizeof(*cnf))) ||
 		!(cnf->usercontainer = ao2_container_alloc(1, NULL, user_no_cmp))) {
@@ -1240,10 +1243,10 @@
 	cnf->dahdiconf = dahdic.confno;
 
 	/* Setup a new channel for playback of audio files */
-	cnf->chan = ast_request("DAHDI", AST_FORMAT_SLINEAR, chan, "pseudo", NULL);
+	cnf->chan = ast_request("DAHDI", cap_slin, chan, "pseudo", NULL);
 	if (cnf->chan) {
-		ast_set_read_format(cnf->chan, AST_FORMAT_SLINEAR);
-		ast_set_write_format(cnf->chan, AST_FORMAT_SLINEAR);
+		ast_set_read_format_by_id(cnf->chan, AST_FORMAT_SLINEAR);
+		ast_set_write_format_by_id(cnf->chan, AST_FORMAT_SLINEAR);
 		dahdic.chan = 0;
 		dahdic.confno = cnf->dahdiconf;
 		dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
@@ -1275,6 +1278,7 @@
 		conf_map[confno_int] = 1;
 	
 cnfout:
+	cap_slin = ast_cap_destroy(cap_slin);
 	if (cnf)
 		ast_atomic_fetchadd_int(&cnf->refcount, refcount);
 
@@ -2252,9 +2256,16 @@
 	int setusercount = 0;
 	int confsilence = 0, totalsilence = 0;
 	char *mailbox, *context;
+	struct ast_cap *cap_slin = ast_cap_alloc();
+	struct ast_format tmpfmt;
+
+	if (!cap_slin) {
+		goto conf_run_cleanup;
+	}
+	ast_cap_add(cap_slin, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
 
 	if (!(user = ao2_alloc(sizeof(*user), NULL))) {
-		return ret;
+		goto conf_run_cleanup;
 	}
 
 	/* Possible timeout waiting for marked user */
@@ -2364,9 +2375,9 @@
 
 	ast_mutex_lock(&conf->recordthreadlock);
 	if ((conf->recordthread == AST_PTHREADT_NULL) && ast_test_flag64(confflags, CONFFLAG_RECORDCONF) &&
-		((conf->lchan = ast_request("DAHDI", AST_FORMAT_SLINEAR, chan, "pseudo", NULL)))) {
-		ast_set_read_format(conf->lchan, AST_FORMAT_SLINEAR);
-		ast_set_write_format(conf->lchan, AST_FORMAT_SLINEAR);
+		((conf->lchan = ast_request("DAHDI", cap_slin, chan, "pseudo", NULL)))) {
+		ast_set_read_format_by_id(conf->lchan, AST_FORMAT_SLINEAR);
+		ast_set_write_format_by_id(conf->lchan, AST_FORMAT_SLINEAR);
 		dahdic.chan = 0;
 		dahdic.confno = conf->dahdiconf;
 		dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
@@ -2593,12 +2604,12 @@
 		ast_indicate(chan, -1);
 	}
 
-	if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
+	if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
 		ast_log(LOG_WARNING, "Unable to set '%s' to write linear mode\n", chan->name);
 		goto outrun;
 	}
 
-	if (ast_set_read_format(chan, AST_FORMAT_SLINEAR) < 0) {
+	if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
 		ast_log(LOG_WARNING, "Unable to set '%s' to read linear mode\n", chan->name);
 		goto outrun;
 	}
@@ -2670,8 +2681,10 @@
 	if (!ast_test_flag64(confflags, CONFFLAG_QUIET) && (ast_test_flag64(confflags, CONFFLAG_INTROUSER) ||
 			ast_test_flag64(confflags, CONFFLAG_INTROUSERNOREVIEW) || ast_test_flag64(confflags, CONFFLAG_INTROUSER_VMREC)) && conf->users > 1) {
 		struct announce_listitem *item;
-		if (!(item = ao2_alloc(sizeof(*item), NULL)))
-			return -1;
+		if (!(item = ao2_alloc(sizeof(*item), NULL))) {
+			ret = -1;
+			goto conf_run_cleanup;
+		}
 		ast_copy_string(item->namerecloc, user->namerecloc, sizeof(item->namerecloc));
 		ast_copy_string(item->language, chan->language, sizeof(item->language));
 		item->confchan = conf->chan;
@@ -3154,7 +3167,7 @@
 					dtmfstr[1] = '\0';
 				}
 
-				if ((f->frametype == AST_FRAME_VOICE) && (f->subclass.codec == AST_FORMAT_SLINEAR)) {
+				if ((f->frametype == AST_FRAME_VOICE) && (f->subclass.format.id == AST_FORMAT_SLINEAR)) {
 					if (user->talk.actual) {
 						ast_frame_adjust_volume(f, user->talk.actual);
 					}
@@ -3325,9 +3338,9 @@
 									}
 
 									ast_mutex_lock(&conf->recordthreadlock);
-									if ((conf->recordthread == AST_PTHREADT_NULL) && ast_test_flag64(confflags, CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("DAHDI", AST_FORMAT_SLINEAR, chan, "pseudo", NULL)))) {
-										ast_set_read_format(conf->lchan, AST_FORMAT_SLINEAR);
-										ast_set_write_format(conf->lchan, AST_FORMAT_SLINEAR);
+									if ((conf->recordthread == AST_PTHREADT_NULL) && ast_test_flag64(confflags, CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("DAHDI", cap_slin, chan, "pseudo", NULL)))) {
+										ast_set_read_format_by_id(conf->lchan, AST_FORMAT_SLINEAR);
+										ast_set_write_format_by_id(conf->lchan, AST_FORMAT_SLINEAR);
 										dahdic.chan = 0;
 										dahdic.confno = conf->dahdiconf;
 										dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
@@ -3612,7 +3625,7 @@
 				if (res > 0) {
 					memset(&fr, 0, sizeof(fr));
 					fr.frametype = AST_FRAME_VOICE;
-					fr.subclass.codec = AST_FORMAT_SLINEAR;
+					ast_format_set(&fr.subclass.format, AST_FORMAT_SLINEAR, 0);
 					fr.datalen = res;
 					fr.samples = res / 2;
 					fr.data.ptr = buf;
@@ -3624,7 +3637,7 @@
 						 )) {
 						int idx;
 						for (idx = 0; idx < AST_FRAME_BITS; idx++) {
-							if (chan->rawwriteformat & (1 << idx)) {
+							if (ast_format_to_old_bitfield(&chan->rawwriteformat) & (1 << idx)) {
 								break;
 							}
 						}
@@ -3639,7 +3652,11 @@
 									mohtempstopped = 1;
 								}
 								if (!conf->transpath[idx]) {
-									conf->transpath[idx] = ast_translator_build_path((1 << idx), AST_FORMAT_SLINEAR);
+									struct ast_format src;
+									struct ast_format dst;
+									ast_format_set(&src, AST_FORMAT_SLINEAR, 0);
+									ast_format_from_old_bitfield(&dst, (1 << idx));
+									conf->transpath[idx] = ast_translator_build_path(&dst, &src);
 								}
 								if (conf->transpath[idx]) {
 									conf->transframe[idx] = ast_translate(conf->transpath[idx], conf->origframe, 0);
@@ -3722,8 +3739,10 @@
 
 	if (!ast_test_flag64(confflags, CONFFLAG_QUIET) && ast_test_flag64(confflags, CONFFLAG_INTROUSER |CONFFLAG_INTROUSERNOREVIEW | CONFFLAG_INTROUSER_VMREC) && conf->users > 1) {
 		struct announce_listitem *item;
-		if (!(item = ao2_alloc(sizeof(*item), NULL)))
-			return -1;
+		if (!(item = ao2_alloc(sizeof(*item), NULL))) {
+			res = -1;
+			goto conf_run_cleanup;
+		}
 		ast_copy_string(item->namerecloc, user->namerecloc, sizeof(item->namerecloc));
 		ast_copy_string(item->language, chan->language, sizeof(item->language));
 		item->confchan = conf->chan;
@@ -3805,6 +3824,10 @@
 		}
 	}
 	AST_LIST_UNLOCK(&confs);
+
+
+conf_run_cleanup:
+	cap_slin = ast_cap_destroy(cap_slin);
 
 	return ret;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_milliwatt.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_milliwatt.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_milliwatt.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_milliwatt.c Fri Jan 14 13:20:48 2011
@@ -78,10 +78,10 @@
 	int i, *indexp = (int *) data;
 	struct ast_frame wf = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_ULAW,
 		.offset = AST_FRIENDLY_OFFSET,
 		.src = __FUNCTION__,
 	};
+	ast_format_set(&wf.subclass.format, AST_FORMAT_ULAW, 0);
 	wf.data.ptr = buf + AST_FRIENDLY_OFFSET;
 
 	/* Instead of len, use samples, because channel.c generator_force
@@ -120,8 +120,8 @@
 
 static int old_milliwatt_exec(struct ast_channel *chan)
 {
-	ast_set_write_format(chan, AST_FORMAT_ULAW);
-	ast_set_read_format(chan, AST_FORMAT_ULAW);
+	ast_set_write_format_by_id(chan, AST_FORMAT_ULAW);
+	ast_set_read_format_by_id(chan, AST_FORMAT_ULAW);
 
 	if (chan->_state != AST_STATE_UP) {
 		ast_answer(chan);

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_mixmonitor.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_mixmonitor.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_mixmonitor.c Fri Jan 14 13:20:48 2011
@@ -281,7 +281,9 @@
 	unsigned int oflags;
 	char *ext;
 	int errflag = 0;
-
+	struct ast_format format_slin;
+
+	ast_format_set(&format_slin, AST_FORMAT_SLINEAR, 0);
 	ast_verb(2, "Begin MixMonitor Recording %s\n", mixmonitor->name);
 
 	fs = &mixmonitor->mixmonitor_ds->fs;
@@ -291,7 +293,7 @@
 	while (mixmonitor->audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING && !mixmonitor->mixmonitor_ds->fs_quit) {
 		struct ast_frame *fr = NULL;
 
-		if (!(fr = ast_audiohook_read_frame(&mixmonitor->audiohook, SAMPLES_PER_FRAME, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR))) {
+		if (!(fr = ast_audiohook_read_frame(&mixmonitor->audiohook, SAMPLES_PER_FRAME, AST_AUDIOHOOK_DIRECTION_BOTH, &format_slin))) {
 			ast_audiohook_trigger_wait(&mixmonitor->audiohook);
 
 			if (mixmonitor->audiohook.status != AST_AUDIOHOOK_STATUS_RUNNING) {

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_mp3.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_mp3.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_mp3.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_mp3.c Fri Jan 14 13:20:48 2011
@@ -137,7 +137,7 @@
 	int fds[2];
 	int ms = -1;
 	int pid = -1;
-	int owriteformat;
+	struct ast_format owriteformat;
 	int timeout = 2000;
 	struct timeval next;
 	struct ast_frame *f;
@@ -149,6 +149,7 @@
 		.f = { 0, },
 	};
 
+	ast_format_clear(&owriteformat);
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "MP3 Playback requires an argument (filename)\n");
 		return -1;
@@ -161,8 +162,8 @@
 	
 	ast_stopstream(chan);
 
-	owriteformat = chan->writeformat;
-	res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
+	ast_format_copy(&owriteformat, &chan->writeformat);
+	res = ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR);
 	if (res < 0) {
 		ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
 		return -1;
@@ -185,7 +186,7 @@
 				res = timed_read(fds[0], myf.frdata, sizeof(myf.frdata), timeout);
 				if (res > 0) {
 					myf.f.frametype = AST_FRAME_VOICE;
-					myf.f.subclass.codec = AST_FORMAT_SLINEAR;
+					ast_format_set(&myf.f.subclass.format, AST_FORMAT_SLINEAR, 0);
 					myf.f.datalen = res;
 					myf.f.samples = res / 2;
 					myf.f.mallocd = 0;
@@ -234,8 +235,8 @@
 	
 	if (pid > -1)
 		kill(pid, SIGKILL);
-	if (!res && owriteformat)
-		ast_set_write_format(chan, owriteformat);
+	if (!res && owriteformat.id)
+		ast_set_write_format(chan, &owriteformat);
 	
 	return res;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_nbscat.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_nbscat.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_nbscat.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_nbscat.c Fri Jan 14 13:20:48 2011
@@ -111,7 +111,7 @@
 	int fds[2];
 	int ms = -1;
 	int pid = -1;
-	int owriteformat;
+	struct ast_format owriteformat;
 	struct timeval next;
 	struct ast_frame *f;
 	struct myframe {
@@ -119,7 +119,8 @@
 		char offset[AST_FRIENDLY_OFFSET];
 		short frdata[160];
 	} myf;
-	
+
+	ast_format_clear(&owriteformat);
 	if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds)) {
 		ast_log(LOG_WARNING, "Unable to create socketpair\n");
 		return -1;
@@ -127,8 +128,8 @@
 	
 	ast_stopstream(chan);
 
-	owriteformat = chan->writeformat;
-	res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
+	ast_format_copy(&owriteformat, &chan->writeformat);
+	res = ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR);
 	if (res < 0) {
 		ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
 		return -1;
@@ -148,7 +149,7 @@
 				res = timed_read(fds[0], myf.frdata, sizeof(myf.frdata));
 				if (res > 0) {
 					myf.f.frametype = AST_FRAME_VOICE;
-					myf.f.subclass.codec = AST_FORMAT_SLINEAR;
+					ast_format_set(&myf.f.subclass.format, AST_FORMAT_SLINEAR, 0);
 					myf.f.datalen = res;
 					myf.f.samples = res / 2;
 					myf.f.mallocd = 0;
@@ -197,8 +198,8 @@
 	
 	if (pid > -1)
 		kill(pid, SIGKILL);
-	if (!res && owriteformat)
-		ast_set_write_format(chan, owriteformat);
+	if (!res && owriteformat.id)
+		ast_set_write_format(chan, &owriteformat);
 
 	return res;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_originate.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_originate.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/apps/app_originate.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/apps/app_originate.c Fri Jan 14 13:20:48 2011
@@ -105,8 +105,14 @@
 	int outgoing_status = 0;
 	static const unsigned int timeout = 30;
 	static const char default_exten[] = "s";
+	struct ast_format tmpfmt;
+	struct ast_cap *cap_slin = ast_cap_alloc();
 
 	ast_autoservice_start(chan);
+	if (!cap_slin) {
+		goto return_cleanup;
+	}
+	ast_cap_add(cap_slin, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_ERROR, "Originate() requires arguments\n");
@@ -148,14 +154,14 @@
 		ast_debug(1, "Originating call to '%s/%s' and connecting them to extension %s,%s,%d\n",
 				chantech, chandata, args.arg1, exten, priority);
 
-		outgoing_res = ast_pbx_outgoing_exten(chantech, AST_FORMAT_SLINEAR, chandata,
+		outgoing_res = ast_pbx_outgoing_exten(chantech, cap_slin, chandata,
 				timeout * 1000, args.arg1, exten, priority, &outgoing_status, 0, NULL,
 				NULL, NULL, NULL, NULL);
 	} else if (!strcasecmp(args.type, "app")) {
 		ast_debug(1, "Originating call to '%s/%s' and connecting them to %s(%s)\n",
 				chantech, chandata, args.arg1, S_OR(args.arg2, ""));
 
-		outgoing_res = ast_pbx_outgoing_app(chantech, AST_FORMAT_SLINEAR, chandata,
+		outgoing_res = ast_pbx_outgoing_app(chantech, cap_slin, chandata,
 				timeout * 1000, args.arg1, args.arg2, &outgoing_status, 0, NULL,
 				NULL, NULL, NULL, NULL);
 	} else {
@@ -194,7 +200,7 @@
 			break;
 		}
 	}
-
+	cap_slin = ast_cap_destroy(cap_slin);
 	ast_autoservice_stop(chan);
 
 	return res;

Modified: team/dvossel/fixtheworld_phase1_step3/apps/app_parkandannounce.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/apps/app_parkandannounce.c?view=diff&rev=301841&r1=301840&r2=301841
==============================================================================

[... 955 lines stripped ...]



More information about the asterisk-commits mailing list