comparison spandsp-0.0.6pre17/tests/fax_utils.c @ 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_utils.c
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2009 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 General Public License version 2, as
14 * 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 General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * 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_utils.c,v 1.3.4.1 2009/12/19 09:47:57 steveu Exp $
26 */
27
28 #if defined(HAVE_CONFIG_H)
29 #include "config.h"
30 #endif
31
32 #include <stdlib.h>
33 #include <stdio.h>
34 #include <string.h>
35 #include <assert.h>
36
37 //#if defined(WITH_SPANDSP_INTERNALS)
38 #define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
39 //#endif
40
41 #include "spandsp.h"
42 #include "spandsp-sim.h"
43 #include "fax_utils.h"
44
45 void log_tx_parameters(t30_state_t *s, const char *tag)
46 {
47 const char *u;
48
49 if ((u = t30_get_tx_ident(s)))
50 printf("%s: Local ident '%s'\n", tag, u);
51 if ((u = t30_get_tx_sub_address(s)))
52 printf("%s: Local sub-address '%s'\n", tag, u);
53 if ((u = t30_get_tx_polled_sub_address(s)))
54 printf("%s: Local polled sub-address '%s'\n", tag, u);
55 if ((u = t30_get_tx_selective_polling_address(s)))
56 printf("%s: Local selective polling address '%s'\n", tag, u);
57 if ((u = t30_get_tx_sender_ident(s)))
58 printf("%s: Local sender ident '%s'\n", tag, u);
59 if ((u = t30_get_tx_password(s)))
60 printf("%s: Local password '%s'\n", tag, u);
61 }
62 /*- End of function --------------------------------------------------------*/
63
64 void log_rx_parameters(t30_state_t *s, const char *tag)
65 {
66 const char *u;
67
68 if ((u = t30_get_rx_ident(s)))
69 printf("%s: Remote ident '%s'\n", tag, u);
70 if ((u = t30_get_rx_sub_address(s)))
71 printf("%s: Remote sub-address '%s'\n", tag, u);
72 if ((u = t30_get_rx_polled_sub_address(s)))
73 printf("%s: Remote polled sub-address '%s'\n", tag, u);
74 if ((u = t30_get_rx_selective_polling_address(s)))
75 printf("%s: Remote selective polling address '%s'\n", tag, u);
76 if ((u = t30_get_rx_sender_ident(s)))
77 printf("%s: Remote sender ident '%s'\n", tag, u);
78 if ((u = t30_get_rx_password(s)))
79 printf("%s: Remote password '%s'\n", tag, u);
80 if ((u = t30_get_rx_country(s)))
81 printf("%s: Remote was made in '%s'\n", tag, u);
82 if ((u = t30_get_rx_vendor(s)))
83 printf("%s: Remote was made by '%s'\n", tag, u);
84 if ((u = t30_get_rx_model(s)))
85 printf("%s: Remote is model '%s'\n", tag, u);
86 }
87 /*- End of function --------------------------------------------------------*/
88
89 void log_transfer_statistics(t30_state_t *s, const char *tag)
90 {
91 t30_stats_t t;
92
93 t30_get_transfer_statistics(s, &t);
94 printf("%s: bit rate %d\n", tag, t.bit_rate);
95 printf("%s: ECM %s\n", tag, (t.error_correcting_mode) ? "on" : "off");
96 printf("%s: tx pages %d, rx pages %d\n", tag, t.pages_tx, t.pages_rx);
97 printf("%s: pages in the file %d\n", tag, t.pages_in_file);
98 printf("%s: image size %d pels x %d pels\n", tag, t.width, t.length);
99 printf("%s: image resolution %d pels/m x %d pels/m\n", tag, t.x_resolution, t.y_resolution);
100 printf("%s: bad rows %d, longest bad row run %d\n", tag, t.bad_rows, t.longest_bad_row_run);
101 printf("%s: bad ECM frames %d\n", tag, t.error_correcting_mode_retries);
102 printf("%s: compression type %d\n", tag, t.encoding);
103 printf("%s: image size %d bytes\n", tag, t.image_size);
104 #if defined(WITH_SPANDSP_INTERNALS)
105 printf("%s: bits per row - min %d, max %d\n", tag, s->t4.min_row_bits, s->t4.max_row_bits);
106 #endif
107 }
108 /*- End of function --------------------------------------------------------*/
109 /*- End of file ------------------------------------------------------------*/

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.