summaryrefslogtreecommitdiff
path: root/channels
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 /channels
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 'channels')
-rw-r--r--channels/chan_agent.c36
-rw-r--r--channels/chan_alsa.c6
-rw-r--r--channels/chan_bridge.c16
-rw-r--r--channels/chan_console.c6
-rw-r--r--channels/chan_dahdi.c18
-rw-r--r--channels/chan_gtalk.c20
-rw-r--r--channels/chan_iax2.c32
-rw-r--r--channels/chan_jingle.c20
-rw-r--r--channels/chan_local.c16
-rw-r--r--channels/chan_mgcp.c16
-rw-r--r--channels/chan_misdn.c8
-rw-r--r--channels/chan_multicast_rtp.c8
-rw-r--r--channels/chan_nbs.c8
-rw-r--r--channels/chan_oss.c6
-rw-r--r--channels/chan_phone.c26
-rw-r--r--channels/chan_sip.c28
-rw-r--r--channels/chan_skinny.c16
-rw-r--r--channels/chan_unistim.c42
-rw-r--r--channels/chan_usbradio.c4
-rw-r--r--channels/chan_vpb.cc6
20 files changed, 169 insertions, 169 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index b2744af00..9eb0b68f9 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -303,14 +303,14 @@ static AST_LIST_HEAD_STATIC(agents, agent_pvt); /*!< Holds the list of agents (l
ast_debug(1, "Native formats changing from '%s' to '%s'\n", ast_getformatname_multiple(tmp1, sizeof(tmp1), ast_channel_nativeformats(ast)), ast_getformatname_multiple(tmp2, sizeof(tmp2), ast_channel_nativeformats(p->chan))); \
/* Native formats changed, reset things */ \
ast_format_cap_copy(ast_channel_nativeformats(ast), ast_channel_nativeformats(p->chan)); \
- ast_debug(1, "Resetting read to '%s' and write to '%s'\n", ast_getformatname(&ast->readformat), ast_getformatname(&ast->writeformat));\
- ast_set_read_format(ast, &ast->readformat); \
- ast_set_write_format(ast, &ast->writeformat); \
+ ast_debug(1, "Resetting read to '%s' and write to '%s'\n", ast_getformatname(ast_channel_readformat(ast)), ast_getformatname(ast_channel_writeformat(ast)));\
+ ast_set_read_format(ast, ast_channel_readformat(ast)); \
+ ast_set_write_format(ast, ast_channel_writeformat(ast)); \
} \
- if ((ast_format_cmp(&p->chan->readformat, &ast->rawreadformat) != AST_FORMAT_CMP_EQUAL) && !ast_channel_generator(p->chan)) \
- ast_set_read_format(p->chan, &ast->rawreadformat); \
- if ((ast_format_cmp(&p->chan->writeformat, &ast->rawwriteformat) != AST_FORMAT_CMP_EQUAL) && !ast_channel_generator(p->chan)) \
- ast_set_write_format(p->chan, &ast->rawwriteformat); \
+ if ((ast_format_cmp(ast_channel_readformat(p->chan), ast_channel_rawreadformat(ast)) != AST_FORMAT_CMP_EQUAL) && !ast_channel_generator(p->chan)) \
+ ast_set_read_format(p->chan, ast_channel_rawreadformat(ast)); \
+ if ((ast_format_cmp(ast_channel_writeformat(p->chan), ast_channel_rawwriteformat(ast)) != AST_FORMAT_CMP_EQUAL) && !ast_channel_generator(p->chan)) \
+ ast_set_write_format(p->chan, ast_channel_rawwriteformat(ast)); \
} \
} while(0)
@@ -742,7 +742,7 @@ static int agent_write(struct ast_channel *ast, struct ast_frame *f)
else {
if ((f->frametype != AST_FRAME_VOICE) ||
(f->frametype != AST_FRAME_VIDEO) ||
- (ast_format_cmp(&f->subclass.format, &p->chan->writeformat) != AST_FORMAT_CMP_NOT_EQUAL)) {
+ (ast_format_cmp(&f->subclass.format, ast_channel_writeformat(p->chan)) != AST_FORMAT_CMP_NOT_EQUAL)) {
res = ast_write(p->chan, f);
} else {
ast_debug(1, "Dropping one incompatible %s frame on '%s' to '%s'\n",
@@ -1114,20 +1114,20 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state, const char
ast_channel_tech_set(tmp, &agent_tech);
if (p->chan) {
ast_format_cap_copy(ast_channel_nativeformats(tmp), ast_channel_nativeformats(p->chan));
- ast_format_copy(&tmp->writeformat, &p->chan->writeformat);
- ast_format_copy(&tmp->rawwriteformat, &p->chan->writeformat);
- ast_format_copy(&tmp->readformat, &p->chan->readformat);
- ast_format_copy(&tmp->rawreadformat, &p->chan->readformat);
+ ast_format_copy(ast_channel_writeformat(tmp), ast_channel_writeformat(p->chan));
+ ast_format_copy(ast_channel_rawwriteformat(tmp), ast_channel_writeformat(p->chan));
+ ast_format_copy(ast_channel_readformat(tmp), ast_channel_readformat(p->chan));
+ ast_format_copy(ast_channel_rawreadformat(tmp), ast_channel_readformat(p->chan));
ast_channel_language_set(tmp, ast_channel_language(p->chan));
ast_channel_context_set(tmp, ast_channel_context(p->chan));
ast_channel_exten_set(tmp, ast_channel_exten(p->chan));
/* XXX Is this really all we copy form the originating channel?? */
} else {
- ast_format_set(&tmp->writeformat, AST_FORMAT_SLINEAR, 0);
- ast_format_set(&tmp->rawwriteformat, AST_FORMAT_SLINEAR, 0);
- ast_format_set(&tmp->readformat, AST_FORMAT_SLINEAR, 0);
- ast_format_set(&tmp->rawreadformat, AST_FORMAT_SLINEAR, 0);
- ast_format_cap_add(ast_channel_nativeformats(tmp), &tmp->writeformat);
+ ast_format_set(ast_channel_writeformat(tmp), AST_FORMAT_SLINEAR, 0);
+ ast_format_set(ast_channel_rawwriteformat(tmp), AST_FORMAT_SLINEAR, 0);
+ ast_format_set(ast_channel_readformat(tmp), AST_FORMAT_SLINEAR, 0);
+ ast_format_set(ast_channel_rawreadformat(tmp), AST_FORMAT_SLINEAR, 0);
+ ast_format_cap_add(ast_channel_nativeformats(tmp), ast_channel_writeformat(tmp));
}
/* Safe, agentlock already held */
ast_channel_tech_pvt_set(tmp, p);
@@ -2127,7 +2127,7 @@ static int login_exec(struct ast_channel *chan, const char *data)
snprintf(ast_channel_cdr(chan)->channel, sizeof(ast_channel_cdr(chan)->channel), "Agent/%s", p->agent);
ast_queue_log("NONE", ast_channel_uniqueid(chan), agent, "AGENTLOGIN", "%s", ast_channel_name(chan));
ast_verb(2, "Agent '%s' logged in (format %s/%s)\n", p->agent,
- ast_getformatname(&chan->readformat), ast_getformatname(&chan->writeformat));
+ ast_getformatname(ast_channel_readformat(chan)), ast_getformatname(ast_channel_writeformat(chan)));
/* Login this channel and wait for it to go away */
p->chan = chan;
if (p->ackcall) {
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index 4424ef18d..0ebfd3f22 100644
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -572,9 +572,9 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state, const ch
ast_channel_tech_set(tmp, &alsa_tech);
ast_channel_set_fd(tmp, 0, readdev);
- ast_format_set(&tmp->readformat, AST_FORMAT_SLINEAR, 0);
- ast_format_set(&tmp->writeformat, AST_FORMAT_SLINEAR, 0);
- ast_format_cap_add(ast_channel_nativeformats(tmp), &tmp->writeformat);
+ ast_format_set(ast_channel_readformat(tmp), AST_FORMAT_SLINEAR, 0);
+ ast_format_set(ast_channel_writeformat(tmp), AST_FORMAT_SLINEAR, 0);
+ ast_format_cap_add(ast_channel_nativeformats(tmp), ast_channel_writeformat(tmp));
ast_channel_tech_pvt_set(tmp, p);
if (!ast_strlen_zero(p->context))
diff --git a/channels/chan_bridge.c b/channels/chan_bridge.c
index 67af0737e..3ec157601 100644
--- a/channels/chan_bridge.c
+++ b/channels/chan_bridge.c
@@ -188,14 +188,14 @@ static struct ast_channel *bridge_request(const char *type, struct ast_format_ca
ast_format_cap_add(ast_channel_nativeformats(p->input), &slin);
ast_format_cap_add(ast_channel_nativeformats(p->output), &slin);
- ast_format_copy(&p->input->readformat, &slin);
- ast_format_copy(&p->output->readformat, &slin);
- ast_format_copy(&p->input->rawreadformat, &slin);
- ast_format_copy(&p->output->rawreadformat, &slin);
- ast_format_copy(&p->input->writeformat, &slin);
- ast_format_copy(&p->output->writeformat, &slin);
- ast_format_copy(&p->input->rawwriteformat, &slin);
- ast_format_copy(&p->output->rawwriteformat, &slin);
+ ast_format_copy(ast_channel_readformat(p->input), &slin);
+ ast_format_copy(ast_channel_readformat(p->output), &slin);
+ ast_format_copy(ast_channel_rawreadformat(p->input), &slin);
+ ast_format_copy(ast_channel_rawreadformat(p->output), &slin);
+ ast_format_copy(ast_channel_writeformat(p->input), &slin);
+ ast_format_copy(ast_channel_writeformat(p->output), &slin);
+ ast_format_copy(ast_channel_rawwriteformat(p->input), &slin);
+ ast_format_copy(ast_channel_rawwriteformat(p->output), &slin);
ast_answer(p->output);
ast_answer(p->input);
diff --git a/channels/chan_console.c b/channels/chan_console.c
index a47f89826..02fca590c 100644
--- a/channels/chan_console.c
+++ b/channels/chan_console.c
@@ -420,9 +420,9 @@ static struct ast_channel *console_new(struct console_pvt *pvt, const char *ext,
}
ast_channel_tech_set(chan, &console_tech);
- ast_format_set(&chan->readformat, AST_FORMAT_SLINEAR16, 0);
- ast_format_set(&chan->writeformat, AST_FORMAT_SLINEAR16, 0);
- ast_format_cap_add(ast_channel_nativeformats(chan), &chan->readformat);
+ ast_format_set(ast_channel_readformat(chan), AST_FORMAT_SLINEAR16, 0);
+ ast_format_set(ast_channel_writeformat(chan), AST_FORMAT_SLINEAR16, 0);
+ ast_format_cap_add(ast_channel_nativeformats(chan), ast_channel_readformat(chan));
ast_channel_tech_pvt_set(chan, ref_pvt(pvt));
pvt->owner = chan;
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 59e1ff09d..246742188 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -9116,15 +9116,15 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
return f;
}
- if (ast->rawreadformat.id == AST_FORMAT_SLINEAR) {
+ if (ast_channel_rawreadformat(ast)->id == AST_FORMAT_SLINEAR) {
if (!p->subs[idx].linear) {
p->subs[idx].linear = 1;
res = dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear);
if (res)
ast_log(LOG_WARNING, "Unable to set channel %d (index %d) to linear mode.\n", p->channel, idx);
}
- } else if ((ast->rawreadformat.id == AST_FORMAT_ULAW) ||
- (ast->rawreadformat.id == AST_FORMAT_ALAW)) {
+ } else if ((ast_channel_rawreadformat(ast)->id == AST_FORMAT_ULAW) ||
+ (ast_channel_rawreadformat(ast)->id == AST_FORMAT_ALAW)) {
if (p->subs[idx].linear) {
p->subs[idx].linear = 0;
res = dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear);
@@ -9132,7 +9132,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
ast_log(LOG_WARNING, "Unable to set channel %d (index %d) to companded mode.\n", p->channel, idx);
}
} else {
- ast_log(LOG_WARNING, "Don't know how to read frames in format %s\n", ast_getformatname(&ast->rawreadformat));
+ ast_log(LOG_WARNING, "Don't know how to read frames in format %s\n", ast_getformatname(ast_channel_rawreadformat(ast)));
ast_mutex_unlock(&p->lock);
return NULL;
}
@@ -9224,7 +9224,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
}
p->subs[idx].f.frametype = AST_FRAME_VOICE;
- ast_format_copy(&p->subs[idx].f.subclass.format, &ast->rawreadformat);
+ ast_format_copy(&p->subs[idx].f.subclass.format, ast_channel_rawreadformat(ast));
p->subs[idx].f.samples = READ_SIZE;
p->subs[idx].f.mallocd = 0;
p->subs[idx].f.offset = AST_FRIENDLY_OFFSET;
@@ -9675,10 +9675,10 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
ast_channel_set_fd(tmp, 0, i->subs[idx].dfd);
ast_format_cap_add(ast_channel_nativeformats(tmp), &deflaw);
/* Start out assuming ulaw since it's smaller :) */
- ast_format_copy(&tmp->rawreadformat, &deflaw);
- ast_format_copy(&tmp->readformat, &deflaw);
- ast_format_copy(&tmp->rawwriteformat, &deflaw);
- ast_format_copy(&tmp->writeformat, &deflaw);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &deflaw);
+ ast_format_copy(ast_channel_readformat(tmp), &deflaw);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &deflaw);
+ ast_format_copy(ast_channel_writeformat(tmp), &deflaw);
i->subs[idx].linear = 0;
dahdi_setlinear(i->subs[idx].dfd, i->subs[idx].linear);
features = 0;
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c
index 3b5354cae..8db2369d2 100644
--- a/channels/chan_gtalk.c
+++ b/channels/chan_gtalk.c
@@ -1170,10 +1170,10 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i,
ast_channel_adsicpe_set(tmp, AST_ADSI_UNAVAILABLE);
ast_best_codec(ast_channel_nativeformats(tmp), &tmpfmt);
- ast_format_copy(&tmp->writeformat, &tmpfmt);
- ast_format_copy(&tmp->rawwriteformat, &tmpfmt);
- ast_format_copy(&tmp->readformat, &tmpfmt);
- ast_format_copy(&tmp->rawreadformat, &tmpfmt);
+ ast_format_copy(ast_channel_writeformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_readformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &tmpfmt);
ast_channel_tech_pvt_set(tmp, i);
tmp->callgroup = client->callgroup;
@@ -1628,8 +1628,8 @@ static struct ast_frame *gtalk_rtp_read(struct ast_channel *ast, struct gtalk_pv
ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(&f->subclass.format));
ast_format_cap_remove_bytype(ast_channel_nativeformats(p->owner), AST_FORMAT_TYPE_AUDIO);
ast_format_cap_add(ast_channel_nativeformats(p->owner), &f->subclass.format);
- ast_set_read_format(p->owner, &p->owner->readformat);
- ast_set_write_format(p->owner, &p->owner->writeformat);
+ ast_set_read_format(p->owner, ast_channel_readformat(p->owner));
+ ast_set_write_format(p->owner, ast_channel_writeformat(p->owner));
}
/* if ((ast_test_flag(p, SIP_DTMF) == SIP_DTMF_INBAND) && p->vad) {
f = ast_dsp_process(p->owner, p->vad, f);
@@ -1666,8 +1666,8 @@ static int gtalk_write(struct ast_channel *ast, struct ast_frame *frame)
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
ast_getformatname(&frame->subclass.format),
ast_getformatname_multiple(buf, sizeof(buf), ast_channel_nativeformats(ast)),
- ast_getformatname(&ast->readformat),
- ast_getformatname(&ast->writeformat));
+ ast_getformatname(ast_channel_readformat(ast)),
+ ast_getformatname(ast_channel_writeformat(ast)));
return 0;
}
if (p) {
@@ -1992,8 +1992,8 @@ static char *gtalk_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cl
ast_channel_name(chan),
jid,
resource,
- ast_getformatname(&chan->readformat),
- ast_getformatname(&chan->writeformat)
+ ast_getformatname(ast_channel_readformat(chan)),
+ ast_getformatname(ast_channel_writeformat(chan))
);
else
ast_log(LOG_WARNING, "No available channel\n");
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 7a0d8265d..fba55dcf2 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -5756,10 +5756,10 @@ static struct ast_channel *ast_iax2_new(int callno, int state, iax2_format capab
ast_format_cap_from_old_bitfield(ast_channel_nativeformats(tmp), capability);
ast_best_codec(ast_channel_nativeformats(tmp), &tmpfmt);
- ast_format_copy(&tmp->readformat, &tmpfmt);
- ast_format_copy(&tmp->rawreadformat, &tmpfmt);
- ast_format_copy(&tmp->writeformat, &tmpfmt);
- ast_format_copy(&tmp->rawwriteformat, &tmpfmt);
+ ast_format_copy(ast_channel_readformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_writeformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &tmpfmt);
ast_channel_tech_pvt_set(tmp, CALLNO_TO_PTR(i->callno));
@@ -9353,8 +9353,8 @@ static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2, const
}
/* Make formats okay */
- chan1m->readformat = chan1->readformat;
- chan1m->writeformat = chan1->writeformat;
+ ast_format_copy(ast_channel_readformat(chan1m), ast_channel_readformat(chan1));
+ ast_format_copy(ast_channel_writeformat(chan1m), ast_channel_writeformat(chan1));
/* Prepare for taking over the channel */
if (ast_channel_masquerade(chan1m, chan1)) {
@@ -9377,8 +9377,8 @@ static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2, const
back the announcement */
/* Make formats okay */
- chan2m->readformat = chan2->readformat;
- chan2m->writeformat = chan2->writeformat;
+ ast_format_copy(ast_channel_readformat(chan2m), ast_channel_readformat(chan2));
+ ast_format_copy(ast_channel_writeformat(chan2m), ast_channel_writeformat(chan2));
ast_channel_parkinglot_set(chan2m, ast_channel_parkinglot(chan2));
/* Prepare for taking over the channel */
@@ -10367,8 +10367,8 @@ static int socket_process(struct iax2_thread *thread)
struct ast_format_cap *native = ast_channel_nativeformats(iaxs[fr->callno]->owner);
if (orignative) {
ast_format_cap_set(native, &f.subclass.format);
- if (iaxs[fr->callno]->owner->readformat.id) {
- ast_set_read_format(iaxs[fr->callno]->owner, &iaxs[fr->callno]->owner->readformat);
+ if (ast_channel_readformat(iaxs[fr->callno]->owner)->id) {
+ ast_set_read_format(iaxs[fr->callno]->owner, ast_channel_readformat(iaxs[fr->callno]->owner));
}
ast_format_cap_copy(native, orignative);
ast_channel_unlock(iaxs[fr->callno]->owner);
@@ -10873,10 +10873,10 @@ static int socket_process(struct iax2_thread *thread)
ast_verb(3, "Format for call is %s\n", ast_getformatname_multiple(tmp, sizeof(tmp), ast_channel_nativeformats(iaxs[fr->callno]->owner)));
/* Setup read/write formats properly. */
- if (iaxs[fr->callno]->owner->writeformat.id)
- ast_set_write_format(iaxs[fr->callno]->owner, &iaxs[fr->callno]->owner->writeformat);
- if (iaxs[fr->callno]->owner->readformat.id)
- ast_set_read_format(iaxs[fr->callno]->owner, &iaxs[fr->callno]->owner->readformat);
+ if (ast_channel_writeformat(iaxs[fr->callno]->owner)->id)
+ ast_set_write_format(iaxs[fr->callno]->owner, ast_channel_writeformat(iaxs[fr->callno]->owner));
+ if (ast_channel_readformat(iaxs[fr->callno]->owner)->id)
+ ast_set_read_format(iaxs[fr->callno]->owner, ast_channel_readformat(iaxs[fr->callno]->owner));
ast_channel_unlock(iaxs[fr->callno]->owner);
}
}
@@ -12182,8 +12182,8 @@ static struct ast_channel *iax2_request(const char *type, struct ast_format_cap
}
ast_format_cap_set(ast_channel_nativeformats(c), &best_fmt_native);
}
- ast_best_codec(ast_channel_nativeformats(c), &c->readformat);
- ast_format_copy(&c->writeformat, &c->readformat);
+ ast_best_codec(ast_channel_nativeformats(c), ast_channel_readformat(c));
+ ast_format_copy(ast_channel_writeformat(c), ast_channel_readformat(c));
}
return c;
diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c
index a683a4160..7156e9443 100644
--- a/channels/chan_jingle.c
+++ b/channels/chan_jingle.c
@@ -882,10 +882,10 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt *
ast_best_codec(ast_channel_nativeformats(tmp), &tmpfmt);
- ast_format_copy(&tmp->writeformat, &tmpfmt);
- ast_format_copy(&tmp->rawwriteformat, &tmpfmt);
- ast_format_copy(&tmp->readformat, &tmpfmt);
- ast_format_copy(&tmp->rawreadformat, &tmpfmt);
+ ast_format_copy(ast_channel_writeformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_readformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &tmpfmt);
ast_channel_tech_pvt_set(tmp, i);
tmp->callgroup = client->callgroup;
@@ -1233,8 +1233,8 @@ static struct ast_frame *jingle_rtp_read(struct ast_channel *ast, struct jingle_
ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(&f->subclass.format));
ast_format_cap_remove_bytype(ast_channel_nativeformats(p->owner), AST_FORMAT_TYPE_AUDIO);
ast_format_cap_add(ast_channel_nativeformats(p->owner), &f->subclass.format);
- ast_set_read_format(p->owner, &p->owner->readformat);
- ast_set_write_format(p->owner, &p->owner->writeformat);
+ ast_set_read_format(p->owner, ast_channel_readformat(p->owner));
+ ast_set_write_format(p->owner, ast_channel_writeformat(p->owner));
}
/* if ((ast_test_flag(p, SIP_DTMF) == SIP_DTMF_INBAND) && p->vad) {
f = ast_dsp_process(p->owner, p->vad, f);
@@ -1271,8 +1271,8 @@ static int jingle_write(struct ast_channel *ast, struct ast_frame *frame)
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
ast_getformatname(&frame->subclass.format),
ast_getformatname_multiple(buf, sizeof(buf), ast_channel_nativeformats(ast)),
- ast_getformatname(&ast->readformat),
- ast_getformatname(&ast->writeformat));
+ ast_getformatname(ast_channel_readformat(ast)),
+ ast_getformatname(ast_channel_writeformat(ast)));
return 0;
}
if (p) {
@@ -1635,8 +1635,8 @@ static char *jingle_show_channels(struct ast_cli_entry *e, int cmd, struct ast_c
ast_channel_name(chan),
jid,
resource,
- ast_getformatname(&chan->readformat),
- ast_getformatname(&chan->writeformat)
+ ast_getformatname(ast_channel_readformat(chan)),
+ ast_getformatname(ast_channel_writeformat(chan))
);
else
ast_log(LOG_WARNING, "No available channel\n");
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 6123e5484..550625656 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -1157,14 +1157,14 @@ static struct ast_channel *local_new(struct local_pvt *p, int state, const char
/* Determine our read/write format and set it on each channel */
ast_best_codec(p->reqcap, &fmt);
- ast_format_copy(&tmp->writeformat, &fmt);
- ast_format_copy(&tmp2->writeformat, &fmt);
- ast_format_copy(&tmp->rawwriteformat, &fmt);
- ast_format_copy(&tmp2->rawwriteformat, &fmt);
- ast_format_copy(&tmp->readformat, &fmt);
- ast_format_copy(&tmp2->readformat, &fmt);
- ast_format_copy(&tmp->rawreadformat, &fmt);
- ast_format_copy(&tmp2->rawreadformat, &fmt);
+ ast_format_copy(ast_channel_writeformat(tmp), &fmt);
+ ast_format_copy(ast_channel_writeformat(tmp2), &fmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &fmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp2), &fmt);
+ ast_format_copy(ast_channel_readformat(tmp), &fmt);
+ ast_format_copy(ast_channel_readformat(tmp2), &fmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &fmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp2), &fmt);
ast_channel_tech_pvt_set(tmp, p);
ast_channel_tech_pvt_set(tmp2, p);
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index b73ccd24c..96c22d155 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -1212,8 +1212,8 @@ static struct ast_frame *mgcp_rtp_read(struct mgcp_subchannel *sub)
if (!ast_format_cap_iscompatible(ast_channel_nativeformats(sub->owner), &f->subclass.format)) {
ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(&f->subclass.format));
ast_format_cap_set(ast_channel_nativeformats(sub->owner), &f->subclass.format);
- ast_set_read_format(sub->owner, &sub->owner->readformat);
- ast_set_write_format(sub->owner, &sub->owner->writeformat);
+ ast_set_read_format(sub->owner, ast_channel_readformat(sub->owner));
+ ast_set_write_format(sub->owner, ast_channel_writeformat(sub->owner));
}
/* Courtesy fearnor aka alex@pilosoft.com */
if ((sub->parent->dtmfmode & MGCP_DTMF_INBAND) && (sub->parent->dsp)) {
@@ -1256,8 +1256,8 @@ static int mgcp_write(struct ast_channel *ast, struct ast_frame *frame)
ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
ast_getformatname(&frame->subclass.format),
ast_getformatname_multiple(buf, sizeof(buf), ast_channel_nativeformats(ast)),
- ast_getformatname(&ast->readformat),
- ast_getformatname(&ast->writeformat));
+ ast_getformatname(ast_channel_readformat(ast)),
+ ast_getformatname(ast_channel_writeformat(ast)));
/* return -1; */
}
}
@@ -1518,10 +1518,10 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state, cons
ast_channel_rings_set(tmp, 1);
ast_best_codec(ast_channel_nativeformats(tmp), &tmpfmt);
- ast_format_copy(&tmp->writeformat, &tmpfmt);
- ast_format_copy(&tmp->rawwriteformat, &tmpfmt);
- ast_format_copy(&tmp->readformat, &tmpfmt);
- ast_format_copy(&tmp->rawreadformat, &tmpfmt);
+ ast_format_copy(ast_channel_writeformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_readformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &tmpfmt);
ast_channel_tech_pvt_set(tmp, sub);
if (!ast_strlen_zero(i->language))
ast_channel_language_set(tmp, i->language);
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index d760a1ed0..c7ca07b99 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -8137,10 +8137,10 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char
ast_best_codec(cap, &tmpfmt);
ast_format_cap_add(ast_channel_nativeformats(tmp), &prefformat);
- ast_format_copy(&tmp->writeformat, &tmpfmt);
- ast_format_copy(&tmp->rawwriteformat, &tmpfmt);
- ast_format_copy(&tmp->readformat, &tmpfmt);
- ast_format_copy(&tmp->rawreadformat, &tmpfmt);
+ ast_format_copy(ast_channel_writeformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_readformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &tmpfmt);
/* Link the channel and private together */
chan_list_ref(chlist, "Give a reference to ast_channel");
diff --git a/channels/chan_multicast_rtp.c b/channels/chan_multicast_rtp.c
index 6ebacaa84..dfa068018 100644
--- a/channels/chan_multicast_rtp.c
+++ b/channels/chan_multicast_rtp.c
@@ -159,10 +159,10 @@ static struct ast_channel *multicast_rtp_request(const char *type, struct ast_fo
ast_channel_tech_set(chan, &multicast_rtp_tech);
ast_format_cap_add(ast_channel_nativeformats(chan), &fmt);
- ast_format_copy(&chan->writeformat, &fmt);
- ast_format_copy(&chan->rawwriteformat, &fmt);
- ast_format_copy(&chan->readformat, &fmt);
- ast_format_copy(&chan->rawreadformat, &fmt);
+ ast_format_copy(ast_channel_writeformat(chan), &fmt);
+ ast_format_copy(ast_channel_rawwriteformat(chan), &fmt);
+ ast_format_copy(ast_channel_readformat(chan), &fmt);
+ ast_format_copy(ast_channel_rawreadformat(chan), &fmt);
ast_channel_tech_pvt_set(chan, instance);
diff --git a/channels/chan_nbs.c b/channels/chan_nbs.c
index 882e165f8..e6384872e 100644
--- a/channels/chan_nbs.c
+++ b/channels/chan_nbs.c
@@ -227,10 +227,10 @@ static struct ast_channel *nbs_new(struct nbs_pvt *i, int state, const char *lin
ast_channel_set_fd(tmp, 0, nbs_fd(i->nbs));
ast_format_cap_add(ast_channel_nativeformats(tmp), &prefformat);
- ast_format_copy(&tmp->rawreadformat, &prefformat);
- ast_format_copy(&tmp->rawwriteformat, &prefformat);
- ast_format_copy(&tmp->writeformat, &prefformat);
- ast_format_copy(&tmp->readformat, &prefformat);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &prefformat);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &prefformat);
+ ast_format_copy(ast_channel_writeformat(tmp), &prefformat);
+ ast_format_copy(ast_channel_readformat(tmp), &prefformat);
if (state == AST_STATE_RING)
ast_channel_rings_set(tmp, 1);
ast_channel_tech_pvt_set(tmp, i);
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 2d7cda82a..47a995842 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -797,9 +797,9 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx,
setformat(o, O_RDWR);
ast_channel_set_fd(c, 0, o->sounddev); /* -1 if device closed, override later */
- ast_format_set(&c->readformat, AST_FORMAT_SLINEAR, 0);
- ast_format_set(&c->writeformat, AST_FORMAT_SLINEAR, 0);
- ast_format_cap_add(ast_channel_nativeformats(c), &c->readformat);
+ ast_format_set(ast_channel_readformat(c), AST_FORMAT_SLINEAR, 0);
+ ast_format_set(ast_channel_writeformat(c), AST_FORMAT_SLINEAR, 0);
+ ast_format_cap_add(ast_channel_nativeformats(c), ast_channel_readformat(c));
/* if the console makes the call, add video to the offer */
/* if (state == AST_STATE_RINGING) TODO XXX CONSOLE VIDEO IS DISABLED UNTIL IT GETS A MAINTAINER
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 6f8f5a4bc..053174793 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -392,7 +392,7 @@ static int phone_setup(struct ast_channel *ast)
p = ast_channel_tech_pvt(ast);
ioctl(p->fd, PHONE_CPT_STOP);
/* Nothing to answering really, just start recording */
- if (ast->rawreadformat.id == AST_FORMAT_G729A) {
+ if (ast_channel_rawreadformat(ast)->id == AST_FORMAT_G729A) {
/* Prefer g729 */
ioctl(p->fd, PHONE_REC_STOP);
if (p->lastinput.id != AST_FORMAT_G729A) {
@@ -402,7 +402,7 @@ static int phone_setup(struct ast_channel *ast)
return -1;
}
}
- } else if (ast->rawreadformat.id == AST_FORMAT_G723_1) {
+ } else if (ast_channel_rawreadformat(ast)->id == AST_FORMAT_G723_1) {
ioctl(p->fd, PHONE_REC_STOP);
if (p->lastinput.id != AST_FORMAT_G723_1) {
ast_format_set(&p->lastinput, AST_FORMAT_G723_1, 0);
@@ -411,7 +411,7 @@ static int phone_setup(struct ast_channel *ast)
return -1;
}
}
- } else if (ast->rawreadformat.id == AST_FORMAT_SLINEAR) {
+ } else if (ast_channel_rawreadformat(ast)->id == AST_FORMAT_SLINEAR) {
ioctl(p->fd, PHONE_REC_STOP);
if (p->lastinput.id != AST_FORMAT_SLINEAR) {
ast_format_set(&p->lastinput, AST_FORMAT_SLINEAR, 0);
@@ -420,7 +420,7 @@ static int phone_setup(struct ast_channel *ast)
return -1;
}
}
- } else if (ast->rawreadformat.id == AST_FORMAT_ULAW) {
+ } else if (ast_channel_rawreadformat(ast)->id == AST_FORMAT_ULAW) {
ioctl(p->fd, PHONE_REC_STOP);
if (p->lastinput.id != AST_FORMAT_ULAW) {
ast_format_set(&p->lastinput, AST_FORMAT_ULAW, 0);
@@ -431,16 +431,16 @@ static int phone_setup(struct ast_channel *ast)
}
} else if (p->mode == MODE_FXS) {
ioctl(p->fd, PHONE_REC_STOP);
- if (ast_format_cmp(&p->lastinput, &ast->rawreadformat) == AST_FORMAT_CMP_NOT_EQUAL) {
- ast_format_copy(&p->lastinput, &ast->rawreadformat);
- if (ioctl(p->fd, PHONE_REC_CODEC, &ast->rawreadformat)) {
+ if (ast_format_cmp(&p->lastinput, ast_channel_rawreadformat(ast)) == AST_FORMAT_CMP_NOT_EQUAL) {
+ ast_format_copy(&p->lastinput, ast_channel_rawreadformat(ast));
+ if (ioctl(p->fd, PHONE_REC_CODEC, ast_channel_rawreadformat(ast))) {
ast_log(LOG_WARNING, "Failed to set codec to %s\n",
- ast_getformatname(&ast->rawreadformat));
+ ast_getformatname(ast_channel_rawreadformat(ast)));
return -1;
}
}
} else {
- ast_log(LOG_WARNING, "Can't do format %s\n", ast_getformatname(&ast->rawreadformat));
+ ast_log(LOG_WARNING, "Can't do format %s\n", ast_getformatname(ast_channel_rawreadformat(ast)));
return -1;
}
if (ioctl(p->fd, PHONE_REC_START)) {
@@ -859,16 +859,16 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *cntx,
ioctl(i->fd, PHONE_QUERY_CODEC, &queried_codec) == 0) {
if (queried_codec.type == LINEAR16) {
ast_format_cap_add(ast_channel_nativeformats(tmp), ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
- ast_format_copy(&tmp->rawreadformat, &tmpfmt);
- ast_format_copy(&tmp->rawwriteformat, &tmpfmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &tmpfmt);
} else {
ast_format_cap_remove(prefcap, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
}
} else {
ast_format_cap_copy(ast_channel_nativeformats(tmp), prefcap);
ast_best_codec(ast_channel_nativeformats(tmp), &tmpfmt);
- ast_format_copy(&tmp->rawreadformat, &tmpfmt);
- ast_format_copy(&tmp->rawwriteformat, &tmpfmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &tmpfmt);
}
/* no need to call ast_setstate: the channel_alloc already did its job */
if (state == AST_STATE_RING)
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 513de4285..cb4365298 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -6589,8 +6589,8 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame)
ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s read/write = %s/%s\n",
ast_getformatname(&frame->subclass.format),
ast_getformatname_multiple(s1, sizeof(s1), ast_channel_nativeformats(ast)),
- ast_getformatname(&ast->readformat),
- ast_getformatname(&ast->writeformat));
+ ast_getformatname(ast_channel_readformat(ast)),
+ ast_getformatname(ast_channel_writeformat(ast)));
return 0;
}
if (p) {
@@ -7230,12 +7230,12 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
}
ast_channel_adsicpe_set(tmp, AST_ADSI_UNAVAILABLE);
- ast_format_copy(&tmp->writeformat, &fmt);
- ast_format_copy(&tmp->rawwriteformat, &fmt);
+ ast_format_copy(ast_channel_writeformat(tmp), &fmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &fmt);
ast_rtp_instance_set_write_format(i->rtp, &fmt);
- ast_format_copy(&tmp->readformat, &fmt);
- ast_format_copy(&tmp->rawreadformat, &fmt);
+ ast_format_copy(ast_channel_readformat(tmp), &fmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &fmt);
ast_rtp_instance_set_read_format(i->rtp, &fmt);
ast_channel_tech_pvt_set(tmp, dialog_ref(i, "sip_new: set chan->tech_pvt to i"));
@@ -7579,8 +7579,8 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p
ast_getformatname(&f->subclass.format));
ast_format_cap_remove_bytype(ast_channel_nativeformats(p->owner), AST_FORMAT_TYPE_AUDIO);
ast_format_cap_add(ast_channel_nativeformats(p->owner), &f->subclass.format);
- ast_set_read_format(p->owner, &p->owner->readformat);
- ast_set_write_format(p->owner, &p->owner->writeformat);
+ ast_set_read_format(p->owner, ast_channel_readformat(p->owner));
+ ast_set_write_format(p->owner, ast_channel_writeformat(p->owner));
}
if (f && p->dsp) {
@@ -9656,8 +9656,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_format_cap_joint_append(p->caps, vpeercapability, ast_channel_nativeformats(p->owner));
ast_format_cap_joint_append(p->caps, tpeercapability, ast_channel_nativeformats(p->owner));
- ast_set_read_format(p->owner, &p->owner->readformat);
- ast_set_write_format(p->owner, &p->owner->writeformat);
+ ast_set_read_format(p->owner, ast_channel_readformat(p->owner));
+ ast_set_write_format(p->owner, ast_channel_writeformat(p->owner));
}
if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) && (!ast_sockaddr_isnull(sa) || !ast_sockaddr_isnull(vsa) || !ast_sockaddr_isnull(tsa) || !ast_sockaddr_isnull(isa)) && (!sendonly || sendonly == -1)) {
@@ -22303,8 +22303,8 @@ static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct
}
/* Make formats okay */
- transferee->readformat = chan1->readformat;
- transferee->writeformat = chan1->writeformat;
+ ast_format_copy(ast_channel_readformat(transferee), ast_channel_readformat(chan1));
+ ast_format_copy(ast_channel_writeformat(transferee), ast_channel_writeformat(chan1));
/* Prepare for taking over the channel */
if (ast_channel_masquerade(transferee, chan1)) {
@@ -22327,8 +22327,8 @@ static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct
back the announcement */
/* Make formats okay */
- transferer->readformat = chan2->readformat;
- transferer->writeformat = chan2->writeformat;
+ ast_format_copy(ast_channel_readformat(transferer), ast_channel_readformat(chan2));
+ ast_format_copy(ast_channel_writeformat(transferer), ast_channel_writeformat(chan2));
ast_channel_parkinglot_set(transferer, ast_channel_parkinglot(chan2));
/* Prepare for taking over the channel */
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index a63fb6ec6..6fc1ebc51 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -4525,8 +4525,8 @@ static struct ast_frame *skinny_rtp_read(struct skinny_subchannel *sub)
if (!(ast_format_cap_iscompatible(ast_channel_nativeformats(ast), &f->subclass.format))) {
ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(&f->subclass.format));
ast_format_cap_set(ast_channel_nativeformats(ast), &f->subclass.format);
- ast_set_read_format(ast, &ast->readformat);
- ast_set_write_format(ast, &ast->writeformat);
+ ast_set_read_format(ast, ast_channel_readformat(ast));
+ ast_set_write_format(ast, ast_channel_writeformat(ast));
}
}
}
@@ -4560,8 +4560,8 @@ static int skinny_write(struct ast_channel *ast, struct ast_frame *frame)
ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
ast_getformatname(&frame->subclass.format),
ast_getformatname_multiple(buf, sizeof(buf), ast_channel_nativeformats(ast)),
- ast_getformatname(&ast->readformat),
- ast_getformatname(&ast->writeformat));
+ ast_getformatname(ast_channel_readformat(ast)),
+ ast_getformatname(ast_channel_writeformat(ast)));
return -1;
}
}
@@ -4900,10 +4900,10 @@ static struct ast_channel *skinny_new(struct skinny_line *l, struct skinny_subli
if (state == AST_STATE_RING) {
ast_channel_rings_set(tmp, 1);
}
- ast_format_copy(&tmp->writeformat, &tmpfmt);
- ast_format_copy(&tmp->rawwriteformat, &tmpfmt);
- ast_format_copy(&tmp->readformat, &tmpfmt);
- ast_format_copy(&tmp->rawreadformat, &tmpfmt);
+ ast_format_copy(ast_channel_writeformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_readformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &tmpfmt);
if (!ast_strlen_zero(l->language))
ast_channel_language_set(tmp, l->language);
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index a059d5cb1..3a7b37060 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -2129,19 +2129,19 @@ static void start_rtp(struct unistim_subchannel *sub)
sin.sin_port = htons(sub->parent->parent->rtp_port);
ast_sockaddr_from_sin(&sin_tmp, &sin);
ast_rtp_instance_set_remote_address(sub->rtp, &sin_tmp);
- if (!(ast_format_cap_iscompatible(ast_channel_nativeformats(sub->owner), &sub->owner->readformat))) {
+ if (!(ast_format_cap_iscompatible(ast_channel_nativeformats(sub->owner), ast_channel_readformat(sub->owner)))) {
struct ast_format tmpfmt;
char tmp[256];
ast_best_codec(ast_channel_nativeformats(sub->owner), &tmpfmt);
ast_log(LOG_WARNING,
"Our read/writeformat has been changed to something incompatible: %s, using %s best codec from %s\n",
- ast_getformatname(&sub->owner->readformat),
+ ast_getformatname(ast_channel_readformat(sub->owner)),
ast_getformatname(&tmpfmt),
ast_getformatname_multiple(tmp, sizeof(tmp), ast_channel_nativeformats(sub->owner)));
- ast_format_copy(&sub->owner->readformat, &tmpfmt);
- ast_format_copy(&sub->owner->writeformat, &tmpfmt);
+ ast_format_copy(ast_channel_readformat(sub->owner), &tmpfmt);
+ ast_format_copy(ast_channel_writeformat(sub->owner), &tmpfmt);
}
- codec = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(sub->rtp), 1, &sub->owner->readformat, 0);
+ codec = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(sub->rtp), 1, ast_channel_readformat(sub->owner), 0);
/* Setting up RTP of the phone */
if (public_ip.sin_family == 0) /* NAT IP override ? */
memcpy(&public, &us, sizeof(public)); /* No defined, using IP from recvmsg */
@@ -2150,12 +2150,12 @@ static void start_rtp(struct unistim_subchannel *sub)
if (unistimdebug) {
ast_verb(0, "RTP started : Our IP/port is : %s:%hd with codec %s\n",
ast_inet_ntoa(us.sin_addr),
- htons(us.sin_port), ast_getformatname(&sub->owner->readformat));
+ htons(us.sin_port), ast_getformatname(ast_channel_readformat(sub->owner)));
ast_verb(0, "Starting phone RTP stack. Our public IP is %s\n",
ast_inet_ntoa(public.sin_addr));
}
- if ((sub->owner->readformat.id == AST_FORMAT_ULAW) ||
- (sub->owner->readformat.id == AST_FORMAT_ALAW)) {
+ if ((ast_channel_readformat(sub->owner)->id == AST_FORMAT_ULAW) ||
+ (ast_channel_readformat(sub->owner)->id == AST_FORMAT_ALAW)) {
if (unistimdebug)
ast_verb(0, "Sending packet_send_rtp_packet_size for codec %d\n", codec);
memcpy(buffsend + SIZE_HEADER, packet_send_rtp_packet_size,
@@ -2250,17 +2250,17 @@ static void start_rtp(struct unistim_subchannel *sub)
/* Codec */
buffsend[40] = codec;
buffsend[41] = codec;
- if (sub->owner->readformat.id == AST_FORMAT_ULAW)
+ if (ast_channel_readformat(sub->owner)->id == AST_FORMAT_ULAW)
buffsend[42] = 1; /* 1 = 20ms (160 bytes), 2 = 40ms (320 bytes) */
- else if (sub->owner->readformat.id == AST_FORMAT_ALAW)
+ else if (ast_channel_readformat(sub->owner)->id == AST_FORMAT_ALAW)
buffsend[42] = 1; /* 1 = 20ms (160 bytes), 2 = 40ms (320 bytes) */
- else if (sub->owner->readformat.id == AST_FORMAT_G723_1)
+ else if (ast_channel_readformat(sub->owner)->id == AST_FORMAT_G723_1)
buffsend[42] = 2; /* 1 = 30ms (24 bytes), 2 = 60 ms (48 bytes) */
- else if (sub->owner->readformat.id == AST_FORMAT_G729A)
+ else if (ast_channel_readformat(sub->owner)->id == AST_FORMAT_G729A)
buffsend[42] = 2; /* 1 = 10ms (10 bytes), 2 = 20ms (20 bytes) */
else
ast_log(LOG_WARNING, "Unsupported codec %s!\n",
- ast_getformatname(&sub->owner->readformat));
+ ast_getformatname(ast_channel_readformat(sub->owner)));
/* Source port for transmit RTP and Destination port for receiving RTP */
buffsend[45] = (htons(sin.sin_port) & 0xff00) >> 8;
buffsend[46] = (htons(sin.sin_port) & 0x00ff);
@@ -4049,8 +4049,8 @@ static struct ast_frame *unistim_rtp_read(const struct ast_channel *ast,
ast_getformatname(&f->subclass.format));
ast_format_cap_set(ast_channel_nativeformats(sub->owner), &f->subclass.format);
- ast_set_read_format(sub->owner, &sub->owner->readformat);
- ast_set_write_format(sub->owner, &sub->owner->writeformat);
+ ast_set_read_format(sub->owner, ast_channel_readformat(sub->owner));
+ ast_set_write_format(sub->owner, ast_channel_writeformat(sub->owner));
}
}
}
@@ -4090,8 +4090,8 @@ static int unistim_write(struct ast_channel *ast, struct ast_frame *frame)
"Asked to transmit frame type %s, while native formats is %s (read/write = (%s/%s)\n",
ast_getformatname(&frame->subclass.format),
ast_getformatname_multiple(tmp, sizeof(tmp), ast_channel_nativeformats(ast)),
- ast_getformatname(&ast->readformat),
- ast_getformatname(&ast->writeformat));
+ ast_getformatname(ast_channel_readformat(ast)),
+ ast_getformatname(ast_channel_writeformat(ast)));
return -1;
}
}
@@ -4586,10 +4586,10 @@ static struct ast_channel *unistim_new(struct unistim_subchannel *sub, int state
if (state == AST_STATE_RING)
ast_channel_rings_set(tmp, 1);
ast_channel_adsicpe_set(tmp, AST_ADSI_UNAVAILABLE);
- ast_format_copy(&tmp->writeformat, &tmpfmt);
- ast_format_copy(&tmp->rawwriteformat, &tmpfmt);
- ast_format_copy(&tmp->readformat, &tmpfmt);
- ast_format_copy(&tmp->rawreadformat, &tmpfmt);
+ ast_format_copy(ast_channel_writeformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_readformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &tmpfmt);
ast_channel_tech_pvt_set(tmp, sub);
ast_channel_tech_set(tmp, &unistim_tech);
if (!ast_strlen_zero(l->language))
diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c
index 22dd93bbb..9560784b8 100644
--- a/channels/chan_usbradio.c
+++ b/channels/chan_usbradio.c
@@ -2183,8 +2183,8 @@ static struct ast_channel *usbradio_new(struct chan_usbradio_pvt *o, char *ext,
setformat(o, O_RDWR);
c->fds[0] = o->sounddev; /* -1 if device closed, override later */
ast_format_cap_add(ast_channel_nativeformats(c), &slin);
- ast_format_set(&c->readformat, AST_FORMAT_SLINEAR, 0);
- ast_format_set(&c->writeformat, AST_FORMAT_SLINEAR, 0);
+ ast_format_set(ast_channel_readformat(c), AST_FORMAT_SLINEAR, 0);
+ ast_format_set(ast_channel_writeformat(c), AST_FORMAT_SLINEAR, 0);
ast_channel_tech_pvt_set(c, o);
if (!ast_strlen_zero(o->language))
diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc
index 551738d37..4055fc5b5 100644
--- a/channels/chan_vpb.cc
+++ b/channels/chan_vpb.cc
@@ -2320,7 +2320,7 @@ static void *do_chanreads(void *pvt)
ast_mutex_unlock(&p->play_dtmf_lock);
if (p->owner) {
- ast_format_copy(&tmpfmt, &p->owner->rawreadformat);
+ ast_format_copy(&tmpfmt, ast_channel_rawreadformat(p->owner));
} else {
ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0);
}
@@ -2458,8 +2458,8 @@ static struct ast_channel *vpb_new(struct vpb_pvt *me, enum ast_channel_state st
* linear since we can then adjust volume in this modules.
*/
ast_format_cap_add(ast_channel_nativeformats(tmp), ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
- ast_format_copy(&tmp->rawreadformat, &tmpfmt);
- ast_format_copy(&tmp->rawwriteformat, &tmpfmt);
+ ast_format_copy(ast_channel_rawreadformat(tmp), &tmpfmt);
+ ast_format_copy(ast_channel_rawwriteformat(tmp), &tmpfmt);
if (state == AST_STATE_RING) {
ast_channel_rings_set(tmp, 1);
cid_name[0] = '\0';