New options to control JBIG fax support

JBIG can be controlled with global enable-jbig or channel fax_enable_jbig
options. JBIG support is enabled by default to preserve current
functionality.
This commit is contained in:
Patrice Fournier 2018-05-22 21:25:12 -04:00
parent c402ce1dee
commit bab2fb7f24
3 changed files with 18 additions and 2 deletions

View File

@ -519,6 +519,7 @@ switch_status_t load_configuration(switch_bool_t reload)
spandsp_globals.verbose_log_level = SWITCH_LOG_DEBUG;
spandsp_globals.use_ecm = 1;
spandsp_globals.disable_v17 = 0;
spandsp_globals.enable_jbig = 1;
spandsp_globals.prepend_string = switch_core_strdup(spandsp_globals.config_pool, "fax");
spandsp_globals.spool = switch_core_strdup(spandsp_globals.config_pool, "/tmp");
spandsp_globals.ident = "SpanDSP Fax Ident";
@ -602,6 +603,11 @@ switch_status_t load_configuration(switch_bool_t reload)
spandsp_globals.disable_v17 = 1;
else
spandsp_globals.disable_v17 = 0;
} else if (!strcmp(name, "enable-jbig")) {
if (switch_true(value))
spandsp_globals.enable_jbig = 1;
else
spandsp_globals.enable_jbig = 0;
} else if (!strcmp(name, "enable-colour")) {
if (switch_true(value))
spandsp_globals.enable_colour_fax = 1;

View File

@ -73,6 +73,7 @@ struct spandsp_globals {
switch_log_level_t verbose_log_level;
short int disable_v17;
short int enable_tep;
short int enable_jbig;
short int enable_colour_fax;
short int enable_image_resizing;
short int enable_colour_to_bilevel;

View File

@ -101,6 +101,7 @@ struct pvt_s {
int use_ecm;
int disable_v17;
int enable_tep;
int enable_jbig;
int enable_colour_fax;
int enable_image_resizing;
int enable_colour_to_bilevel;
@ -983,9 +984,11 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
| T4_RESOLUTION_400_400);
compressions = T4_COMPRESSION_T4_1D
| T4_COMPRESSION_T4_2D
| T4_COMPRESSION_T6
| T4_COMPRESSION_T85
| T4_COMPRESSION_T6;
if (pvt->enable_jbig) {
compressions |= T4_COMPRESSION_T85
| T4_COMPRESSION_T85_L0;
}
if (pvt->enable_colour_fax) {
t30_set_supported_colour_resolutions(t30, T4_RESOLUTION_100_100
| T4_RESOLUTION_200_200
@ -1363,6 +1366,12 @@ static pvt_t *pvt_init(switch_core_session_t *session, mod_spandsp_fax_applicati
pvt->disable_v17 = spandsp_globals.disable_v17;
}
if ((tmp = switch_channel_get_variable(channel, "fax_enable_jbig"))) {
pvt->enable_jbig = switch_true(tmp);
} else {
pvt->enable_jbig = spandsp_globals.enable_jbig;
}
if ((tmp = switch_channel_get_variable(channel, "fax_enable_colour"))) {
pvt->enable_colour_fax = switch_true(tmp);
} else {