static void hdlc_underflow_handler(void *user_data) { t30_state_t *s; s = (t30_state_t *) user_data; t30_front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); }
SPAN_DECLARE_NONSTD(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len) { int len; #if defined(LOG_FAX_AUDIO) int required_len; required_len = max_len; #endif len = 0; if (s->modems.transmit) { while ((len += s->modems.tx_handler(s->modems.tx_user_data, &[len], max_len - len)) < max_len) { /* Allow for a change of tx handler within a block */ if (set_next_tx_type(s) && s->modems.current_tx_type != T30_MODEM_NONE && s->modems.current_tx_type != T30_MODEM_DONE) t30_front_end_status(&s->t30, T30_FRONT_END_SEND_STEP_COMPLETE); /*endif*/ if (!s->modems.transmit) { if (s->modems.transmit_on_idle) { /* Pad to the requested length with silence */ memset(&[len], 0, (max_len - len)*sizeof(int16_t)); len = max_len; } /*endif*/ break; } /*endif*/ } /*endwhile*/ } else { if (s->modems.transmit_on_idle) { /* Pad to the requested length with silence */ memset(amp, 0, max_len*sizeof(int16_t)); len = max_len; } /*endif*/ } /*endif*/ #if defined(LOG_FAX_AUDIO) if (s->modems.audio_tx_log >= 0) { if (len < required_len) memset(&[len], 0, (required_len - len)*sizeof(int16_t)); /*endif*/ write(s->modems.audio_tx_log, amp, required_len*sizeof(int16_t)); } /*endif*/ #endif return len; }
int fax_tx(fax_state_t *s, int16_t *amp, int max_len) { int len; #if defined(LOG_FAX_AUDIO) int required_len; required_len = max_len; #endif len = 0; if (s->transmit) { while ((len += s->tx_handler(s->tx_user_data, amp + len, max_len - len)) < max_len) { /* Allow for a change of tx handler within a block */ if (set_next_tx_type(s) && s->current_tx_type != T30_MODEM_NONE && s->current_tx_type != T30_MODEM_DONE) t30_front_end_status(&(s->t30_state), T30_FRONT_END_SEND_COMPLETE); if (!s->transmit) { if (s->transmit_on_idle) { /* Pad to the requested length with silence */ memset(amp + len, 0, (max_len - len)*sizeof(int16_t)); len = max_len; } break; } } } else { if (s->transmit_on_idle) { /* Pad to the requested length with silence */ memset(amp, 0, max_len*sizeof(int16_t)); len = max_len; } } #if defined(LOG_FAX_AUDIO) if (s->fax_audio_tx_log >= 0) { if (len < required_len) memset(amp + len, 0, (required_len - len)*sizeof(int16_t)); write(s->fax_audio_tx_log, amp, required_len*sizeof(int16_t)); } #endif return len; }