00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * fax_modems.h - definitions for the analogue modem set for fax processing 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2008 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_modems.h,v 1.5 2008/08/13 00:11:30 steveu Exp $ 00026 */ 00027 00028 /*! \file */ 00029 00030 #if !defined(_SPANDSP_FAX_MODEMS_H_) 00031 #define _SPANDSP_FAX_MODEMS_H_ 00032 00033 /*! 00034 The set of modems needed for FAX, plus the auxilliary stuff, like tone generation. 00035 */ 00036 typedef struct 00037 { 00038 /*! TRUE is talker echo protection should be sent for the image modems */ 00039 int use_tep; 00040 00041 /*! If TRUE, transmit silence when there is nothing else to transmit. If FALSE return only 00042 the actual generated audio. Note that this only affects untimed silences. Timed silences 00043 (e.g. the 75ms silence between V.21 and a high speed modem) will alway be transmitted as 00044 silent audio. */ 00045 int transmit_on_idle; 00046 00047 /*! \brief An HDLC context used when transmitting HDLC messages. */ 00048 hdlc_tx_state_t hdlc_tx; 00049 /*! \brief An HDLC context used when receiving HDLC messages. */ 00050 hdlc_rx_state_t hdlc_rx; 00051 /*! \brief A V.21 FSK modem context used when transmitting HDLC over V.21 00052 messages. */ 00053 fsk_tx_state_t v21_tx; 00054 /*! \brief A V.21 FSK modem context used when receiving HDLC over V.21 00055 messages. */ 00056 fsk_rx_state_t v21_rx; 00057 /*! \brief A V.17 modem context used when sending FAXes at 7200bps, 9600bps 00058 12000bps or 14400bps */ 00059 v17_tx_state_t v17_tx; 00060 /*! \brief A V.29 modem context used when receiving FAXes at 7200bps, 9600bps 00061 12000bps or 14400bps */ 00062 v17_rx_state_t v17_rx; 00063 /*! \brief A V.29 modem context used when sending FAXes at 7200bps or 00064 9600bps */ 00065 v29_tx_state_t v29_tx; 00066 /*! \brief A V.29 modem context used when receiving FAXes at 7200bps or 00067 9600bps */ 00068 v29_rx_state_t v29_rx; 00069 /*! \brief A V.27ter modem context used when sending FAXes at 2400bps or 00070 4800bps */ 00071 v27ter_tx_state_t v27ter_tx; 00072 /*! \brief A V.27ter modem context used when receiving FAXes at 2400bps or 00073 4800bps */ 00074 v27ter_rx_state_t v27ter_rx; 00075 /*! \brief Used to insert timed silences. */ 00076 silence_gen_state_t silence_gen; 00077 /*! \brief CED or CNG generator */ 00078 modem_connect_tones_tx_state_t connect_tx; 00079 /*! \brief CED or CNG detector */ 00080 modem_connect_tones_rx_state_t connect_rx; 00081 /*! \brief */ 00082 dc_restore_state_t dc_restore; 00083 00084 /*! \brief The currently select receiver type */ 00085 int current_rx_type; 00086 /*! \brief The currently select transmitter type */ 00087 int current_tx_type; 00088 00089 /*! \brief TRUE if a carrier is present. Otherwise FALSE. */ 00090 int rx_signal_present; 00091 /*! \brief TRUE if a modem has trained correctly. */ 00092 int rx_trained; 00093 00094 /*! The current receive signal handler */ 00095 span_rx_handler_t *rx_handler; 00096 void *rx_user_data; 00097 00098 /*! The current transmit signal handler */ 00099 span_tx_handler_t *tx_handler; 00100 void *tx_user_data; 00101 00102 /*! The next transmit signal handler, for two stage transmit operations. 00103 E.g. a short silence followed by a modem signal. */ 00104 span_tx_handler_t *next_tx_handler; 00105 void *next_tx_user_data; 00106 00107 /*! The current bit rate of the transmitter. */ 00108 int tx_bit_rate; 00109 /*! The current bit rate of the receiver. */ 00110 int rx_bit_rate; 00111 00112 /*! If TRUE, transmission is in progress */ 00113 int transmit; 00114 /*! \brief Audio logging file handle for received audio. */ 00115 int audio_rx_log; 00116 /*! \brief Audio logging file handle for transmitted audio. */ 00117 int audio_tx_log; 00118 /*! \brief Error and flow logging control */ 00119 logging_state_t logging; 00120 } fax_modems_state_t; 00121 00122 #if defined(__cplusplus) 00123 extern "C" 00124 { 00125 #endif 00126 00127 /* N.B. the following are currently a work in progress */ 00128 int fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len); 00129 int fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len); 00130 int fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], int len); 00131 fax_modems_state_t *fax_modems_init(fax_modems_state_t *s, void *user_data); 00132 00133 #if defined(__cplusplus) 00134 } 00135 #endif 00136 00137 #endif 00138 /*- End of file ------------------------------------------------------------*/