summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2012-02-24 00:32:20 +0000
committerTerry Wilson <twilson@digium.com>2012-02-24 00:32:20 +0000
commitebaf59a656ef94e19332c08e0d0562b8cbe59f65 (patch)
tree6e75fd13924808bddacc18e14d5e02975a322481 /main
parent235f88d12270b328ad466889189400666b3e56c1 (diff)
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
Diffstat (limited to 'main')
-rw-r--r--main/app.c4
-rw-r--r--main/bridging.c14
-rw-r--r--main/channel.c74
-rw-r--r--main/channel_internal_api.c30
-rw-r--r--main/cli.c4
-rw-r--r--main/features.c24
-rw-r--r--main/file.c10
-rw-r--r--main/indications.c2
-rw-r--r--main/pbx.c8
-rw-r--r--main/rtp_engine.c4
10 files changed, 97 insertions, 77 deletions
diff --git a/main/app.c b/main/app.c
index 821c2fbfb..d9f56a4aa 100644
--- a/main/app.c
+++ b/main/app.c
@@ -512,7 +512,7 @@ static void *linear_alloc(struct ast_channel *chan, void *params)
ast_clear_flag(chan, AST_FLAG_WRITE_INT);
}
- ast_format_copy(&ls->origwfmt, &chan->writeformat);
+ ast_format_copy(&ls->origwfmt, ast_channel_writeformat(chan));
if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR)) {
ast_log(LOG_WARNING, "Unable to set '%s' to linear format (write)\n", ast_channel_name(chan));
@@ -828,7 +828,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
return -1;
}
ast_dsp_set_threshold(sildet, silencethreshold);
- 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/main/bridging.c b/main/bridging.c
index 8fecd53b7..9a549691f 100644
--- a/main/bridging.c
+++ b/main/bridging.c
@@ -553,11 +553,11 @@ int ast_bridge_destroy(struct ast_bridge *bridge)
static int bridge_make_compatible(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
{
struct ast_format formats[2];
- ast_format_copy(&formats[0], &bridge_channel->chan->readformat);
- ast_format_copy(&formats[1], &bridge_channel->chan->writeformat);
+ ast_format_copy(&formats[0], ast_channel_readformat(bridge_channel->chan));
+ ast_format_copy(&formats[1], ast_channel_writeformat(bridge_channel->chan));
/* Are the formats currently in use something ths bridge can handle? */
- if (!ast_format_cap_iscompatible(bridge->technology->format_capabilities, &bridge_channel->chan->readformat)) {
+ if (!ast_format_cap_iscompatible(bridge->technology->format_capabilities, ast_channel_readformat(bridge_channel->chan))) {
struct ast_format best_format;
ast_best_codec(bridge->technology->format_capabilities, &best_format);
@@ -917,8 +917,8 @@ static enum ast_bridge_channel_state bridge_channel_join(struct ast_bridge_chann
{
struct ast_format formats[2];
enum ast_bridge_channel_state state;
- ast_format_copy(&formats[0], &bridge_channel->chan->readformat);
- ast_format_copy(&formats[1], &bridge_channel->chan->writeformat);
+ ast_format_copy(&formats[0], ast_channel_readformat(bridge_channel->chan));
+ ast_format_copy(&formats[1], ast_channel_writeformat(bridge_channel->chan));
/* Record the thread that will be the owner of us */
bridge_channel->thread = pthread_self();
@@ -1035,13 +1035,13 @@ static enum ast_bridge_channel_state bridge_channel_join(struct ast_bridge_chann
ao2_unlock(bridge_channel->bridge);
/* Restore original formats of the channel as they came in */
- if (ast_format_cmp(&bridge_channel->chan->readformat, &formats[0]) == AST_FORMAT_CMP_NOT_EQUAL) {
+ if (ast_format_cmp(ast_channel_readformat(bridge_channel->chan), &formats[0]) == AST_FORMAT_CMP_NOT_EQUAL) {
ast_debug(1, "Bridge is returning %p to read format %s(%d)\n", bridge_channel, ast_getformatname(&formats[0]), formats[0].id);
if (ast_set_read_format(bridge_channel->chan, &formats[0])) {
ast_debug(1, "Bridge failed to return channel %p to read format %s(%d)\n", bridge_channel, ast_getformatname(&formats[0]), formats[0].id);
}
}
- if (ast_format_cmp(&bridge_channel->chan->writeformat, &formats[1]) == AST_FORMAT_CMP_NOT_EQUAL) {
+ if (ast_format_cmp(ast_channel_writeformat(bridge_channel->chan), &formats[1]) == AST_FORMAT_CMP_NOT_EQUAL) {
ast_debug(1, "Bridge is returning %p to write format %s(%d)\n", bridge_channel, ast_getformatname(&formats[1]), formats[1].id);
if (ast_set_write_format(bridge_channel->chan, &formats[1])) {
ast_debug(1, "Bridge failed to return channel %p to write format %s(%d)\n", bridge_channel, ast_getformatname(&formats[1]), formats[1].id);
diff --git a/main/channel.c b/main/channel.c
index 35396308b..95fb9259a 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -2541,13 +2541,13 @@ static void free_translation(struct ast_channel *clonechan)
ast_channel_writetrans_set(clonechan, NULL);
ast_channel_readtrans_set(clonechan, NULL);
if (ast_format_cap_is_empty(ast_channel_nativeformats(clonechan))) {
- ast_format_clear(&clonechan->rawwriteformat);
- ast_format_clear(&clonechan->rawreadformat);
+ ast_format_clear(ast_channel_rawwriteformat(clonechan));
+ ast_format_clear(ast_channel_rawreadformat(clonechan));
} else {
struct ast_format tmpfmt;
ast_best_codec(ast_channel_nativeformats(clonechan), &tmpfmt);
- ast_format_copy(&clonechan->rawwriteformat, &tmpfmt);
- ast_format_copy(&clonechan->rawreadformat, &tmpfmt);
+ ast_format_copy(ast_channel_rawwriteformat(clonechan), &tmpfmt);
+ ast_format_copy(ast_channel_rawreadformat(clonechan), &tmpfmt);
}
}
@@ -2911,7 +2911,7 @@ static int generator_force(const void *data)
if (!tmp || !generate)
return 0;
- res = generate(chan, tmp, 0, ast_format_rate(&chan->writeformat) / 50);
+ res = generate(chan, tmp, 0, ast_format_rate(ast_channel_writeformat(chan)) / 50);
ast_channel_generatordata_set(chan, tmp);
@@ -3477,9 +3477,9 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
ast_channel_generatordata_set(chan, NULL); /* reset, to let writes go through */
- if (ast_format_cmp(&f->subclass.format, &chan->writeformat) == AST_FORMAT_CMP_NOT_EQUAL) {
+ if (ast_format_cmp(&f->subclass.format, ast_channel_writeformat(chan)) == AST_FORMAT_CMP_NOT_EQUAL) {
float factor;
- factor = ((float) ast_format_rate(&chan->writeformat)) / ((float) ast_format_rate(&f->subclass.format));
+ factor = ((float) ast_format_rate(ast_channel_writeformat(chan))) / ((float) ast_format_rate(&f->subclass.format));
samples = (int) ( ((float) f->samples) * factor );
} else {
samples = f->samples;
@@ -4522,7 +4522,7 @@ int ast_prod(struct ast_channel *chan)
/* Send an empty audio frame to get things moving */
if (ast_channel_state(chan) != AST_STATE_UP) {
ast_debug(1, "Prodding channel '%s'\n", ast_channel_name(chan));
- ast_format_copy(&a.subclass.format, &chan->rawwriteformat);
+ ast_format_copy(&a.subclass.format, ast_channel_rawwriteformat(chan));
a.data.ptr = nothing + AST_FRIENDLY_OFFSET;
a.src = "ast_prod"; /* this better match check in ast_write */
if (ast_write(chan, &a))
@@ -4778,7 +4778,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
}
/* If the frame is in the raw write format, then it's easy... just use the frame - otherwise we will have to translate */
- if (ast_format_cmp(&fr->subclass.format, &chan->rawwriteformat) != AST_FORMAT_CMP_NOT_EQUAL) {
+ if (ast_format_cmp(&fr->subclass.format, ast_channel_rawwriteformat(chan)) != AST_FORMAT_CMP_NOT_EQUAL) {
f = fr;
} else {
/* XXX Something is not right we are not compatible with this frame bad things can happen
@@ -4788,10 +4788,10 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
* JIRA issues related to this :-
* ASTERISK-14384, ASTERISK-17502, ASTERISK-17541, ASTERISK-18063, ASTERISK-18325, ASTERISK-18422*/
if ((!ast_format_cap_iscompatible(ast_channel_nativeformats(chan), &fr->subclass.format)) &&
- (ast_format_cmp(&chan->writeformat, &fr->subclass.format) != AST_FORMAT_CMP_EQUAL)) {
+ (ast_format_cmp(ast_channel_writeformat(chan), &fr->subclass.format) != AST_FORMAT_CMP_EQUAL)) {
char nf[512];
ast_log(LOG_WARNING, "Codec mismatch on channel %s setting write format to %s from %s native formats %s\n",
- ast_channel_name(chan), ast_getformatname(&fr->subclass.format), ast_getformatname(&chan->writeformat),
+ ast_channel_name(chan), ast_getformatname(&fr->subclass.format), ast_getformatname(ast_channel_writeformat(chan)),
ast_getformatname_multiple(nf, sizeof(nf), ast_channel_nativeformats(chan)));
ast_set_write_format_by_id(chan, fr->subclass.format.id);
}
@@ -5072,8 +5072,8 @@ int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
res = set_format(chan,
cap,
- &chan->rawreadformat,
- &chan->readformat,
+ ast_channel_rawreadformat(chan),
+ ast_channel_readformat(chan),
&trans,
0);
@@ -5095,8 +5095,8 @@ int ast_set_read_format_by_id(struct ast_channel *chan, enum ast_format_id id)
res = set_format(chan,
cap,
- &chan->rawreadformat,
- &chan->readformat,
+ ast_channel_rawreadformat(chan),
+ ast_channel_readformat(chan),
&trans,
0);
@@ -5111,8 +5111,8 @@ int ast_set_read_format_from_cap(struct ast_channel *chan, struct ast_format_cap
int res;
res = set_format(chan,
cap,
- &chan->rawreadformat,
- &chan->readformat,
+ ast_channel_rawreadformat(chan),
+ ast_channel_readformat(chan),
&trans,
0);
ast_channel_readtrans_set(chan, trans);
@@ -5131,8 +5131,8 @@ int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
res = set_format(chan,
cap,
- &chan->rawwriteformat,
- &chan->writeformat,
+ ast_channel_rawwriteformat(chan),
+ ast_channel_writeformat(chan),
&trans,
1);
@@ -5154,8 +5154,8 @@ int ast_set_write_format_by_id(struct ast_channel *chan, enum ast_format_id id)
res = set_format(chan,
cap,
- &chan->rawwriteformat,
- &chan->writeformat,
+ ast_channel_rawwriteformat(chan),
+ ast_channel_writeformat(chan),
&trans,
1);
@@ -5170,8 +5170,8 @@ int ast_set_write_format_from_cap(struct ast_channel *chan, struct ast_format_ca
int res;
res = set_format(chan,
cap,
- &chan->rawwriteformat,
- &chan->writeformat,
+ ast_channel_rawwriteformat(chan),
+ ast_channel_writeformat(chan),
&trans,
1);
ast_channel_writetrans_set(chan, trans);
@@ -5805,8 +5805,8 @@ static int ast_channel_make_compatible_helper(struct ast_channel *from, struct a
return 0;
}
- if ((ast_format_cmp(&from->readformat, &to->writeformat) != AST_FORMAT_CMP_NOT_EQUAL) &&
- (ast_format_cmp(&to->readformat, &from->writeformat) != AST_FORMAT_CMP_NOT_EQUAL)) {
+ if ((ast_format_cmp(ast_channel_readformat(from), ast_channel_writeformat(to)) != AST_FORMAT_CMP_NOT_EQUAL) &&
+ (ast_format_cmp(ast_channel_readformat(to), ast_channel_writeformat(from)) != AST_FORMAT_CMP_NOT_EQUAL)) {
/* Already compatible! Moving on ... */
return 0;
}
@@ -6449,8 +6449,8 @@ int ast_do_masquerade(struct ast_channel *original)
char masqn[AST_CHANNEL_NAME];
char zombn[AST_CHANNEL_NAME];
- ast_format_copy(&rformat, &original->readformat);
- ast_format_copy(&wformat, &original->writeformat);
+ ast_format_copy(&rformat, ast_channel_readformat(original));
+ ast_format_copy(&wformat, ast_channel_writeformat(original));
/* XXX This operation is a bit odd. We're essentially putting the guts of
* the clone channel into the original channel. Start by killing off the
@@ -6621,13 +6621,13 @@ int ast_do_masquerade(struct ast_channel *original)
}
/* Swap the raw formats */
- ast_format_copy(&tmp_format, &original->rawreadformat);
- ast_format_copy(&original->rawreadformat, &clonechan->rawreadformat);
- ast_format_copy(&clonechan->rawreadformat, &tmp_format);
+ ast_format_copy(&tmp_format, ast_channel_rawreadformat(original));
+ ast_format_copy(ast_channel_rawreadformat(original), ast_channel_rawreadformat(clonechan));
+ ast_format_copy(ast_channel_rawreadformat(clonechan), &tmp_format);
- ast_format_copy(&tmp_format, &original->rawwriteformat);
- ast_format_copy(&original->rawwriteformat, &clonechan->rawwriteformat);
- ast_format_copy(&clonechan->rawwriteformat, &tmp_format);
+ ast_format_copy(&tmp_format, ast_channel_rawwriteformat(original));
+ ast_format_copy(ast_channel_rawwriteformat(original), ast_channel_rawwriteformat(clonechan));
+ ast_format_copy(ast_channel_rawwriteformat(clonechan), &tmp_format);
clonechan->_softhangup = AST_SOFTHANGUP_DEV;
@@ -7525,8 +7525,8 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
}
}
- if (((ast_format_cmp(&c1->readformat, &c0->writeformat) == AST_FORMAT_CMP_NOT_EQUAL) ||
- (ast_format_cmp(&c0->readformat, &c1->writeformat) == AST_FORMAT_CMP_NOT_EQUAL) ||
+ if (((ast_format_cmp(ast_channel_readformat(c1), ast_channel_writeformat(c0)) == AST_FORMAT_CMP_NOT_EQUAL) ||
+ (ast_format_cmp(ast_channel_readformat(c0), ast_channel_writeformat(c1)) == AST_FORMAT_CMP_NOT_EQUAL) ||
!ast_format_cap_identical(ast_channel_nativeformats(c0), o0nativeformats) ||
!ast_format_cap_identical(ast_channel_nativeformats(c1), o1nativeformats)) &&
!(ast_channel_generator(c0) || ast_channel_generator(c1))) {
@@ -7653,7 +7653,7 @@ static void *tonepair_alloc(struct ast_channel *chan, void *params)
if (!(ts = ast_calloc(1, sizeof(*ts))))
return NULL;
- ast_format_copy(&ts->origwfmt, &chan->writeformat);
+ ast_format_copy(&ts->origwfmt, ast_channel_writeformat(chan));
if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR)) {
ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format (write)\n", ast_channel_name(chan));
tonepair_release(NULL, ts);
@@ -8082,7 +8082,7 @@ struct ast_silence_generator *ast_channel_start_silence_generator(struct ast_cha
return NULL;
}
- ast_format_copy(&state->old_write_format, &chan->writeformat);
+ ast_format_copy(&state->old_write_format, 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 to SLINEAR\n");
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index 0b2d7c9b8..df6345b33 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -137,11 +137,11 @@ int ast_channel_data_add_structure(struct ast_data *tree,
}
}
- ast_data_add_codec(tree, "oldwriteformat", &chan->oldwriteformat);
- ast_data_add_codec(tree, "readformat", &chan->readformat);
- ast_data_add_codec(tree, "writeformat", &chan->writeformat);
- ast_data_add_codec(tree, "rawreadformat", &chan->rawreadformat);
- ast_data_add_codec(tree, "rawwriteformat", &chan->rawwriteformat);
+ ast_data_add_codec(tree, "oldwriteformat", ast_channel_oldwriteformat(chan));
+ ast_data_add_codec(tree, "readformat", ast_channel_readformat(chan));
+ ast_data_add_codec(tree, "writeformat", ast_channel_writeformat(chan));
+ ast_data_add_codec(tree, "rawreadformat", ast_channel_rawreadformat(chan));
+ ast_data_add_codec(tree, "rawwriteformat", ast_channel_rawwriteformat(chan));
ast_data_add_codecs(tree, "nativeformats", ast_channel_nativeformats(chan));
/* state */
@@ -684,3 +684,23 @@ void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state valu
{
chan->__do_not_use_state = value;
}
+struct ast_format *ast_channel_oldwriteformat(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_oldwriteformat;
+}
+struct ast_format *ast_channel_rawreadformat(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_rawreadformat;
+}
+struct ast_format *ast_channel_rawwriteformat(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_rawwriteformat;
+}
+struct ast_format *ast_channel_readformat(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_readformat;
+}
+struct ast_format *ast_channel_writeformat(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_writeformat;
+}
diff --git a/main/cli.c b/main/cli.c
index c6355835b..ae9e9d383 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -1484,8 +1484,8 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
ast_channel_language(c),
ast_state2str(ast_channel_state(c)), 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(ast_channel_writeformat(c)),
+ ast_getformatname(ast_channel_readformat(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/main/features.c b/main/features.c
index 96f76d9cb..b329c6acc 100644
--- a/main/features.c
+++ b/main/features.c
@@ -876,8 +876,8 @@ static void check_goto_on_transfer(struct ast_channel *chan)
}
/* Make formats okay */
- xferchan->readformat = chan->readformat;
- xferchan->writeformat = chan->writeformat;
+ ast_format_copy(ast_channel_readformat(xferchan), ast_channel_readformat(chan));
+ ast_format_copy(ast_channel_writeformat(xferchan), ast_channel_writeformat(chan));
if (ast_channel_masquerade(xferchan, chan)) {
/* Failed to setup masquerade. */
@@ -1672,8 +1672,8 @@ static int masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, s
}
/* Make formats okay */
- chan->readformat = rchan->readformat;
- chan->writeformat = rchan->writeformat;
+ ast_format_copy(ast_channel_readformat(chan), ast_channel_readformat(rchan));
+ ast_format_copy(ast_channel_writeformat(chan), ast_channel_writeformat(rchan));
if (ast_channel_masquerade(chan, rchan)) {
park_space_abort(args->pu);
@@ -2726,8 +2726,8 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
ast_channel_visible_indication_set(xferchan, AST_CONTROL_RINGING);
/* Make formats okay */
- xferchan->readformat = transferee->readformat;
- xferchan->writeformat = transferee->writeformat;
+ ast_format_copy(ast_channel_readformat(xferchan), ast_channel_readformat(transferee));
+ ast_format_copy(ast_channel_writeformat(xferchan), ast_channel_writeformat(transferee));
ast_channel_masquerade(xferchan, transferee);
ast_explicit_goto(xferchan, ast_channel_context(transferee), ast_channel_exten(transferee), ast_channel_priority(transferee));
@@ -6828,8 +6828,8 @@ static void do_bridge_masquerade(struct ast_channel *chan, struct ast_channel *t
ast_moh_stop(chan);
ast_channel_lock_both(chan, tmpchan);
ast_setstate(tmpchan, ast_channel_state(chan));
- tmpchan->readformat = chan->readformat;
- tmpchan->writeformat = chan->writeformat;
+ ast_format_copy(ast_channel_readformat(tmpchan), ast_channel_readformat(chan));
+ ast_format_copy(ast_channel_writeformat(tmpchan), ast_channel_writeformat(chan));
ast_channel_unlock(chan);
ast_channel_unlock(tmpchan);
@@ -7937,10 +7937,10 @@ static struct ast_channel *create_test_channel(const struct ast_channel_tech *fa
/* normally this is done in the channel driver */
ast_format_cap_add(ast_channel_nativeformats(test_channel1), ast_format_set(&tmp_fmt, AST_FORMAT_GSM, 0));
- ast_format_set(&test_channel1->writeformat, AST_FORMAT_GSM, 0);
- 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_set(ast_channel_writeformat(test_channel1), AST_FORMAT_GSM, 0);
+ 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);
diff --git a/main/file.c b/main/file.c
index 5341e8f18..bf9f6831a 100644
--- a/main/file.c
+++ b/main/file.c
@@ -131,8 +131,8 @@ int ast_stopstream(struct ast_channel *tmp)
if (ast_channel_stream(tmp)) {
ast_closestream(ast_channel_stream(tmp));
ast_channel_stream_set(tmp, NULL);
- if (tmp->oldwriteformat.id && ast_set_write_format(tmp, &tmp->oldwriteformat))
- ast_log(LOG_WARNING, "Unable to restore format back to %s\n", ast_getformatname(&tmp->oldwriteformat));
+ if (ast_channel_oldwriteformat(tmp)->id && ast_set_write_format(tmp, ast_channel_oldwriteformat(tmp)))
+ ast_log(LOG_WARNING, "Unable to restore format back to %s\n", ast_getformatname(ast_channel_oldwriteformat(tmp)));
}
/* Stop the video stream too */
if (ast_channel_vstream(tmp) != NULL) {
@@ -467,7 +467,7 @@ static int filehelper(const char *filename, const void *arg2, const char *fmt, c
FILE *bfile;
struct ast_filestream *s;
- if ((ast_format_cmp(&chan->writeformat, &f->format) == AST_FORMAT_CMP_NOT_EQUAL) &&
+ if ((ast_format_cmp(ast_channel_writeformat(chan), &f->format) == AST_FORMAT_CMP_NOT_EQUAL) &&
!(((AST_FORMAT_GET_TYPE(f->format.id) == AST_FORMAT_TYPE_AUDIO) && fmt) ||
((AST_FORMAT_GET_TYPE(f->format.id) == AST_FORMAT_TYPE_VIDEO) && fmt))) {
ast_free(fn);
@@ -701,7 +701,7 @@ struct ast_filestream *ast_openstream_full(struct ast_channel *chan, const char
}
/* Set the channel to a format we can work with and save off the previous format. */
- ast_format_copy(&chan->oldwriteformat, &chan->writeformat);
+ ast_format_copy(ast_channel_oldwriteformat(chan), ast_channel_writeformat(chan));
/* Set the channel to the best format that exists for the file. */
res = ast_set_write_format_from_cap(chan, file_fmt_cap);
/* don't need this anymore now that the channel's write format is set. */
@@ -1049,7 +1049,7 @@ int ast_streamfile(struct ast_channel *chan, const char *filename, const char *p
res = ast_playstream(fs);
if (!res && vfs)
res = ast_playstream(vfs);
- ast_verb(3, "<%s> Playing '%s.%s' (language '%s')\n", ast_channel_name(chan), filename, ast_getformatname(&chan->writeformat), preflang ? preflang : "default");
+ ast_verb(3, "<%s> Playing '%s.%s' (language '%s')\n", ast_channel_name(chan), filename, ast_getformatname(ast_channel_writeformat(chan)), preflang ? preflang : "default");
return res;
}
diff --git a/main/indications.c b/main/indications.c
index b07de4bc4..20ce4b894 100644
--- a/main/indications.c
+++ b/main/indications.c
@@ -147,7 +147,7 @@ static void *playtones_alloc(struct ast_channel *chan, void *params)
return NULL;
}
- ast_format_copy(&ps->origwfmt, &chan->writeformat);
+ ast_format_copy(&ps->origwfmt, ast_channel_writeformat(chan));
if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR)) {
ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format (write)\n", ast_channel_name(chan));
diff --git a/main/pbx.c b/main/pbx.c
index 626d6e8aa..bbf5ad74b 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -8347,8 +8347,8 @@ int ast_async_goto(struct ast_channel *chan, const char *context, const char *ex
tmpvars.name = ast_strdupa(ast_channel_name(chan));
tmpvars.amaflags = ast_channel_amaflags(chan);
tmpvars.state = ast_channel_state(chan);
- ast_format_copy(&tmpvars.writeformat, &chan->writeformat);
- ast_format_copy(&tmpvars.readformat, &chan->readformat);
+ ast_format_copy(&tmpvars.writeformat, ast_channel_writeformat(chan));
+ ast_format_copy(&tmpvars.readformat, ast_channel_readformat(chan));
tmpvars.cdr = ast_channel_cdr(chan) ? ast_cdr_dup(ast_channel_cdr(chan)) : NULL;
ast_channel_unlock(chan);
@@ -8368,8 +8368,8 @@ int ast_async_goto(struct ast_channel *chan, const char *context, const char *ex
}
/* Make formats okay */
- ast_format_copy(&tmpchan->readformat, &tmpvars.readformat);
- ast_format_copy(&tmpchan->writeformat, &tmpvars.writeformat);
+ ast_format_copy(ast_channel_readformat(tmpchan), &tmpvars.readformat);
+ ast_format_copy(ast_channel_writeformat(tmpchan), &tmpvars.writeformat);
/* Setup proper location. Never hold another channel lock while calling this function. */
ast_explicit_goto(tmpchan, S_OR(context, tmpvars.context), S_OR(exten, tmpvars.exten), priority);
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index 518ac140c..80f154f36 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -836,8 +836,8 @@ static enum ast_bridge_result local_bridge_loop(struct ast_channel *c0, struct a
cs[2] = NULL;
for (;;) {
/* If the underlying formats have changed force this bridge to break */
- if ((ast_format_cmp(&c0->rawreadformat, &c1->rawwriteformat) == AST_FORMAT_CMP_NOT_EQUAL) ||
- (ast_format_cmp(&c1->rawreadformat, &c0->rawwriteformat) == AST_FORMAT_CMP_NOT_EQUAL)) {
+ if ((ast_format_cmp(ast_channel_rawreadformat(c0), ast_channel_rawwriteformat(c1)) == AST_FORMAT_CMP_NOT_EQUAL) ||
+ (ast_format_cmp(ast_channel_rawreadformat(c1), ast_channel_rawwriteformat(c0)) == AST_FORMAT_CMP_NOT_EQUAL)) {
ast_debug(1, "rtp-engine-local-bridge: Oooh, formats changed, backing out\n");
res = AST_BRIDGE_FAILED_NOWARN;
break;