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
This commit is contained in:
parent
235f88d122
commit
ebaf59a656
|
@ -845,10 +845,10 @@ static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, char *cid_num
|
|||
|
||||
ast_channel_tech_set(chn, &mbl_tech);
|
||||
ast_format_cap_add(ast_channel_nativeformats(chn), &prefformat);
|
||||
ast_format_copy(&chn->rawreadformat, &prefformat);
|
||||
ast_format_copy(&chn->rawwriteformat, &prefformat);
|
||||
ast_format_copy(&chn->writeformat, &prefformat);
|
||||
ast_format_copy(&chn->readformat, &prefformat);
|
||||
ast_format_copy(ast_channel_rawreadformat(chn), &prefformat);
|
||||
ast_format_copy(ast_channel_rawwriteformat(chn), &prefformat);
|
||||
ast_format_copy(ast_channel_writeformat(chn), &prefformat);
|
||||
ast_format_copy(ast_channel_readformat(chn), &prefformat);
|
||||
ast_channel_tech_pvt_set(chn, pvt);
|
||||
|
||||
if (state == AST_STATE_RING)
|
||||
|
|
|
@ -390,8 +390,8 @@ static struct ast_channel *ooh323_new(struct ooh323_pvt *i, int state,
|
|||
ast_codec_pref_index(&i->prefs, 0, &tmpfmt);
|
||||
|
||||
ast_format_cap_add(ast_channel_nativeformats(ch), &tmpfmt);
|
||||
ast_format_copy(&ch->rawwriteformat, &tmpfmt);
|
||||
ast_format_copy(&ch->rawreadformat, &tmpfmt);
|
||||
ast_format_copy(ast_channel_rawwriteformat(ch), &tmpfmt);
|
||||
ast_format_copy(ast_channel_rawreadformat(ch), &tmpfmt);
|
||||
|
||||
ast_jb_configure(ch, &global_jbconf);
|
||||
|
||||
|
@ -1177,8 +1177,8 @@ static int ooh323_write(struct ast_channel *ast, struct ast_frame *f)
|
|||
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
|
||||
ast_getformatname(&f->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)));
|
||||
|
||||
ast_set_write_format(ast, &f->subclass.format);
|
||||
} else {
|
||||
|
@ -1512,7 +1512,7 @@ void ooh323_set_write_format(ooCallData *call, struct ast_format *fmt, int txfra
|
|||
}
|
||||
if (gH323Debug)
|
||||
ast_verb(0, "Writeformat before update %s/%s\n",
|
||||
ast_getformatname(&p->owner->writeformat),
|
||||
ast_getformatname(ast_channel_writeformat(p->owner)),
|
||||
ast_getformatname_multiple(formats, sizeof(formats), ast_channel_nativeformats(p->owner)));
|
||||
if (txframes)
|
||||
ast_codec_pref_setsize(&p->prefs, fmt, txframes);
|
||||
|
@ -1527,8 +1527,8 @@ void ooh323_set_write_format(ooCallData *call, struct ast_format *fmt, int txfra
|
|||
}
|
||||
|
||||
ast_format_cap_set(ast_channel_nativeformats(p->owner), fmt);
|
||||
ast_set_write_format(p->owner, &p->owner->writeformat);
|
||||
ast_set_read_format(p->owner, &p->owner->readformat);
|
||||
ast_set_write_format(p->owner, ast_channel_writeformat(p->owner));
|
||||
ast_set_read_format(p->owner, ast_channel_readformat(p->owner));
|
||||
ast_channel_unlock(p->owner);
|
||||
} else
|
||||
ast_log(LOG_ERROR, "No owner found\n");
|
||||
|
@ -1571,9 +1571,9 @@ void ooh323_set_read_format(ooCallData *call, struct ast_format *fmt)
|
|||
|
||||
if (gH323Debug)
|
||||
ast_verb(0, "Readformat before update %s\n",
|
||||
ast_getformatname(&p->owner->readformat));
|
||||
ast_getformatname(ast_channel_readformat(p->owner)));
|
||||
ast_format_cap_set(ast_channel_nativeformats(p->owner), fmt);
|
||||
ast_set_read_format(p->owner, &p->owner->readformat);
|
||||
ast_set_read_format(p->owner, ast_channel_readformat(p->owner));
|
||||
ast_channel_unlock(p->owner);
|
||||
} else
|
||||
ast_log(LOG_ERROR, "No owner found\n");
|
||||
|
@ -4196,7 +4196,7 @@ static int ooh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (ooh323_convertAsteriskCapToH323Cap(&chan->writeformat) < 0) {
|
||||
if (ooh323_convertAsteriskCapToH323Cap(ast_channel_writeformat(chan)) < 0) {
|
||||
ast_log(LOG_WARNING, "Unknown format.\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -4619,8 +4619,8 @@ struct ast_frame *ooh323_rtp_read(struct ast_channel *ast, struct ooh323_pvt *p)
|
|||
if (!(ast_format_cap_iscompatible(ast_channel_nativeformats(p->owner), &f->subclass.format))) {
|
||||
ast_debug(1, "Oooh, voice format changed to %s\n", ast_getformatname(&f->subclass.format));
|
||||
ast_format_cap_set(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 (((p->dtmfmode & H323_DTMF_INBAND) || (p->faxdetect & FAXDETECT_CNG)) && p->vad &&
|
||||
(f->subclass.format.id == AST_FORMAT_SLINEAR || f->subclass.format.id == AST_FORMAT_ALAW ||
|
||||
|
|
|
@ -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", "");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -327,8 +327,8 @@ static int multiplexed_bridge_join(struct ast_bridge *bridge, struct ast_bridge_
|
|||
return 0;
|
||||
}
|
||||
|
||||
if ((ast_format_cmp(&c0->writeformat, &c1->readformat) == AST_FORMAT_CMP_EQUAL) &&
|
||||
(ast_format_cmp(&c0->readformat, &c1->writeformat) == AST_FORMAT_CMP_EQUAL) &&
|
||||
if ((ast_format_cmp(ast_channel_writeformat(c0), ast_channel_readformat(c1)) == AST_FORMAT_CMP_EQUAL) &&
|
||||
(ast_format_cmp(ast_channel_readformat(c0), ast_channel_writeformat(c1)) == AST_FORMAT_CMP_EQUAL) &&
|
||||
(ast_format_cap_identical(ast_channel_nativeformats(c0), ast_channel_nativeformats(c1)))) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ static int simple_bridge_join(struct ast_bridge *bridge, struct ast_bridge_chann
|
|||
}
|
||||
|
||||
/* See if we need to make these compatible */
|
||||
if ((ast_format_cmp(&c0->writeformat, &c1->readformat) == AST_FORMAT_CMP_EQUAL) &&
|
||||
(ast_format_cmp(&c0->readformat, &c1->writeformat) == AST_FORMAT_CMP_EQUAL) &&
|
||||
if ((ast_format_cmp(ast_channel_writeformat(c0), ast_channel_readformat(c1)) == AST_FORMAT_CMP_EQUAL) &&
|
||||
(ast_format_cmp(ast_channel_readformat(c0), ast_channel_writeformat(c1)) == AST_FORMAT_CMP_EQUAL) &&
|
||||
(ast_format_cap_identical(ast_channel_nativeformats(c0), ast_channel_nativeformats(c1)))) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -336,7 +336,7 @@ static int softmix_bridge_destroy(struct ast_bridge *bridge)
|
|||
static void set_softmix_bridge_data(int rate, int interval, struct ast_bridge_channel *bridge_channel, int reset)
|
||||
{
|
||||
struct softmix_channel *sc = bridge_channel->bridge_pvt;
|
||||
unsigned int channel_read_rate = ast_format_rate(&bridge_channel->chan->rawreadformat);
|
||||
unsigned int channel_read_rate = ast_format_rate(ast_channel_rawreadformat(bridge_channel->chan));
|
||||
|
||||
ast_mutex_lock(&sc->lock);
|
||||
if (reset) {
|
||||
|
@ -614,8 +614,8 @@ static void gather_softmix_stats(struct softmix_stats *stats,
|
|||
int channel_native_rate;
|
||||
int i;
|
||||
/* Gather stats about channel sample rates. */
|
||||
channel_native_rate = MAX(ast_format_rate(&bridge_channel->chan->rawwriteformat),
|
||||
ast_format_rate(&bridge_channel->chan->rawreadformat));
|
||||
channel_native_rate = MAX(ast_format_rate(ast_channel_rawwriteformat(bridge_channel->chan)),
|
||||
ast_format_rate(ast_channel_rawreadformat(bridge_channel->chan)));
|
||||
|
||||
if (channel_native_rate > stats->highest_supported_rate) {
|
||||
stats->highest_supported_rate = channel_native_rate;
|
||||
|
@ -859,7 +859,7 @@ static int softmix_bridge_thread(struct ast_bridge *bridge)
|
|||
memcpy(sc->final_buf, buf, softmix_datalen);
|
||||
|
||||
/* process the softmix channel's new write audio */
|
||||
softmix_process_write_audio(&trans_helper, &bridge_channel->chan->rawwriteformat, sc);
|
||||
softmix_process_write_audio(&trans_helper, ast_channel_rawwriteformat(bridge_channel->chan), sc);
|
||||
|
||||
/* The frame is now ready for use... */
|
||||
sc->have_frame = 1;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -317,9 +317,9 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
|
|||
tmpcap = ast_format_cap_destroy(tmpcap);
|
||||
}
|
||||
} else if (!strcasecmp(data, "audioreadformat")) {
|
||||
ast_copy_string(buf, ast_getformatname(&chan->readformat), len);
|
||||
ast_copy_string(buf, ast_getformatname(ast_channel_readformat(chan)), len);
|
||||
} else if (!strcasecmp(data, "audiowriteformat")) {
|
||||
ast_copy_string(buf, ast_getformatname(&chan->writeformat), len);
|
||||
ast_copy_string(buf, ast_getformatname(ast_channel_writeformat(chan)), len);
|
||||
#ifdef CHANNEL_TRACE
|
||||
} else if (!strcasecmp(data, "trace")) {
|
||||
ast_channel_lock(chan);
|
||||
|
|
|
@ -869,7 +869,7 @@ struct ast_channel {
|
|||
int __do_not_use_fdno; /*!< Which fd had an event detected on */
|
||||
int __do_not_use_streamid; /*!< For streaming playback, the schedule ID */
|
||||
int __do_not_use_vstreamid; /*!< For streaming video playback, the schedule ID */
|
||||
struct ast_format oldwriteformat; /*!< Original writer format */
|
||||
struct ast_format __do_not_use_oldwriteformat; /*!< Original writer format */
|
||||
int __do_not_use_timingfd; /*!< Timing fd */
|
||||
enum ast_channel_state __do_not_use_state; /*!< State of line -- Don't write directly, use ast_setstate() */
|
||||
int __do_not_use_rings; /*!< Number of rings so far */
|
||||
|
@ -885,10 +885,10 @@ struct ast_channel {
|
|||
unsigned int flags; /*!< channel flags of AST_FLAG_ type */
|
||||
int alertpipe[2];
|
||||
struct ast_format_cap *__do_not_use_nativeformats; /*!< Kinds of data this channel can natively handle */
|
||||
struct ast_format readformat; /*!< Requested read format (after translation) */
|
||||
struct ast_format writeformat; /*!< Requested write format (after translation) */
|
||||
struct ast_format rawreadformat; /*!< Raw read format (before translation) */
|
||||
struct ast_format rawwriteformat; /*!< Raw write format (before translation) */
|
||||
struct ast_format __do_not_use_readformat; /*!< Requested read format (after translation) */
|
||||
struct ast_format __do_not_use_writeformat; /*!< Requested write format (after translation) */
|
||||
struct ast_format __do_not_use_rawreadformat; /*!< Raw read format (before translation) */
|
||||
struct ast_format __do_not_use_rawwriteformat; /*!< Raw write format (before translation) */
|
||||
unsigned int __do_not_use_emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */
|
||||
#ifdef HAVE_EPOLL
|
||||
int __do_not_use_epfd;
|
||||
|
@ -3731,4 +3731,12 @@ void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe
|
|||
enum ast_channel_state ast_channel_state(const struct ast_channel *chan);
|
||||
/* XXX Internal use only, make sure to move later */
|
||||
void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state);
|
||||
|
||||
/* Format getters */
|
||||
struct ast_format *ast_channel_oldwriteformat(struct ast_channel *chan);
|
||||
struct ast_format *ast_channel_rawreadformat(struct ast_channel *chan);
|
||||
struct ast_format *ast_channel_rawwriteformat(struct ast_channel *chan);
|
||||
struct ast_format *ast_channel_readformat(struct ast_channel *chan);
|
||||
struct ast_format *ast_channel_writeformat(struct ast_channel *chan);
|
||||
|
||||
#endif /* _ASTERISK_CHANNEL_H */
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
10
main/file.c
10
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;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -371,8 +371,8 @@ int AST_OPTIONAL_API_NAME(ast_adsi_transmit_message_full)(struct ast_channel *ch
|
|||
struct ast_format writeformat;
|
||||
struct ast_format readformat;
|
||||
|
||||
ast_format_copy(&writeformat, &chan->writeformat);
|
||||
ast_format_copy(&readformat, &chan->readformat);
|
||||
ast_format_copy(&writeformat, ast_channel_writeformat(chan));
|
||||
ast_format_copy(&readformat, ast_channel_readformat(chan));
|
||||
|
||||
for (x = 0; x < msglen; x += (msg[x+1]+2)) {
|
||||
if (msg[x] == ADSI_SWITCH_TO_DATA) {
|
||||
|
|
|
@ -2289,7 +2289,7 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, const
|
|||
}
|
||||
|
||||
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");
|
||||
|
@ -2937,7 +2937,7 @@ static int handle_speechrecognize(struct ast_channel *chan, AGI *agi, int argc,
|
|||
offset = atoi(argv[4]);
|
||||
|
||||
/* We want frames coming in signed linear */
|
||||
ast_format_copy(&old_read_format, &chan->readformat);
|
||||
ast_format_copy(&old_read_format, ast_channel_readformat(chan));
|
||||
if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR)) {
|
||||
ast_agi_send(agi->fd, chan, "200 result=0\n");
|
||||
return RESULT_SUCCESS;
|
||||
|
@ -3934,7 +3934,7 @@ static int eagi_exec(struct ast_channel *chan, const char *data)
|
|||
ast_log(LOG_ERROR, "EAGI cannot be run on a dead/hungup channel, please use AGI.\n");
|
||||
return 0;
|
||||
}
|
||||
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)) {
|
||||
ast_log(LOG_WARNING, "Unable to set channel '%s' to linear mode\n", ast_channel_name(chan));
|
||||
return -1;
|
||||
|
|
|
@ -746,12 +746,12 @@ static void *do_notify(void *data)
|
|||
}
|
||||
|
||||
ast_channel_tech_set(chan, &null_tech);
|
||||
ast_format_set(&chan->writeformat, AST_FORMAT_SLINEAR, 0);
|
||||
ast_format_set(&chan->readformat, AST_FORMAT_SLINEAR, 0);
|
||||
ast_format_set(&chan->rawwriteformat, AST_FORMAT_SLINEAR, 0);
|
||||
ast_format_set(&chan->rawreadformat, AST_FORMAT_SLINEAR, 0);
|
||||
ast_format_set(ast_channel_writeformat(chan), AST_FORMAT_SLINEAR, 0);
|
||||
ast_format_set(ast_channel_readformat(chan), AST_FORMAT_SLINEAR, 0);
|
||||
ast_format_set(ast_channel_rawwriteformat(chan), AST_FORMAT_SLINEAR, 0);
|
||||
ast_format_set(ast_channel_rawreadformat(chan), AST_FORMAT_SLINEAR, 0);
|
||||
/* clear native formats and set to slinear. write format is signlear so just use that to set it */
|
||||
ast_format_cap_set(ast_channel_nativeformats(chan), &chan->writeformat);
|
||||
ast_format_cap_set(ast_channel_nativeformats(chan), ast_channel_writeformat(chan));
|
||||
|
||||
if (!(datastore = ast_datastore_alloc(&event_notification_datastore, NULL))) {
|
||||
ast_log(LOG_ERROR, "Could not allocate datastore, notification not being sent!\n");
|
||||
|
|
|
@ -1355,7 +1355,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
|
|||
if (details->caps & AST_FAX_TECH_AUDIO) {
|
||||
expected_frametype = AST_FRAME_VOICE;;
|
||||
ast_format_set(&expected_framesubclass.format, AST_FORMAT_SLINEAR, 0);
|
||||
ast_format_copy(&orig_write_format, &chan->writeformat);
|
||||
ast_format_copy(&orig_write_format, ast_channel_writeformat(chan));
|
||||
if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
|
||||
ast_log(LOG_ERROR, "channel '%s' failed to set write format to signed linear'.\n", ast_channel_name(chan));
|
||||
ao2_lock(faxregistry.container);
|
||||
|
@ -1365,7 +1365,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
|
|||
ast_channel_unlock(chan);
|
||||
return -1;
|
||||
}
|
||||
ast_format_copy(&orig_read_format, &chan->readformat);
|
||||
ast_format_copy(&orig_read_format, ast_channel_readformat(chan));
|
||||
if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
|
||||
ast_log(LOG_ERROR, "channel '%s' failed to set read format to signed linear.\n", ast_channel_name(chan));
|
||||
ao2_lock(faxregistry.container);
|
||||
|
@ -3004,11 +3004,11 @@ static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct
|
|||
|
||||
/* we are bridged, change r/w formats to SLIN for v21 preamble
|
||||
* detection and T.30 */
|
||||
ast_format_copy(&gateway->chan_read_format, &chan->readformat);
|
||||
ast_format_copy(&gateway->chan_write_format, &chan->readformat);
|
||||
ast_format_copy(&gateway->chan_read_format, ast_channel_readformat(chan));
|
||||
ast_format_copy(&gateway->chan_write_format, ast_channel_readformat(chan));
|
||||
|
||||
ast_format_copy(&gateway->peer_read_format, &peer->readformat);
|
||||
ast_format_copy(&gateway->peer_write_format, &peer->readformat);
|
||||
ast_format_copy(&gateway->peer_read_format, ast_channel_readformat(peer));
|
||||
ast_format_copy(&gateway->peer_write_format, ast_channel_readformat(peer));
|
||||
|
||||
ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR);
|
||||
ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR);
|
||||
|
@ -3272,8 +3272,8 @@ static struct ast_frame *fax_detect_framehook(struct ast_channel *chan, struct a
|
|||
switch (event) {
|
||||
case AST_FRAMEHOOK_EVENT_ATTACHED:
|
||||
/* Setup format for DSP on ATTACH*/
|
||||
ast_format_copy(&faxdetect->orig_format, &chan->readformat);
|
||||
switch (chan->readformat.id) {
|
||||
ast_format_copy(&faxdetect->orig_format, ast_channel_readformat(chan));
|
||||
switch (ast_channel_readformat(chan)->id) {
|
||||
case AST_FORMAT_SLINEAR:
|
||||
case AST_FORMAT_ALAW:
|
||||
case AST_FORMAT_ULAW:
|
||||
|
|
|
@ -392,7 +392,7 @@ static void moh_files_write_format_change(struct ast_channel *chan, void *data)
|
|||
if (&state->origwfmt.id) {
|
||||
struct ast_format tmp;
|
||||
|
||||
ast_format_copy(&tmp, &chan->writeformat);
|
||||
ast_format_copy(&tmp, ast_channel_writeformat(chan));
|
||||
if (state->mohwfmt.id) {
|
||||
ast_format_clear(&state->origwfmt);
|
||||
ast_set_write_format(chan, &state->mohwfmt);
|
||||
|
@ -470,8 +470,8 @@ static void *moh_files_alloc(struct ast_channel *chan, void *params)
|
|||
}
|
||||
|
||||
state->class = mohclass_ref(class, "Reffing music class for channel");
|
||||
ast_format_copy(&state->origwfmt, &chan->writeformat);
|
||||
ast_format_copy(&state->mohwfmt, &chan->writeformat);
|
||||
ast_format_copy(&state->origwfmt, ast_channel_writeformat(chan));
|
||||
ast_format_copy(&state->mohwfmt, ast_channel_writeformat(chan));
|
||||
|
||||
/* For comparison on restart of MOH (see above) */
|
||||
ast_copy_string(state->name, class->name, sizeof(state->name));
|
||||
|
@ -992,7 +992,7 @@ static void *moh_alloc(struct ast_channel *chan, void *params)
|
|||
}
|
||||
|
||||
if ((res = mohalloc(class))) {
|
||||
ast_format_copy(&res->origwfmt, &chan->writeformat);
|
||||
ast_format_copy(&res->origwfmt, ast_channel_writeformat(chan));
|
||||
if (ast_set_write_format(chan, &class->format)) {
|
||||
ast_log(LOG_WARNING, "Unable to set channel '%s' to format '%s'\n", ast_channel_name(chan), ast_codec2str(&class->format));
|
||||
moh_release(NULL, res);
|
||||
|
|
Loading…
Reference in New Issue