mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-17 23:08:35 +00:00
Tweaks to spandsp configuration
This commit is contained in:
1 parent
dd6b8a828a
commit
8b8b91beeb
32 files changed
+472
-299
No files matched your search
@@ -50,6 +50,14 @@ AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/spandsp-sim -DDATADIR="\"$
|
||||
|
||||
LIBDIR = -L$(top_builddir)/src
|
||||
|
||||
if COND_V32BIS
|
||||
V32BIS_PROGS = v32bis_tests
|
||||
endif
|
||||
|
||||
if COND_V34
|
||||
V34_PROGS = v34_tests
|
||||
endif
|
||||
|
||||
noinst_PROGRAMS = ademco_contactid_tests \
|
||||
adsi_tests \
|
||||
alloc_tests \
|
||||
@@ -65,10 +73,12 @@ noinst_PROGRAMS = ademco_contactid_tests \
|
||||
complex_vector_float_tests \
|
||||
complex_vector_int_tests \
|
||||
crc_tests \
|
||||
data_modems_tests \
|
||||
dc_restore_tests \
|
||||
dds_tests \
|
||||
dtmf_rx_tests \
|
||||
dtmf_tx_tests \
|
||||
dummy_modems_tests \
|
||||
echo_tests \
|
||||
fax_decode \
|
||||
fax_tests \
|
||||
@@ -94,6 +104,7 @@ noinst_PROGRAMS = ademco_contactid_tests \
|
||||
playout_tests \
|
||||
plc_tests \
|
||||
power_meter_tests \
|
||||
pseudo_terminal_tests \
|
||||
queue_tests \
|
||||
r2_mf_rx_tests \
|
||||
r2_mf_tx_tests \
|
||||
@@ -130,7 +141,9 @@ noinst_PROGRAMS = ademco_contactid_tests \
|
||||
v42bis_tests \
|
||||
v8_tests \
|
||||
vector_float_tests \
|
||||
vector_int_tests
|
||||
vector_int_tests \
|
||||
$(V32BIS_PROGS) \
|
||||
$(V34_PROGS)
|
||||
|
||||
noinst_HEADERS = echo_monitor.h \
|
||||
fax_tester.h \
|
||||
@@ -139,6 +152,8 @@ noinst_HEADERS = echo_monitor.h \
|
||||
media_monitor.h \
|
||||
modem_monitor.h \
|
||||
pcap_parse.h \
|
||||
pseudo_terminals.h \
|
||||
socket_harness.h \
|
||||
udptl.h
|
||||
|
||||
ademco_contactid_tests_SOURCES = ademco_contactid_tests.c
|
||||
@@ -186,6 +201,9 @@ complex_vector_int_tests_LDADD = $(LIBDIR) -lspandsp
|
||||
crc_tests_SOURCES = crc_tests.c
|
||||
crc_tests_LDADD = $(LIBDIR) -lspandsp
|
||||
|
||||
data_modems_tests_SOURCES = data_modems_tests.c media_monitor.cpp
|
||||
data_modems_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
dc_restore_tests_SOURCES = dc_restore_tests.c
|
||||
dc_restore_tests_LDADD = $(LIBDIR) -lspandsp
|
||||
|
||||
@@ -198,6 +216,9 @@ dtmf_rx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lsp
|
||||
dtmf_tx_tests_SOURCES = dtmf_tx_tests.c
|
||||
dtmf_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
dummy_modems_tests_SOURCES = dummy_modems_tests.c media_monitor.cpp socket_harness.c
|
||||
dummy_modems_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
echo_tests_SOURCES = echo_tests.c echo_monitor.cpp
|
||||
echo_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
@@ -273,6 +294,9 @@ plc_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspands
|
||||
power_meter_tests_SOURCES = power_meter_tests.c
|
||||
power_meter_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
pseudo_terminal_tests_SOURCES = pseudo_terminal_tests.c fax_utils.c pseudo_terminals.c
|
||||
pseudo_terminal_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim -lspandsp -lutil
|
||||
|
||||
queue_tests_SOURCES = queue_tests.c
|
||||
queue_tests_LDADD = $(LIBDIR) -lspandsp
|
||||
|
||||
@@ -369,6 +393,16 @@ v27ter_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspa
|
||||
v29_tests_SOURCES = v29_tests.c line_model_monitor.cpp modem_monitor.cpp
|
||||
v29_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
if COND_V32BIS
|
||||
v32bis_tests_SOURCES = v32bis_tests.c line_model_monitor.cpp modem_monitor.cpp
|
||||
v32bis_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
endif
|
||||
|
||||
if COND_V34
|
||||
v34_tests_SOURCES = v34_tests.c line_model_monitor.cpp modem_monitor.cpp
|
||||
v34_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
endif
|
||||
|
||||
v42_tests_SOURCES = v42_tests.c
|
||||
v42_tests_LDADD = $(LIBDIR) -lspandsp
|
||||
|
||||
|
||||
@@ -58,9 +58,10 @@ int main(int argc, char *argv[])
|
||||
void *b;
|
||||
void *c;
|
||||
|
||||
if (span_mem_allocators(memalign,
|
||||
malloc,
|
||||
if (span_mem_allocators(malloc,
|
||||
realloc,
|
||||
free,
|
||||
memalign,
|
||||
free))
|
||||
{
|
||||
printf("Failed\n");
|
||||
@@ -70,7 +71,7 @@ int main(int argc, char *argv[])
|
||||
b = span_alloc(42);
|
||||
c = span_realloc(NULL, 42);
|
||||
printf("%p %p %p\n", a, b, c);
|
||||
span_free(a);
|
||||
span_aligned_free(a);
|
||||
span_free(b);
|
||||
span_free(c);
|
||||
}
|
||||
|
||||
@@ -463,8 +463,8 @@ int main(int argc, char *argv[])
|
||||
int outframes;
|
||||
SNDFILE *wave_handle;
|
||||
SNDFILE *input_wave_handle;
|
||||
int use_ecm;
|
||||
int use_tep;
|
||||
bool use_ecm;
|
||||
bool use_tep;
|
||||
int feedback_audio;
|
||||
int use_transmit_on_idle;
|
||||
int t38_version;
|
||||
@@ -479,7 +479,6 @@ int main(int argc, char *argv[])
|
||||
double tx_when;
|
||||
double rx_when;
|
||||
int supported_modems;
|
||||
int remove_fill_bits;
|
||||
int opt;
|
||||
int start_page;
|
||||
int end_page;
|
||||
@@ -490,8 +489,11 @@ int main(int argc, char *argv[])
|
||||
int noise_level;
|
||||
int code_to_look_up;
|
||||
int scan_line_time;
|
||||
int allowed_bilevel_resolutions;
|
||||
int colour_enabled;
|
||||
int allowed_bilevel_resolutions[2];
|
||||
int allowed;
|
||||
bool remove_fill_bits;
|
||||
bool colour_enabled;
|
||||
bool t37_like_output;
|
||||
t38_stats_t t38_stats;
|
||||
t30_stats_t t30_stats;
|
||||
logging_state_t *logging;
|
||||
@@ -530,15 +532,22 @@ int main(int argc, char *argv[])
|
||||
scan_line_time = 0;
|
||||
decode_file_name = NULL;
|
||||
code_to_look_up = -1;
|
||||
allowed_bilevel_resolutions = 0;
|
||||
allowed_bilevel_resolutions[0] = 0;
|
||||
allowed_bilevel_resolutions[1] = 0;
|
||||
allowed = 0;
|
||||
colour_enabled = false;
|
||||
t37_like_output = false;
|
||||
t38_transport = T38_TRANSPORT_UDPTL;
|
||||
while ((opt = getopt(argc, argv, "b:c:Cd:D:efFgH:i:Ilm:M:n:p:s:S:tT:u:v:z:")) != -1)
|
||||
while ((opt = getopt(argc, argv, "7b:c:Cd:D:efFgH:i:Ilm:M:n:p:s:S:tT:u:v:z:")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case '7':
|
||||
t37_like_output = true;
|
||||
break;
|
||||
case 'b':
|
||||
allowed_bilevel_resolutions = atoi(optarg);
|
||||
allowed_bilevel_resolutions[allowed] = atoi(optarg);
|
||||
allowed ^= 1;
|
||||
break;
|
||||
case 'c':
|
||||
code_to_look_up = atoi(optarg);
|
||||
@@ -855,7 +864,7 @@ int main(int argc, char *argv[])
|
||||
| T4_SUPPORT_LENGTH_US_LETTER
|
||||
| T4_SUPPORT_LENGTH_US_LEGAL
|
||||
| T4_SUPPORT_LENGTH_UNLIMITED);
|
||||
switch (allowed_bilevel_resolutions)
|
||||
switch (allowed_bilevel_resolutions[i])
|
||||
{
|
||||
case 0:
|
||||
/* Allow anything */
|
||||
@@ -926,7 +935,21 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
t30_set_supported_colour_resolutions(t30_state[i], 0);
|
||||
}
|
||||
t30_set_supported_output_compressions(t30_state[i], T4_COMPRESSION_T6 | T4_COMPRESSION_JPEG);
|
||||
if (t37_like_output)
|
||||
{
|
||||
t30_set_supported_output_compressions(t30_state[i],
|
||||
T4_COMPRESSION_T85
|
||||
| T4_COMPRESSION_T85_L0
|
||||
| T4_COMPRESSION_T6
|
||||
| T4_COMPRESSION_T42_T81);
|
||||
}
|
||||
else
|
||||
{
|
||||
t30_set_supported_output_compressions(t30_state[i],
|
||||
T4_COMPRESSION_T6
|
||||
| T4_COMPRESSION_JPEG);
|
||||
}
|
||||
|
||||
t30_set_ecm_capability(t30_state[i], use_ecm);
|
||||
t30_set_supported_compressions(t30_state[i],
|
||||
T4_COMPRESSION_T4_1D
|
||||
|
||||
@@ -28,7 +28,7 @@ run_fax_test()
|
||||
fi
|
||||
# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
|
||||
# option means the normal differences in tags will be ignored.
|
||||
tiffcmp -t ${FILE} fax_tests.tif >/dev/null
|
||||
${TIFFCMP} -t ${FILE} fax_tests.tif >/dev/null
|
||||
RETVAL=$?
|
||||
if [ $RETVAL != 0 ]
|
||||
then
|
||||
@@ -43,7 +43,7 @@ run_fax_squash_test()
|
||||
{
|
||||
# Test with lengthwise squashing of a bilevel image
|
||||
rm -f fax_tests.tif
|
||||
echo ./fax_tests -b ${SQ} ${OPTS} -i ${IN_FILE}
|
||||
echo ./fax_tests -b ${SQ} -b ${SQ} ${OPTS} -i ${IN_FILE}
|
||||
./fax_tests -b ${SQ} ${OPTS} -i ${IN_FILE} >xyzzy 2>xyzzy2
|
||||
RETVAL=$?
|
||||
if [ $RETVAL != 0 ]
|
||||
@@ -53,7 +53,7 @@ run_fax_squash_test()
|
||||
fi
|
||||
# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
|
||||
# option means the normal differences in tags will be ignored.
|
||||
tiffcmp -t ${OUT_FILE} fax_tests.tif >/dev/null
|
||||
${TIFFCMP} -t ${OUT_FILE} fax_tests.tif >/dev/null
|
||||
RETVAL=$?
|
||||
if [ $RETVAL != 0 ]
|
||||
then
|
||||
@@ -77,7 +77,7 @@ run_colour_fax_test()
|
||||
fi
|
||||
# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
|
||||
# option means the normal differences in tags will be ignored.
|
||||
tiffcmp -t ${OUT_FILE} fax_tests.tif >/dev/null
|
||||
${TIFFCMP} -t ${OUT_FILE} fax_tests.tif >/dev/null
|
||||
RETVAL=$?
|
||||
if [ $RETVAL != 0 ]
|
||||
then
|
||||
@@ -91,40 +91,35 @@ run_colour_fax_test()
|
||||
ITUTESTS_DIR=../test-data/itu/fax
|
||||
TIFFFX_DIR=../test-data/itu/tiff-fx
|
||||
LOCALTESTS_DIR=../test-data/local
|
||||
TIFFCMP=tiffcmp
|
||||
|
||||
# Colour/gray -> bilevel by not allowing ECM
|
||||
for OPTS in "-p AA" "-p TT" "-p GG" "-p TG" "-p GT"
|
||||
do
|
||||
echo Colour to bi-level tests disabled
|
||||
# IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
|
||||
# OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-bilevel.tif"
|
||||
# run_colour_fax_test
|
||||
IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
|
||||
OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-bilevel.tif"
|
||||
run_colour_fax_test
|
||||
|
||||
# IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif"
|
||||
# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif"
|
||||
# run_colour_fax_test
|
||||
IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif"
|
||||
OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif"
|
||||
run_colour_fax_test
|
||||
|
||||
# IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
|
||||
# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif"
|
||||
# run_colour_fax_test
|
||||
IN_FILE="${TIFFFX_DIR}/c03x_02x.tif"
|
||||
OUT_FILE="${TIFFFX_DIR}/c03x_02x-bilevel.tif"
|
||||
run_colour_fax_test
|
||||
|
||||
# IN_FILE="${TIFFFX_DIR}/c03x_02x.tif"
|
||||
# OUT_FILE="${TIFFFX_DIR}/c03x_02x.tif"
|
||||
# run_colour_fax_test
|
||||
IN_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
||||
OUT_FILE="${TIFFFX_DIR}/l02x_02x-bilevel.tif"
|
||||
run_colour_fax_test
|
||||
|
||||
# IN_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
||||
# OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
||||
# run_colour_fax_test
|
||||
|
||||
# IN_FILE="${TIFFFX_DIR}/l04x_02x.tif"
|
||||
# OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif"
|
||||
# run_colour_fax_test
|
||||
IN_FILE="${TIFFFX_DIR}/l04x_02x.tif"
|
||||
OUT_FILE="${TIFFFX_DIR}/l04x_02x-bilevel.tif"
|
||||
run_colour_fax_test
|
||||
done
|
||||
|
||||
# Colour/gray -> colour/gray
|
||||
for OPTS in "-p AA -C -e" "-p TT -C -e" "-p GG -C -e" "-p TG -C -e" "-p GT -C -e"
|
||||
do
|
||||
echo Colour to colour tests disabled
|
||||
# IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
|
||||
# OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-out.tif"
|
||||
# run_colour_fax_test
|
||||
@@ -137,9 +132,9 @@ do
|
||||
# OUT_FILE="${TIFFFX_DIR}/c03x_02x-out.tif"
|
||||
# run_colour_fax_test
|
||||
|
||||
# IN_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
||||
# OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
||||
# run_colour_fax_test
|
||||
IN_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
||||
OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
||||
run_colour_fax_test
|
||||
|
||||
# IN_FILE="${TIFFFX_DIR}/l04x_02x.tif"
|
||||
# OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif"
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* SpanDSP - a series of DSP components for telephony
|
||||
*
|
||||
* pseudo_terminal_tests.c - pseudo terminal handling tests.
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2012 Steve Underwood
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
#include <util.h>
|
||||
#include <sys/ioctl.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <libutil.h>
|
||||
#include <termios.h>
|
||||
#include <sys/socket.h>
|
||||
#else
|
||||
#include <pty.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#include "spandsp.h"
|
||||
|
||||
#include "spandsp/t30_fcf.h"
|
||||
|
||||
#include "spandsp-sim.h"
|
||||
|
||||
#undef SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
|
||||
#include "pseudo_terminals.h"
|
||||
|
||||
static int master(void)
|
||||
{
|
||||
modem_t modem[10];
|
||||
char buf[1024];
|
||||
int len;
|
||||
int i;
|
||||
#if !defined(WIN32)
|
||||
int tioflags;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
if (psuedo_terminal_create(&modem[i]))
|
||||
{
|
||||
printf("Failure\n");
|
||||
exit(2);
|
||||
}
|
||||
printf("%s %s\n", modem[i].devlink, modem[i].stty);
|
||||
}
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
#if !defined(WIN32)
|
||||
ioctl(modem[i].slave, TIOCMGET, &tioflags);
|
||||
tioflags |= TIOCM_RI;
|
||||
ioctl(modem[i].slave, TIOCMSET, &tioflags);
|
||||
#endif
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
len = read(modem[i].master, buf, 4);
|
||||
if (len >= 0)
|
||||
{
|
||||
buf[len] = '\0';
|
||||
printf("%d %d '%s' %s\n", i, len, buf, strerror(errno));
|
||||
#if !defined(WIN32)
|
||||
ioctl(modem[i].slave, TIOCMGET, &tioflags);
|
||||
tioflags |= TIOCM_RI;
|
||||
ioctl(modem[i].slave, TIOCMSET, &tioflags);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
if (psuedo_terminal_close(&modem[i]))
|
||||
{
|
||||
printf("Failure\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int slave(void)
|
||||
{
|
||||
int fd[10];
|
||||
char name[64];
|
||||
int i;
|
||||
int j;
|
||||
#if !defined(WIN32)
|
||||
int tioflags;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
sprintf(name, "/dev/spandsp/%d", i);
|
||||
if ((fd[i] = open(name, O_RDWR)) < 0)
|
||||
{
|
||||
printf("Failed to open %s\n", name);
|
||||
exit(2);
|
||||
}
|
||||
printf("%s\n", name);
|
||||
}
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
#if !defined(WIN32)
|
||||
ioctl(fd[i], TIOCMGET, &tioflags);
|
||||
if ((tioflags & TIOCM_RI))
|
||||
printf("Ring %d\n", i);
|
||||
else
|
||||
printf("No ring %d\n", i);
|
||||
#endif
|
||||
}
|
||||
|
||||
for (j = 0; j < 10; j++)
|
||||
{
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
write(fd[i], "FRED", 4);
|
||||
#if !defined(WIN32)
|
||||
ioctl(fd[i], TIOCMGET, &tioflags);
|
||||
if ((tioflags & TIOCM_RI))
|
||||
printf("Ring %d\n", i);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
if (close(fd[i]))
|
||||
{
|
||||
printf("Failed to close %d\n", i);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 2)
|
||||
master();
|
||||
else
|
||||
slave();
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "pseudo_terminals.h"
|
||||
|
||||
int next_id = 0;
|
||||
const char *device_root_name = "/dev/spandsp";
|
||||
|
||||
int psuedo_terminal_close(modem_t *modem)
|
||||
{
|
||||
@@ -175,7 +176,7 @@ int psuedo_terminal_create(modem_t *modem)
|
||||
modem->threadAbort = CreateEvent(NULL, true, false, NULL);
|
||||
#else
|
||||
modem->slot = next_id++;
|
||||
snprintf(modem->devlink, sizeof(modem->devlink), "/dev/spandsp/%d", modem->slot);
|
||||
snprintf(modem->devlink, sizeof(modem->devlink), "%s/%d", device_root_name, modem->slot);
|
||||
|
||||
/* Remove any stale link which might be present */
|
||||
unlink(modem->devlink);
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* SpanDSP - a series of DSP components for telephony
|
||||
*
|
||||
* pseudo_terminals_tests.c - pseudo terminal handling tests.
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2012 Steve Underwood
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
#include <util.h>
|
||||
#include <sys/ioctl.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <libutil.h>
|
||||
#include <termios.h>
|
||||
#include <sys/socket.h>
|
||||
#else
|
||||
#include <pty.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
#include "spandsp.h"
|
||||
|
||||
#include "pseudo_terminals.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
modem_t modem[10];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
if (psuedo_terminal_create(&modem[i]))
|
||||
printf("Failure\n");
|
||||
printf("%s %s\n", modem[i].devlink, modem[i].stty);
|
||||
}
|
||||
getchar();
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
if (psuedo_terminal_close(&modem[i]))
|
||||
printf("Failure\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
||||
@@ -47,8 +47,6 @@
|
||||
|
||||
#include "spandsp.h"
|
||||
|
||||
#include "spandsp/t30_fcf.h"
|
||||
|
||||
#include "spandsp-sim.h"
|
||||
|
||||
#undef SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
|
||||
@@ -440,7 +440,36 @@ int main(int argc, char *argv[])
|
||||
t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A');
|
||||
t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A');
|
||||
t30_set_ecm_capability(t30, use_ecm);
|
||||
t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D | T4_COMPRESSION_T6 | T4_COMPRESSION_T85);
|
||||
t30_set_supported_compressions(t30,
|
||||
T4_COMPRESSION_T4_1D
|
||||
| T4_COMPRESSION_T4_2D
|
||||
| T4_COMPRESSION_T6
|
||||
| T4_COMPRESSION_T85
|
||||
| T4_COMPRESSION_T85_L0
|
||||
| T4_COMPRESSION_T42_T81
|
||||
| T4_COMPRESSION_COLOUR);
|
||||
t30_set_supported_bilevel_resolutions(t30,
|
||||
T4_RESOLUTION_R8_STANDARD
|
||||
| T4_RESOLUTION_R8_FINE
|
||||
| T4_RESOLUTION_R8_SUPERFINE
|
||||
| T4_RESOLUTION_R16_SUPERFINE
|
||||
| T4_RESOLUTION_200_100
|
||||
| T4_RESOLUTION_200_200
|
||||
| T4_RESOLUTION_200_400
|
||||
| T4_RESOLUTION_300_300
|
||||
| T4_RESOLUTION_300_600
|
||||
| T4_RESOLUTION_400_400
|
||||
| T4_RESOLUTION_400_800
|
||||
| T4_RESOLUTION_600_600
|
||||
| T4_RESOLUTION_600_1200
|
||||
| T4_RESOLUTION_1200_1200);
|
||||
t30_set_supported_colour_resolutions(t30,
|
||||
T4_RESOLUTION_100_100
|
||||
| T4_RESOLUTION_200_200
|
||||
| T4_RESOLUTION_300_300
|
||||
| T4_RESOLUTION_400_400
|
||||
| T4_RESOLUTION_600_600
|
||||
| T4_RESOLUTION_1200_1200);
|
||||
|
||||
if (pcap_scan_pkts(input_file_name, src_addr, src_port, dest_addr, dest_port, t38_terminal_timing_update, process_packet, NULL))
|
||||
exit(2);
|
||||
@@ -497,7 +526,36 @@ int main(int argc, char *argv[])
|
||||
t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'B');
|
||||
t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'B');
|
||||
t30_set_ecm_capability(t30, use_ecm);
|
||||
t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D | T4_COMPRESSION_T6);
|
||||
t30_set_supported_compressions(t30,
|
||||
T4_COMPRESSION_T4_1D
|
||||
| T4_COMPRESSION_T4_2D
|
||||
| T4_COMPRESSION_T6
|
||||
| T4_COMPRESSION_T85
|
||||
| T4_COMPRESSION_T85_L0
|
||||
| T4_COMPRESSION_T42_T81
|
||||
| T4_COMPRESSION_COLOUR);
|
||||
t30_set_supported_bilevel_resolutions(t30,
|
||||
T4_RESOLUTION_R8_STANDARD
|
||||
| T4_RESOLUTION_R8_FINE
|
||||
| T4_RESOLUTION_R8_SUPERFINE
|
||||
| T4_RESOLUTION_R16_SUPERFINE
|
||||
| T4_RESOLUTION_200_100
|
||||
| T4_RESOLUTION_200_200
|
||||
| T4_RESOLUTION_200_400
|
||||
| T4_RESOLUTION_300_300
|
||||
| T4_RESOLUTION_300_600
|
||||
| T4_RESOLUTION_400_400
|
||||
| T4_RESOLUTION_400_800
|
||||
| T4_RESOLUTION_600_600
|
||||
| T4_RESOLUTION_600_1200
|
||||
| T4_RESOLUTION_1200_1200);
|
||||
t30_set_supported_colour_resolutions(t30,
|
||||
T4_RESOLUTION_100_100
|
||||
| T4_RESOLUTION_200_200
|
||||
| T4_RESOLUTION_300_300
|
||||
| T4_RESOLUTION_400_400
|
||||
| T4_RESOLUTION_600_600
|
||||
| T4_RESOLUTION_1200_1200);
|
||||
|
||||
logging = fax_get_logging_state(fax_state);
|
||||
span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
|
||||
|
||||
@@ -300,7 +300,7 @@ int main(int argc, char *argv[])
|
||||
memcpy(data, jpeg_table, jpeg_table_len - 2);
|
||||
|
||||
if (total_len != total_image_len)
|
||||
printf("Size mismatch %ld %ld\n", total_len, total_image_len);
|
||||
printf("Size mismatch %ld %ld\n", (long int) total_len, (long int) total_image_len);
|
||||
off = total_len;
|
||||
switch (compression)
|
||||
{
|
||||
@@ -309,7 +309,7 @@ int main(int argc, char *argv[])
|
||||
case COMPRESSION_CCITT_T6:
|
||||
break;
|
||||
case COMPRESSION_T85:
|
||||
printf("T.85 image %ld bytes\n", total_len);
|
||||
printf("T.85 image %ld bytes\n", (long int) total_len);
|
||||
for (i = 0; i < 16; i++)
|
||||
printf("0x%02x\n", data[i]);
|
||||
t85_decode_init(&t85_dec, t85_row_write_handler, NULL);
|
||||
@@ -322,7 +322,7 @@ int main(int argc, char *argv[])
|
||||
t85_decode_release(&t85_dec);
|
||||
return 0;
|
||||
case COMPRESSION_T43:
|
||||
printf("T.43 image %ld bytes\n", total_len);
|
||||
printf("T.43 image %ld bytes\n", (long int) total_len);
|
||||
if (pack_16(data) == 0xFFA8)
|
||||
{
|
||||
data += 2;
|
||||
@@ -447,7 +447,7 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
off += bytes_per_row;
|
||||
}
|
||||
printf("total %u, off %ld\n", totdata, off);
|
||||
printf("total %u, off %ld\n", totdata, (long int) off);
|
||||
|
||||
/* We now have the image in memory in RGB form */
|
||||
|
||||
@@ -497,7 +497,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
TIFFClose(tif);
|
||||
|
||||
printf("XXX - image is %d by %d, %ld bytes\n", w, h, off);
|
||||
printf("XXX - image is %d by %d, %ld bytes\n", w, h, (long int) off);
|
||||
|
||||
/* We now have the image in memory in ITULAB form */
|
||||
|
||||
|
||||
@@ -288,20 +288,16 @@ int main(int argc, char *argv[])
|
||||
compression_step = -1;
|
||||
}
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T42)
|
||||
else if (strcmp(optarg, "T81") == 0)
|
||||
{
|
||||
compression = T4_COMPRESSION_T42_T81;
|
||||
compression_step = -1;
|
||||
}
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T43)
|
||||
else if (strcmp(optarg, "T43") == 0)
|
||||
{
|
||||
compression = T4_COMPRESSION_T43;
|
||||
compression_step = -1;
|
||||
}
|
||||
#endif
|
||||
#if defined(SPANDSP_SUPPORT_T45)
|
||||
else if (strcmp(optarg, "T45") == 0)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user