summaryrefslogtreecommitdiff
path: root/res/res_fax.c
diff options
context:
space:
mode:
authorDavid Vossel <dvossel@digium.com>2011-02-03 16:22:10 +0000
committerDavid Vossel <dvossel@digium.com>2011-02-03 16:22:10 +0000
commitc26c190711a1bbe3b5fff1a93facae333757c56e (patch)
tree00da0caa5a07b7b25729f089dbcafb08129fa9be /res/res_fax.c
parent652fb64a01c7a8656697d07e606620ee0ced6929 (diff)
Asterisk media architecture conversion - no more format bitfields
This patch is the foundation of an entire new way of looking at media in Asterisk. The code present in this patch is everything required to complete phase1 of my Media Architecture proposal. For more information about this project visit the link below. https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal The primary function of this patch is to convert all the usages of format bitfields in Asterisk to use the new format and format_cap APIs. Functionally no change in behavior should be present in this patch. Thanks to twilson and russell for all the time they spent reviewing these changes. Review: https://reviewboard.asterisk.org/r/1083/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_fax.c')
-rw-r--r--res/res_fax.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/res/res_fax.c b/res/res_fax.c
index 2ec7d2e3a..1191658ca 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -1095,8 +1095,11 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
struct ast_fax_session *fax = NULL;
struct ast_frame *frame = NULL;
struct ast_channel *c = chan;
- unsigned int orig_write_format = 0, orig_read_format = 0;
+ struct ast_format orig_write_format;
+ struct ast_format orig_read_format;
+ ast_format_clear(&orig_write_format);
+ ast_format_clear(&orig_read_format);
chancount = 1;
/* create the FAX session */
@@ -1121,9 +1124,9 @@ 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;;
- expected_framesubclass.codec = AST_FORMAT_SLINEAR;
- orig_write_format = chan->writeformat;
- if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
+ ast_format_set(&expected_framesubclass.format, AST_FORMAT_SLINEAR, 0);
+ ast_format_copy(&orig_write_format, &chan->writeformat);
+ 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", chan->name);
ao2_lock(faxregistry.container);
ao2_unlink(faxregistry.container, fax);
@@ -1132,8 +1135,8 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
ast_channel_unlock(chan);
return -1;
}
- orig_read_format = chan->readformat;
- if (ast_set_read_format(chan, AST_FORMAT_SLINEAR) < 0) {
+ ast_format_copy(&orig_read_format, &chan->readformat);
+ 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", chan->name);
ao2_lock(faxregistry.container);
ao2_unlink(faxregistry.container, fax);
@@ -1151,7 +1154,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
}
} else {
expected_frametype = AST_FRAME_MODEM;
- expected_framesubclass.codec = AST_MODEM_T38;
+ expected_framesubclass.integer = AST_MODEM_T38;
}
if (fax->debug_info) {
@@ -1226,7 +1229,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
fax->tech->switch_to_t38(fax);
details->caps &= ~AST_FAX_TECH_AUDIO;
expected_frametype = AST_FRAME_MODEM;
- expected_framesubclass.codec = AST_MODEM_T38;
+ expected_framesubclass.integer = AST_MODEM_T38;
if (fax->smoother) {
ast_smoother_free(fax->smoother);
fax->smoother = NULL;
@@ -1327,11 +1330,11 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
* restore them now
*/
if (chancount) {
- if (orig_read_format) {
- ast_set_read_format(chan, orig_read_format);
+ if (orig_read_format.id) {
+ ast_set_read_format(chan, &orig_read_format);
}
- if (orig_write_format) {
- ast_set_write_format(chan, orig_write_format);
+ if (orig_write_format.id) {
+ ast_set_write_format(chan, &orig_write_format);
}
}