~ubuntu-branches/ubuntu/saucy/iaxmodem/saucy

« back to all changes in this revision

Viewing changes to lib/spandsp/src/spandsp/fax.h

  • Committer: Bazaar Package Importer
  • Author(s): Julien BLACHE
  • Date: 2006-10-28 10:54:55 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20061028105455-qdnaih9tmq0uc29w
Tags: 0.1.15~dfsg-1
* New upstream release.
* debian/rules:
  + Use new ~dfsg versionning scheme.
  + Do not remove config.* in get-orig-source.
* debian/patches/11_build_configure-stamp.dpatch:
  + Updated.
* debian/iaxmodem.init:
  + Added LSB header.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 * along with this program; if not, write to the Free Software
25
25
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
26
 *
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 $
28
28
 */
29
29
 
30
30
/*! \file */
42
42
typedef struct fax_state_s fax_state_t;
43
43
 
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);
47
45
 
48
46
/*!
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;
57
55
 
 
56
    /*! TRUE is talker echo protection should be sent for the image modems */
 
57
    int use_tep;
 
58
 
58
59
    fax_flush_handler_t *flush_handler;
59
60
    void *flush_user_data;
60
61
 
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;
64
65
 
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;
 
73
    
 
74
    /*! If TRUE, transmission is in progress */
 
75
    int transmit;
 
76
 
 
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
 
80
        silent audio. */
 
81
    int transmit_on_idle;
71
82
 
72
83
    /*! \brief A tone generator context used to generate supervisory tones during
73
84
               FAX handling. */
102
113
    /*! \brief A V.29 modem context used when receiving FAXes at 7200bps or
103
114
               9600bps */
104
115
    v29_rx_state_t v29rx;
 
116
    /*! \brief Used to insert timed silences. */
 
117
    silence_gen_state_t silence_gen;
105
118
    /*! \brief */
106
119
    dc_restore_state_t dc_restore;
107
 
    /*! \brief A counter for audio samples when inserting times silences according
108
 
               to the ITU specifications. */
109
 
    int silent_samples;
110
120
 
111
121
    /*! \brief TRUE is the short training sequence should be used. */
112
122
    int short_train;
115
125
    int current_rx_type;
116
126
    /*! The currently select transmitter type */
117
127
    int current_tx_type;
118
 
    /*! A flag used to force a long preamble for the first HDLC frame in a sequence */
 
128
 
119
129
    int first_tx_hdlc_frame;
120
130
 
121
131
    /*! Audio logging file handles */
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.
139
149
*/
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);
141
151
 
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.
149
159
*/
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);
151
161
 
152
162
void fax_set_flush_handler(fax_state_t *s, fax_flush_handler_t *handler, void *user_data);
153
163
 
 
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
 
169
           behaviour is FALSE.
 
170
*/
 
171
void fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle);
 
172
 
 
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.
 
177
*/
 
178
void fax_set_tep_mode(fax_state_t *s, int use_tep);
 
179
 
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.
162
186
*/
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);
164
188
 
165
189
/*! Release a FAX context.
166
190
    \brief Release a FAX context.