Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/spandsp/t4_tx.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 * t4_tx.h - definitions for T.4 FAX transmit processing | |
| 5 * | |
| 6 * Written by Steve Underwood <steveu@coppice.org> | |
| 7 * | |
| 8 * Copyright (C) 2003 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: t4_tx.h,v 1.2.2.3 2009/12/21 17:18:40 steveu Exp $ | |
| 26 */ | |
| 27 | |
| 28 /*! \file */ | |
| 29 | |
| 30 #if !defined(_SPANDSP_T4_TX_H_) | |
| 31 #define _SPANDSP_T4_TX_H_ | |
| 32 | |
| 33 typedef int (*t4_row_read_handler_t)(void *user_data, uint8_t buf[], size_t len); | |
| 34 | |
| 35 #if defined(__cplusplus) | |
| 36 extern "C" { | |
| 37 #endif | |
| 38 | |
| 39 /*! \brief Prepare for transmission of a document. | |
| 40 \param s The T.4 context. | |
| 41 \param file The name of the file to be sent. | |
| 42 \param start_page The first page to send. -1 for no restriction. | |
| 43 \param stop_page The last page to send. -1 for no restriction. | |
| 44 \return A pointer to the context, or NULL if there was a problem. */ | |
| 45 SPAN_DECLARE(t4_state_t *) t4_tx_init(t4_state_t *s, const char *file, int start_page, int stop_page); | |
| 46 | |
| 47 /*! \brief Prepare to send the next page of the current document. | |
| 48 \param s The T.4 context. | |
| 49 \return zero for success, -1 for failure. */ | |
| 50 SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s); | |
| 51 | |
| 52 /*! \brief Prepare the current page for a resend. | |
| 53 \param s The T.4 context. | |
| 54 \return zero for success, -1 for failure. */ | |
| 55 SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s); | |
| 56 | |
| 57 /*! \brief Check for the existance of the next page, and whether its format is like the | |
| 58 current one. This information can be needed before it is determined that the current | |
| 59 page is finished with. | |
| 60 \param s The T.4 context. | |
| 61 \return 0 for next page found with the same format as the current page. | |
| 62 1 for next page found with different format from the current page. | |
| 63 -1 for no page found, or file failure. */ | |
| 64 SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_state_t *s); | |
| 65 | |
| 66 /*! \brief Complete the sending of a page. | |
| 67 \param s The T.4 context. | |
| 68 \return zero for success, -1 for failure. */ | |
| 69 SPAN_DECLARE(int) t4_tx_end_page(t4_state_t *s); | |
| 70 | |
| 71 /*! \brief Return the next bit of the current document page, without actually | |
| 72 moving forward in the buffer. The document will be padded for the | |
| 73 current minimum scan line time. | |
| 74 \param s The T.4 context. | |
| 75 \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is | |
| 76 set (i.e. the returned value is 2 or 3). */ | |
| 77 SPAN_DECLARE(int) t4_tx_check_bit(t4_state_t *s); | |
| 78 | |
| 79 /*! \brief Get the next bit of the current document page. The document will | |
| 80 be padded for the current minimum scan line time. | |
| 81 \param s The T.4 context. | |
| 82 \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is | |
| 83 set (i.e. the returned value is 2 or 3). */ | |
| 84 SPAN_DECLARE(int) t4_tx_get_bit(t4_state_t *s); | |
| 85 | |
| 86 /*! \brief Get the next byte of the current document page. The document will | |
| 87 be padded for the current minimum scan line time. | |
| 88 \param s The T.4 context. | |
| 89 \return The next byte. For the last byte of data, bit 8 is | |
| 90 set. In this case, one or more bits of the byte may be padded with | |
| 91 zeros, to complete the byte. */ | |
| 92 SPAN_DECLARE(int) t4_tx_get_byte(t4_state_t *s); | |
| 93 | |
| 94 /*! \brief Get the next chunk of the current document page. The document will | |
| 95 be padded for the current minimum scan line time. | |
| 96 \param s The T.4 context. | |
| 97 \param buf The buffer into which the chunk is to written. | |
| 98 \param max_len The maximum length of the chunk. | |
| 99 \return The actual length of the chunk. If this is less than max_len it | |
| 100 indicates that the end of the document has been reached. */ | |
| 101 SPAN_DECLARE(int) t4_tx_get_chunk(t4_state_t *s, uint8_t buf[], int max_len); | |
| 102 | |
| 103 /*! \brief End the transmission of a document. Tidy up and close the file. | |
| 104 This should be used to end T.4 transmission started with t4_tx_init. | |
| 105 \param s The T.4 context. | |
| 106 \return 0 for success, otherwise -1. */ | |
| 107 SPAN_DECLARE(int) t4_tx_release(t4_state_t *s); | |
| 108 | |
| 109 /*! \brief End the transmission of a document. Tidy up, close the file and | |
| 110 free the context. This should be used to end T.4 transmission | |
| 111 started with t4_tx_init. | |
| 112 \param s The T.4 context. | |
| 113 \return 0 for success, otherwise -1. */ | |
| 114 SPAN_DECLARE(int) t4_tx_free(t4_state_t *s); | |
| 115 | |
| 116 /*! \brief Set the encoding for the encoded data. | |
| 117 \param s The T.4 context. | |
| 118 \param encoding The encoding. */ | |
| 119 SPAN_DECLARE(void) t4_tx_set_tx_encoding(t4_state_t *s, int encoding); | |
| 120 | |
| 121 /*! \brief Set the minimum number of encoded bits per row. This allows the | |
| 122 makes the encoding process to be set to comply with the minimum row | |
| 123 time specified by a remote receiving machine. | |
| 124 \param s The T.4 context. | |
| 125 \param bits The minimum number of bits per row. */ | |
| 126 SPAN_DECLARE(void) t4_tx_set_min_row_bits(t4_state_t *s, int bits); | |
| 127 | |
| 128 /*! \brief Set the identity of the local machine, for inclusion in page headers. | |
| 129 \param s The T.4 context. | |
| 130 \param ident The identity string. */ | |
| 131 SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident); | |
| 132 | |
| 133 /*! Set the info field, included in the header line included in each page of an encoded | |
| 134 FAX. This is a string of up to 50 characters. Other information (date, local ident, etc.) | |
| 135 are automatically included in the header. If the header info is set to NULL or a zero | |
| 136 length string, no header lines will be added to the encoded FAX. | |
| 137 \brief Set the header info. | |
| 138 \param s The T.4 context. | |
| 139 \param info A string, of up to 50 bytes, which will form the info field. */ | |
| 140 SPAN_DECLARE(void) t4_tx_set_header_info(t4_state_t *s, const char *info); | |
| 141 | |
| 142 /*! \brief Set the row read handler for a T.4 transmit context. | |
| 143 \param s The T.4 transmit context. | |
| 144 \param handler A pointer to the handler routine. | |
| 145 \param user_data An opaque pointer passed to the handler routine. | |
| 146 \return 0 for success, otherwise -1. */ | |
| 147 SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_state_t *s, t4_row_read_handler_t handler, void *user_data); | |
| 148 | |
| 149 /*! \brief Get the row-to-row (y) resolution of the current page. | |
| 150 \param s The T.4 context. | |
| 151 \return The resolution, in pixels per metre. */ | |
| 152 SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_state_t *s); | |
| 153 | |
| 154 /*! \brief Get the column-to-column (x) resolution of the current page. | |
| 155 \param s The T.4 context. | |
| 156 \return The resolution, in pixels per metre. */ | |
| 157 SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_state_t *s); | |
| 158 | |
| 159 /*! \brief Get the width of the current page, in pixel columns. | |
| 160 \param s The T.4 context. | |
| 161 \return The number of columns. */ | |
| 162 SPAN_DECLARE(int) t4_tx_get_image_width(t4_state_t *s); | |
| 163 | |
| 164 /*! \brief Get the number of pages in the file. | |
| 165 \param s The T.4 context. | |
| 166 \return The number of pages, or -1 if there is an error. */ | |
| 167 SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s); | |
| 168 | |
| 169 /*! \brief Get the currnet page number in the file. | |
| 170 \param s The T.4 context. | |
| 171 \return The page number, or -1 if there is an error. */ | |
| 172 SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s); | |
| 173 | |
| 174 #if defined(__cplusplus) | |
| 175 } | |
| 176 #endif | |
| 177 | |
| 178 #endif | |
| 179 /*- End of file ------------------------------------------------------------*/ |
