24
24
* along with this program; if not, write to the Free Software
25
25
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
* $Id: fax.h,v 1.10 2006/03/27 13:35:13 steveu Exp $
27
* $Id: fax.h,v 1.18 2006/08/25 21:00:57 steveu Exp $
42
42
typedef struct fax_state_s fax_state_t;
44
44
typedef void (fax_flush_handler_t)(fax_state_t *s, void *user_data, int which);
45
typedef int (fax_rx_handler_t)(void *s, int16_t *amp, int len);
46
typedef int (fax_tx_handler_t)(void *s, int16_t *amp, int max_len);
49
47
Analogue line T.30 FAX channel descriptor. This defines the state of a single working
55
53
to reliably as the structures change over time. */
56
54
t30_state_t t30_state;
56
/*! TRUE is talker echo protection should be sent for the image modems */
58
59
fax_flush_handler_t *flush_handler;
59
60
void *flush_user_data;
61
62
/*! The current receive signal handler */
62
fax_rx_handler_t *rx_handler;
63
span_rx_handler_t *rx_handler;
63
64
void *rx_user_data;
65
66
/*! The current transmit signal handler */
66
fax_tx_handler_t *tx_handler;
67
span_tx_handler_t *tx_handler;
67
68
void *tx_user_data;
69
int tx_hdlc_preamble_len;
68
70
/*! The transmit signal handler to be used when the current one has finished sending. */
69
fax_tx_handler_t *next_tx_handler;
71
span_tx_handler_t *next_tx_handler;
70
72
void *next_tx_user_data;
74
/*! If TRUE, transmission is in progress */
77
/*! If TRUE, transmit silence when there is nothing else to transmit. If FALSE return only
78
the actual generated audio. Note that this only affects untimed silences. Timed silences
79
(e.g. the 75ms silence between V.21 and a high speed modem) will alway be transmitted as
72
83
/*! \brief A tone generator context used to generate supervisory tones during
132
142
/*! Apply T.30 receive processing to a block of audio samples.
133
143
\brief Apply T.30 receive processing to a block of audio samples.
134
144
\param s The FAX context.
135
\param buf The audio sample buffer.
145
\param amp The audio sample buffer.
136
146
\param len The number of samples in the buffer.
137
147
\return The number of samples unprocessed. This should only be non-zero if
138
148
the software has reached the end of the FAX call.
140
int fax_rx(fax_state_t *s, int16_t *buf, int len);
150
int fax_rx(fax_state_t *s, int16_t *amp, int len);
142
152
/*! Apply T.30 transmit processing to generate a block of audio samples.
143
153
\brief Apply T.30 transmit processing to generate a block of audio samples.
144
154
\param s The FAX context.
145
\param buf The audio sample buffer.
155
\param amp The audio sample buffer.
146
156
\param max_len The number of samples to be generated.
147
157
\return The number of samples actually generated. This will be zero when
148
158
there is nothing to send.
150
int fax_tx(fax_state_t *s, int16_t *buf, int max_len);
160
int fax_tx(fax_state_t *s, int16_t *amp, int max_len);
152
162
void fax_set_flush_handler(fax_state_t *s, fax_flush_handler_t *handler, void *user_data);
164
/*! Select whether silent audio will be sent when FAX transmit is idle.
165
\brief Select whether silent audio will be sent when FAX transmit is idle.
166
\param s The FAX context.
167
\param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is
168
idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default
171
void fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle);
173
/*! Select whether talker echo protection tone will be sent for the image modems.
174
\brief Select whether TEP will be sent for the image modems.
175
\param s The FAX context.
176
\param use_tep TRUE if TEP should be sent.
178
void fax_set_tep_mode(fax_state_t *s, int use_tep);
154
180
/*! Initialise a FAX context.
155
181
\brief Initialise a FAX context.
156
182
\param s The FAX context.
157
183
\param calling_party TRUE if the context is for a calling party. FALSE if the
158
184
context is for an answering party.
159
\param user_data An opaque pointer which is associated with the FAX context,
160
and supplied in callbacks.
161
185
\return 0 for OK, else -1.
163
int fax_init(fax_state_t *s, int calling_party, void *user_data);
187
int fax_init(fax_state_t *s, int calling_party);
165
189
/*! Release a FAX context.
166
190
\brief Release a FAX context.