t38_non_ecm_buffer.h

Go to the documentation of this file.
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * t38_non_ecm_buffer.h - A rate adapting buffer for T.38 non-ECM image
00005  *                        and TCF data
00006  *
00007  * Written by Steve Underwood <steveu@coppice.org>
00008  *
00009  * Copyright (C) 2005, 2006, 2007, 2008 Steve Underwood
00010  *
00011  * All rights reserved.
00012  *
00013  * This program is free software; you can redistribute it and/or modify
00014  * it under the terms of the GNU Lesser General Public License version 2.1,
00015  * as published by the Free Software Foundation.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU Lesser General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU Lesser General Public
00023  * License along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00025  *
00026  * $Id: t38_non_ecm_buffer.h,v 1.7 2009/02/10 13:06:47 steveu Exp $
00027  */
00028 
00029 /*! \file */
00030 
00031 #if !defined(_SPANDSP_T38_NON_ECM_BUFFER_H_)
00032 #define _SPANDSP_T38_NON_ECM_BUFFER_H_
00033 
00034 /*! \page t38_non_ecm_buffer_page T.38 rate adapting non-ECM image data buffer
00035 \section t38_non_ecm_buffer_page_sec_1 What does it do?
00036 
00037 The T.38 rate adapting non-ECM image data buffer is used to buffer TCF and non-ECM
00038 FAX image data being gatewayed from a T.38 linke to an analogue FAX modem link.
00039 
00040 \section t38_non_ecm_buffer_page_sec_2 How does it work?
00041 */
00042 
00043 /*! The buffer length much be a power of two. The chosen length is big enough for
00044     over 9s of data at the V.17 14,400bps rate. */    
00045 #define T38_NON_ECM_TX_BUF_LEN  16384
00046 
00047 /*! \brief A flow controlled non-ECM image data buffer, for buffering T.38 to analogue
00048            modem data.
00049 */
00050 typedef struct t38_non_ecm_buffer_state_s t38_non_ecm_buffer_state_t;
00051 
00052 #if defined(__cplusplus)
00053 extern "C"
00054 {
00055 #endif
00056 
00057 /*! \brief Initialise a T.38 rate adapting non-ECM buffer context.
00058     \param s The buffer context.
00059     \param mode TRUE for image data mode, or FALSE for TCF mode.
00060     \param bits The minimum number of bits per FAX image row.
00061     \return A pointer to the buffer context, or NULL if there was a problem. */
00062 SPAN_DECLARE(t38_non_ecm_buffer_state_t *) t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits);
00063 
00064 SPAN_DECLARE(int) t38_non_ecm_buffer_release(t38_non_ecm_buffer_state_t *s);
00065 
00066 SPAN_DECLARE(int) t38_non_ecm_buffer_free(t38_non_ecm_buffer_state_t *s);
00067 
00068 /*! \brief Set the mode of a T.38 rate adapting non-ECM buffer context.
00069     \param s The buffer context.
00070     \param mode TRUE for image data mode, or FALSE for TCF mode.
00071     \param bits The minimum number of bits per FAX image row. */
00072 SPAN_DECLARE(void) t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits);
00073 
00074 /*! \brief Inject data to T.38 rate adapting non-ECM buffer context.
00075     \param s The buffer context.
00076     \param buf The data buffer to be injected.
00077     \param len The length of the data to be injected. */
00078 SPAN_DECLARE(void) t38_non_ecm_buffer_inject(t38_non_ecm_buffer_state_t *s, const uint8_t *buf, int len);
00079 
00080 /*! \brief Inform a T.38 rate adapting non-ECM buffer context that the incoming data has finished,
00081            and the contents of the buffer should be played out as quickly as possible.
00082     \param s The buffer context. */
00083 SPAN_DECLARE(void) t38_non_ecm_buffer_push(t38_non_ecm_buffer_state_t *s);
00084 
00085 /*! \brief Report the input status of a T.38 rate adapting non-ECM buffer context to the specified
00086            logging context.
00087     \param s The buffer context.
00088     \param logging The logging context. */
00089 SPAN_DECLARE(void) t38_non_ecm_buffer_report_input_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging);
00090 
00091 /*! \brief Report the output status of a T.38 rate adapting non-ECM buffer context to the specified
00092            logging context.
00093     \param s The buffer context.
00094     \param logging The logging context. */
00095 SPAN_DECLARE(void) t38_non_ecm_buffer_report_output_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging);
00096 
00097 /*! \brief Get the next bit of data from a T.38 rate adapting non-ECM buffer context.
00098     \param user_data The buffer context, cast to a void pointer.
00099     \return The next bit, or one of the values indicating a change of modem status. */
00100 SPAN_DECLARE_NONSTD(int) t38_non_ecm_buffer_get_bit(void *user_data);
00101 
00102 #if defined(__cplusplus)
00103 }
00104 #endif
00105 
00106 #endif
00107 /*- End of file ------------------------------------------------------------*/

Generated on Tue Aug 4 03:36:07 2009 for spandsp by  doxygen 1.5.9