Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/spandsp/fax.h @ 4:26cd8f1ef0b1
import spandsp-0.0.6pre17
| author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
|---|---|
| date | Fri, 25 Jun 2010 15:50:58 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 3:c6c5a16ce2f2 | 4:26cd8f1ef0b1 |
|---|---|
| 1 /* | |
| 2 * SpanDSP - a series of DSP components for telephony | |
| 3 * | |
| 4 * fax.h - definitions for analogue line ITU T.30 fax processing | |
| 5 * | |
| 6 * Written by Steve Underwood <steveu@coppice.org> | |
| 7 * | |
| 8 * Copyright (C) 2005 Steve Underwood | |
| 9 * | |
| 10 * All rights reserved. | |
| 11 * | |
| 12 * This program is free software; you can redistribute it and/or modify | |
| 13 * it under the terms of the GNU Lesser General Public License version 2.1, | |
| 14 * as published by the Free Software Foundation. | |
| 15 * | |
| 16 * This program is distributed in the hope that it will be useful, | |
| 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 * GNU Lesser General Public License for more details. | |
| 20 * | |
| 21 * You should have received a copy of the GNU Lesser General Public | |
| 22 * License along with this program; if not, write to the Free Software | |
| 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 24 * | |
| 25 * $Id: fax.h,v 1.39 2009/03/13 12:59:26 steveu Exp $ | |
| 26 */ | |
| 27 | |
| 28 /*! \file */ | |
| 29 | |
| 30 #if !defined(_SPANDSP_FAX_H_) | |
| 31 #define _SPANDSP_FAX_H_ | |
| 32 | |
| 33 /*! \page fax_page FAX over analogue modem handling | |
| 34 | |
| 35 \section fax_page_sec_1 What does it do? | |
| 36 | |
| 37 \section fax_page_sec_2 How does it work? | |
| 38 */ | |
| 39 | |
| 40 typedef struct fax_state_s fax_state_t; | |
| 41 | |
| 42 #if defined(__cplusplus) | |
| 43 extern "C" | |
| 44 { | |
| 45 #endif | |
| 46 | |
| 47 /*! Apply T.30 receive processing to a block of audio samples. | |
| 48 \brief Apply T.30 receive processing to a block of audio samples. | |
| 49 \param s The FAX context. | |
| 50 \param amp The audio sample buffer. | |
| 51 \param len The number of samples in the buffer. | |
| 52 \return The number of samples unprocessed. This should only be non-zero if | |
| 53 the software has reached the end of the FAX call. | |
| 54 */ | |
| 55 SPAN_DECLARE(int) fax_rx(fax_state_t *s, int16_t *amp, int len); | |
| 56 | |
| 57 /*! Apply fake T.30 receive processing when a block of audio samples is missing (e.g due | |
| 58 to packet loss). | |
| 59 \brief Apply fake T.30 receive processing. | |
| 60 \param s The FAX context. | |
| 61 \param len The number of samples to fake. | |
| 62 \return The number of samples unprocessed. This should only be non-zero if | |
| 63 the software has reached the end of the FAX call. | |
| 64 */ | |
| 65 SPAN_DECLARE(int) fax_rx_fillin(fax_state_t *s, int len); | |
| 66 | |
| 67 /*! Apply T.30 transmit processing to generate a block of audio samples. | |
| 68 \brief Apply T.30 transmit processing to generate a block of audio samples. | |
| 69 \param s The FAX context. | |
| 70 \param amp The audio sample buffer. | |
| 71 \param max_len The number of samples to be generated. | |
| 72 \return The number of samples actually generated. This will be zero when | |
| 73 there is nothing to send. | |
| 74 */ | |
| 75 SPAN_DECLARE(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len); | |
| 76 | |
| 77 /*! Select whether silent audio will be sent when FAX transmit is idle. | |
| 78 \brief Select whether silent audio will be sent when FAX transmit is idle. | |
| 79 \param s The FAX context. | |
| 80 \param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is | |
| 81 idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default | |
| 82 behaviour is FALSE. | |
| 83 */ | |
| 84 SPAN_DECLARE(void) fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle); | |
| 85 | |
| 86 /*! Select whether talker echo protection tone will be sent for the image modems. | |
| 87 \brief Select whether TEP will be sent for the image modems. | |
| 88 \param s The FAX context. | |
| 89 \param use_tep TRUE if TEP should be sent. | |
| 90 */ | |
| 91 SPAN_DECLARE(void) fax_set_tep_mode(fax_state_t *s, int use_tep); | |
| 92 | |
| 93 /*! Get a pointer to the T.30 engine associated with a FAX context. | |
| 94 \brief Get a pointer to the T.30 engine associated with a FAX context. | |
| 95 \param s The FAX context. | |
| 96 \return A pointer to the T.30 context, or NULL. | |
| 97 */ | |
| 98 SPAN_DECLARE(t30_state_t *) fax_get_t30_state(fax_state_t *s); | |
| 99 | |
| 100 /*! Get a pointer to the logging context associated with a FAX context. | |
| 101 \brief Get a pointer to the logging context associated with a FAX context. | |
| 102 \param s The FAX context. | |
| 103 \return A pointer to the logging context, or NULL. | |
| 104 */ | |
| 105 SPAN_DECLARE(logging_state_t *) fax_get_logging_state(fax_state_t *s); | |
| 106 | |
| 107 /*! Initialise a FAX context. | |
| 108 \brief Initialise a FAX context. | |
| 109 \param s The FAX context. | |
| 110 \param calling_party TRUE if the context is for a calling party. FALSE if the | |
| 111 context is for an answering party. | |
| 112 \return A pointer to the FAX context, or NULL if there was a problem. | |
| 113 */ | |
| 114 SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party); | |
| 115 | |
| 116 /*! Release a FAX context. | |
| 117 \brief Release a FAX context. | |
| 118 \param s The FAX context. | |
| 119 \return 0 for OK, else -1. */ | |
| 120 SPAN_DECLARE(int) fax_release(fax_state_t *s); | |
| 121 | |
| 122 /*! Free a FAX context. | |
| 123 \brief Free a FAX context. | |
| 124 \param s The FAX context. | |
| 125 \return 0 for OK, else -1. */ | |
| 126 SPAN_DECLARE(int) fax_free(fax_state_t *s); | |
| 127 | |
| 128 #if defined(__cplusplus) | |
| 129 } | |
| 130 #endif | |
| 131 | |
| 132 #endif | |
| 133 /*- End of file ------------------------------------------------------------*/ |
