fax.h

Go to the documentation of this file.
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * fax.h - definitions for analogue line ITU T.30 fax processing
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2005 Steve Underwood
00009  *
00010  * All rights reserved.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 2.1,
00014  * as published by the Free Software Foundation.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  *
00025  * $Id: fax.h,v 1.39 2009/03/13 12:59:26 steveu Exp $
00026  */
00027 
00028 /*! \file */
00029 
00030 #if !defined(_SPANDSP_FAX_H_)
00031 #define _SPANDSP_FAX_H_
00032 
00033 /*! \page fax_page FAX over analogue modem handling
00034 
00035 \section fax_page_sec_1 What does it do?
00036 
00037 \section fax_page_sec_2 How does it work?
00038 */
00039 
00040 typedef struct fax_state_s fax_state_t;
00041 
00042 #if defined(__cplusplus)
00043 extern "C"
00044 {
00045 #endif
00046 
00047 /*! Apply T.30 receive processing to a block of audio samples.
00048     \brief Apply T.30 receive processing to a block of audio samples.
00049     \param s The FAX context.
00050     \param amp The audio sample buffer.
00051     \param len The number of samples in the buffer.
00052     \return The number of samples unprocessed. This should only be non-zero if
00053             the software has reached the end of the FAX call.
00054 */
00055 SPAN_DECLARE(int) fax_rx(fax_state_t *s, int16_t *amp, int len);
00056 
00057 /*! Apply fake T.30 receive processing when a block of audio samples is missing (e.g due
00058     to packet loss).
00059     \brief Apply fake T.30 receive processing.
00060     \param s The FAX context.
00061     \param len The number of samples to fake.
00062     \return The number of samples unprocessed. This should only be non-zero if
00063             the software has reached the end of the FAX call.
00064 */
00065 SPAN_DECLARE(int) fax_rx_fillin(fax_state_t *s, int len);
00066 
00067 /*! Apply T.30 transmit processing to generate a block of audio samples.
00068     \brief Apply T.30 transmit processing to generate a block of audio samples.
00069     \param s The FAX context.
00070     \param amp The audio sample buffer.
00071     \param max_len The number of samples to be generated.
00072     \return The number of samples actually generated. This will be zero when
00073             there is nothing to send.
00074 */
00075 SPAN_DECLARE(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len);
00076 
00077 /*! Select whether silent audio will be sent when FAX transmit is idle.
00078     \brief Select whether silent audio will be sent when FAX transmit is idle.
00079     \param s The FAX context.
00080     \param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is
00081            idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default
00082            behaviour is FALSE.
00083 */
00084 SPAN_DECLARE(void) fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle);
00085 
00086 /*! Select whether talker echo protection tone will be sent for the image modems.
00087     \brief Select whether TEP will be sent for the image modems.
00088     \param s The FAX context.
00089     \param use_tep TRUE if TEP should be sent.
00090 */
00091 SPAN_DECLARE(void) fax_set_tep_mode(fax_state_t *s, int use_tep);
00092 
00093 /*! Get a pointer to the T.30 engine associated with a FAX context.
00094     \brief Get a pointer to the T.30 engine associated with a FAX context.
00095     \param s The FAX context.
00096     \return A pointer to the T.30 context, or NULL.
00097 */
00098 SPAN_DECLARE(t30_state_t *) fax_get_t30_state(fax_state_t *s);
00099 
00100 /*! Get a pointer to the logging context associated with a FAX context.
00101     \brief Get a pointer to the logging context associated with a FAX context.
00102     \param s The FAX context.
00103     \return A pointer to the logging context, or NULL.
00104 */
00105 SPAN_DECLARE(logging_state_t *) fax_get_logging_state(fax_state_t *s);
00106 
00107 /*! Initialise a FAX context.
00108     \brief Initialise a FAX context.
00109     \param s The FAX context.
00110     \param calling_party TRUE if the context is for a calling party. FALSE if the
00111            context is for an answering party.
00112     \return A pointer to the FAX context, or NULL if there was a problem.
00113 */
00114 SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party);
00115 
00116 /*! Release a FAX context.
00117     \brief Release a FAX context.
00118     \param s The FAX context.
00119     \return 0 for OK, else -1. */
00120 SPAN_DECLARE(int) fax_release(fax_state_t *s);
00121 
00122 /*! Free a FAX context.
00123     \brief Free a FAX context.
00124     \param s The FAX context.
00125     \return 0 for OK, else -1. */
00126 SPAN_DECLARE(int) fax_free(fax_state_t *s);
00127 
00128 #if defined(__cplusplus)
00129 }
00130 #endif
00131 
00132 #endif
00133 /*- End of file ------------------------------------------------------------*/

Generated on Tue Aug 4 03:35:57 2009 for spandsp by  doxygen 1.5.9