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.36 2008/10/13 13:14:00 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 int fax_rx(fax_state_t *s, int16_t *amp, int len);
00056 
00057 /*! Apply T.30 transmit processing to generate a block of audio samples.
00058     \brief Apply T.30 transmit processing to generate a block of audio samples.
00059     \param s The FAX context.
00060     \param amp The audio sample buffer.
00061     \param max_len The number of samples to be generated.
00062     \return The number of samples actually generated. This will be zero when
00063             there is nothing to send.
00064 */
00065 int fax_tx(fax_state_t *s, int16_t *amp, int max_len);
00066 
00067 /*! Select whether silent audio will be sent when FAX transmit is idle.
00068     \brief Select whether silent audio will be sent when FAX transmit is idle.
00069     \param s The FAX context.
00070     \param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is
00071            idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default
00072            behaviour is FALSE.
00073 */
00074 void fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle);
00075 
00076 /*! Select whether talker echo protection tone will be sent for the image modems.
00077     \brief Select whether TEP will be sent for the image modems.
00078     \param s The FAX context.
00079     \param use_tep TRUE if TEP should be sent.
00080 */
00081 void fax_set_tep_mode(fax_state_t *s, int use_tep);
00082 
00083 /*! Get a pointer to the T.30 engine associated with a FAX context.
00084     \brief Get a pointer to the T.30 engine associated with a FAX context.
00085     \param s The FAX context.
00086     \return A pointer to the T.30 context, or NULL.
00087 */
00088 t30_state_t *fax_get_t30_state(fax_state_t *s);
00089 
00090 /*! Get a pointer to the logging context associated with a FAX context.
00091     \brief Get a pointer to the logging context associated with a FAX context.
00092     \param s The FAX context.
00093     \return A pointer to the logging context, or NULL.
00094 */
00095 logging_state_t *fax_get_logging_state(fax_state_t *s);
00096 
00097 /*! Initialise a FAX context.
00098     \brief Initialise a FAX context.
00099     \param s The FAX context.
00100     \param calling_party TRUE if the context is for a calling party. FALSE if the
00101            context is for an answering party.
00102     \return A pointer to the FAX context, or NULL if there was a problem.
00103 */
00104 fax_state_t *fax_init(fax_state_t *s, int calling_party);
00105 
00106 /*! Release a FAX context.
00107     \brief Release a FAX context.
00108     \param s The FAX context.
00109     \return 0 for OK, else -1. */
00110 int fax_release(fax_state_t *s);
00111 
00112 /*! Free a FAX context.
00113     \brief Free a FAX context.
00114     \param s The FAX context.
00115     \return 0 for OK, else -1. */
00116 int fax_free(fax_state_t *s);
00117 
00118 #if defined(__cplusplus)
00119 }
00120 #endif
00121 
00122 #endif
00123 /*- End of file ------------------------------------------------------------*/

Generated on Thu Feb 12 14:16:06 2009 for spandsp by  doxygen 1.5.5