From ebaf59a656ef94e19332c08e0d0562b8cbe59f65 Mon Sep 17 00:00:00 2001 From: Terry Wilson Date: Fri, 24 Feb 2012 00:32:20 +0000 Subject: Opaquification for ast_format structs in struct ast_channel Review: https://reviewboard.asterisk.org/r/1770/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356573 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_amd.c | 4 ++-- apps/app_chanspy.c | 6 +++--- apps/app_confbridge.c | 8 ++++---- apps/app_dictate.c | 2 +- apps/app_dumpchan.c | 8 ++++---- apps/app_fax.c | 4 ++-- apps/app_festival.c | 2 +- apps/app_ices.c | 2 +- apps/app_meetme.c | 2 +- apps/app_mp3.c | 2 +- apps/app_nbscat.c | 2 +- apps/app_record.c | 2 +- apps/app_speech_utils.c | 2 +- apps/app_talkdetect.c | 2 +- apps/app_test.c | 2 +- apps/app_voicemail.c | 10 +++++----- apps/app_waitforsilence.c | 2 +- 17 files changed, 31 insertions(+), 31 deletions(-) (limited to 'apps') diff --git a/apps/app_amd.c b/apps/app_amd.c index 0e0301007..6aefe9ac9 100644 --- a/apps/app_amd.c +++ b/apps/app_amd.c @@ -195,7 +195,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", ast_channel_name(chan), 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(ast_channel_readformat(chan))); /* Lets parse the arguments. */ if (!ast_strlen_zero(parse)) { @@ -244,7 +244,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) minimumWordLength, betweenWordsSilence, maximumNumberOfWords, silenceThreshold, maximumWordLength); /* Set read format to signed linear so we get signed linear frames in */ - ast_format_copy(&readFormat, &chan->readformat); + ast_format_copy(&readFormat, ast_channel_readformat(chan)); 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", ast_channel_name(chan)); pbx_builtin_setvar_helper(chan , "AMDSTATUS", ""); diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 621f98b2c..a7afe9780 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -1123,7 +1123,7 @@ static int chanspy_exec(struct ast_channel *chan, const char *data) ast_clear_flag(&flags, AST_FLAGS_ALL); } - ast_format_copy(&oldwf, &chan->writeformat); + ast_format_copy(&oldwf, ast_channel_writeformat(chan)); if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) { ast_log(LOG_ERROR, "Could Not Set Write Format.\n"); return -1; @@ -1247,7 +1247,7 @@ static int extenspy_exec(struct ast_channel *chan, const char *data) ast_clear_flag(&flags, AST_FLAGS_ALL); } - oldwf = chan->writeformat; + ast_format_copy(&oldwf, ast_channel_writeformat(chan)); if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) { ast_log(LOG_ERROR, "Could Not Set Write Format.\n"); return -1; @@ -1297,7 +1297,7 @@ static int dahdiscan_exec(struct ast_channel *chan, const char *data) ast_set_flag(&flags, OPTION_DTMF_CYCLE); ast_set_flag(&flags, OPTION_DAHDI_SCAN); - ast_format_copy(&oldwf, &chan->writeformat); + ast_format_copy(&oldwf, ast_channel_writeformat(chan)); if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) { ast_log(LOG_ERROR, "Could Not Set Write Format.\n"); return -1; diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index 4e9d5a5e0..299864022 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -380,10 +380,10 @@ static struct ast_channel *rec_request(const char *type, struct ast_format_cap * ast_format_set(&fmt, AST_FORMAT_SLINEAR, 0); ast_channel_tech_set(tmp, &record_tech); ast_format_cap_add_all(ast_channel_nativeformats(tmp)); - ast_format_copy(&tmp->writeformat, &fmt); - ast_format_copy(&tmp->rawwriteformat, &fmt); - ast_format_copy(&tmp->readformat, &fmt); - ast_format_copy(&tmp->rawreadformat, &fmt); + ast_format_copy(ast_channel_writeformat(tmp), &fmt); + ast_format_copy(ast_channel_rawwriteformat(tmp), &fmt); + ast_format_copy(ast_channel_readformat(tmp), &fmt); + ast_format_copy(ast_channel_rawreadformat(tmp), &fmt); return tmp; } diff --git a/apps/app_dictate.c b/apps/app_dictate.c index 2158b8c86..32ee59475 100644 --- a/apps/app_dictate.c +++ b/apps/app_dictate.c @@ -126,7 +126,7 @@ static int dictate_exec(struct ast_channel *chan, const char *data) if (args.argc > 1 && args.filename) { filename = args.filename; } - ast_format_copy(&oldr, &chan->readformat); + ast_format_copy(&oldr, ast_channel_readformat(chan)); 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; diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c index 27e79e198..c16318f68 100644 --- a/apps/app_dumpchan.c +++ b/apps/app_dumpchan.c @@ -143,10 +143,10 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) ast_channel_state(c), ast_channel_rings(c), ast_getformatname_multiple(nf, sizeof(nf), ast_channel_nativeformats(c)), - ast_getformatname(&c->writeformat), - ast_getformatname(&c->readformat), - ast_getformatname(&c->rawwriteformat), - ast_getformatname(&c->rawreadformat), + ast_getformatname(ast_channel_writeformat(c)), + ast_getformatname(ast_channel_readformat(c)), + ast_getformatname(ast_channel_rawwriteformat(c)), + ast_getformatname(ast_channel_rawreadformat(c)), ast_channel_writetrans(c) ? "Yes" : "No", ast_translate_path_to_str(ast_channel_writetrans(c), &write_transpath), ast_channel_readtrans(c) ? "Yes" : "No", diff --git a/apps/app_fax.c b/apps/app_fax.c index 2c2960e78..4d7382b5e 100644 --- a/apps/app_fax.c +++ b/apps/app_fax.c @@ -465,7 +465,7 @@ static int transmit_audio(fax_session *s) t30state = &fax.t30_state; #endif - ast_format_copy(&original_read_fmt, &s->chan->readformat); + ast_format_copy(&original_read_fmt, ast_channel_readformat(s->chan)); if (original_read_fmt.id != AST_FORMAT_SLINEAR) { res = ast_set_read_format_by_id(s->chan, AST_FORMAT_SLINEAR); if (res < 0) { @@ -474,7 +474,7 @@ static int transmit_audio(fax_session *s) } } - ast_format_copy(&original_write_fmt, &s->chan->writeformat); + ast_format_copy(&original_write_fmt, ast_channel_writeformat(s->chan)); if (original_write_fmt.id != AST_FORMAT_SLINEAR) { res = ast_set_write_format_by_id(s->chan, AST_FORMAT_SLINEAR); if (res < 0) { diff --git a/apps/app_festival.c b/apps/app_festival.c index cd1cfa051..fe38bb6fe 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -190,7 +190,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in ast_stopstream(chan); ast_indicate(chan, -1); - ast_format_copy(&owriteformat, &chan->writeformat); + ast_format_copy(&owriteformat, ast_channel_writeformat(chan)); 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"); diff --git a/apps/app_ices.c b/apps/app_ices.c index 13b27fe25..8a57860b4 100644 --- a/apps/app_ices.c +++ b/apps/app_ices.c @@ -145,7 +145,7 @@ static int ices_exec(struct ast_channel *chan, const char *data) return -1; } - ast_format_copy(&oreadformat, &chan->readformat); + ast_format_copy(&oreadformat, ast_channel_readformat(chan)); res = ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR); if (res < 0) { close(fds[0]); diff --git a/apps/app_meetme.c b/apps/app_meetme.c index b6e0c13cb..5b3fa25bd 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -3717,7 +3717,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc )) { int idx; for (idx = 0; idx < AST_FRAME_BITS; idx++) { - if (ast_format_to_old_bitfield(&chan->rawwriteformat) & (1 << idx)) { + if (ast_format_to_old_bitfield(ast_channel_rawwriteformat(chan)) & (1 << idx)) { break; } } diff --git a/apps/app_mp3.c b/apps/app_mp3.c index 4c99be72d..463a91906 100644 --- a/apps/app_mp3.c +++ b/apps/app_mp3.c @@ -168,7 +168,7 @@ static int mp3_exec(struct ast_channel *chan, const char *data) ast_stopstream(chan); - ast_format_copy(&owriteformat, &chan->writeformat); + ast_format_copy(&owriteformat, ast_channel_writeformat(chan)); 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"); diff --git a/apps/app_nbscat.c b/apps/app_nbscat.c index 093653495..8cf02b369 100644 --- a/apps/app_nbscat.c +++ b/apps/app_nbscat.c @@ -132,7 +132,7 @@ static int NBScat_exec(struct ast_channel *chan, const char *data) ast_stopstream(chan); - ast_format_copy(&owriteformat, &chan->writeformat); + ast_format_copy(&owriteformat, ast_channel_writeformat(chan)); 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"); diff --git a/apps/app_record.c b/apps/app_record.c index b7c6bfab7..3499cb118 100644 --- a/apps/app_record.c +++ b/apps/app_record.c @@ -291,7 +291,7 @@ static int record_exec(struct ast_channel *chan, const char *data) /* The end of beep code. Now the recording starts */ if (silence > 0) { - ast_format_copy(&rfmt, &chan->readformat); + ast_format_copy(&rfmt, ast_channel_readformat(chan)); res = ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR); if (res < 0) { ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n"); diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c index 8e6113be8..fdf67bb90 100644 --- a/apps/app_speech_utils.c +++ b/apps/app_speech_utils.c @@ -678,7 +678,7 @@ static int speech_background(struct ast_channel *chan, const char *data) } /* Record old read format */ - ast_format_copy(&oldreadformat, &chan->readformat); + ast_format_copy(&oldreadformat, ast_channel_readformat(chan)); /* Change read format to be signed linear */ if (ast_set_read_format(chan, &speech->format)) diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c index 0250f2262..55904d6d2 100644 --- a/apps/app_talkdetect.c +++ b/apps/app_talkdetect.c @@ -131,7 +131,7 @@ static int background_detect_exec(struct ast_channel *chan, const char *data) } } - ast_format_copy(&origrformat, &chan->readformat); + ast_format_copy(&origrformat, ast_channel_readformat(chan)); if ((ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR))) { ast_log(LOG_WARNING, "Unable to set read format to linear!\n"); res = -1; diff --git a/apps/app_test.c b/apps/app_test.c index bf66824ec..5b7b979e6 100644 --- a/apps/app_test.c +++ b/apps/app_test.c @@ -93,7 +93,7 @@ static int measurenoise(struct ast_channel *chan, int ms, char *who) struct ast_frame *f; struct ast_format rformat; - ast_format_copy(&rformat, &chan->readformat); + ast_format_copy(&rformat, ast_channel_readformat(chan)); if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR)) { ast_log(LOG_NOTICE, "Unable to set to linear mode!\n"); return -1; diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 3a90b9944..2453d01e2 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -12814,12 +12814,12 @@ AST_TEST_DEFINE(test_voicemail_vmsayname) } /* normally this is done in the channel driver */ - ast_format_set(&test_channel1->writeformat, AST_FORMAT_GSM, 0); + ast_format_set(ast_channel_writeformat(test_channel1), AST_FORMAT_GSM, 0); nativeformats = ast_channel_nativeformats(test_channel1); - ast_format_cap_add(nativeformats, &test_channel1->writeformat); - ast_format_set(&test_channel1->rawwriteformat, AST_FORMAT_GSM, 0); - ast_format_set(&test_channel1->readformat, AST_FORMAT_GSM, 0); - ast_format_set(&test_channel1->rawreadformat, AST_FORMAT_GSM, 0); + ast_format_cap_add(nativeformats, ast_channel_writeformat(test_channel1)); + ast_format_set(ast_channel_rawwriteformat(test_channel1), AST_FORMAT_GSM, 0); + ast_format_set(ast_channel_readformat(test_channel1), AST_FORMAT_GSM, 0); + ast_format_set(ast_channel_rawreadformat(test_channel1), AST_FORMAT_GSM, 0); ast_channel_tech_set(test_channel1, &fake_tech); ast_test_status_update(test, "Test playing of extension when greeting is not available...\n"); diff --git a/apps/app_waitforsilence.c b/apps/app_waitforsilence.c index 1964376aa..f79247274 100644 --- a/apps/app_waitforsilence.c +++ b/apps/app_waitforsilence.c @@ -138,7 +138,7 @@ static int do_waiting(struct ast_channel *chan, int timereqd, time_t waitstart, int (*ast_dsp_func)(struct ast_dsp*, struct ast_frame*, int*) = wait_for_silence ? ast_dsp_silence : ast_dsp_noise; - ast_format_copy(&rfmt, &chan->readformat); /* Set to linear mode */ + ast_format_copy(&rfmt, ast_channel_readformat(chan)); /* Set to linear mode */ if ((res = ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR)) < 0) { ast_log(LOG_WARNING, "Unable to set channel to linear mode, giving up\n"); return -1; -- cgit v1.2.3