提交 5c259f26 authored 作者: Steve Underwood's avatar Steve Underwood

Various little tweaks to spandsp to stop warnings with newer compilers

Various little tweaks to spandsp to bring it into line with the master versions
Addition of Ademco Contact ID protocol processing to spandsp
上级 5f09b403
......@@ -16,6 +16,8 @@
## License along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
......
差异被折叠。
......@@ -357,12 +357,6 @@ MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
# If the sources in your project are distributed over multiple directories
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
# in the documentation. The default is YES.
SHOW_DIRECTORIES = YES
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from the
# version control system). Doxygen will invoke the program by executing (via
......@@ -635,12 +629,6 @@ HTML_FOOTER =
HTML_STYLESHEET = css.css
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
......@@ -1123,7 +1111,7 @@ CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
# then doxygen will show the dependencies a directory has on other directories
# in a graphical way. The dependency relations are determined by the #include
# relations between the files in the directories.
......
prefix=@prefix@
exec_prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
......@@ -7,5 +7,6 @@ Name: spandsp
Description: A DSP library for telephony.
Requires:
Version: @VERSION@
Libs: -L${libdir} -lspandsp -ltiff -lm
Libs: -L${libdir} -lspandsp
Libs.private: -ltiff -lm
Cflags: -I${includedir}
Summary: A DSP library for telephony.
Name: spandsp
Version: 0.0.6
Release: 1
License: LGPL
Group: System Environment/Libraries
URL: http://www.soft-switch.org/spandsp
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Source: http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.6.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtiff-devel
BuildRequires: audiofile-devel
%global pre 21
Summary: A DSP library for telephony.
Name: spandsp
Version: 0.0.6
Release: 1
License: LGPLv2 and GPLv2
Group: System Environment/Libraries
URL: http://www.soft-switch.org/spandsp
Source: http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.6.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtiff-devel%{?_isa}
BuildRequires: libjpeg-turbo-devel%{?_isa}
BuildRequires: libxml2-devel%{?_isa}
BuildRequires: libsndfile-devel%{?_isa}
BuildRequires: doxygen
# for xsltproc:
BuildRequires: libxslt
BuildRequires: docbook-style-xsl
%description
SpanDSP is a library of DSP functions for telephony, in the 8000
......@@ -26,49 +29,66 @@ relevant patents have expired. See the file DueDiligence for important
information about these intellectual property issues.
%package devel
Summary: SpanDSP development files
Group: Development/Libraries
Requires: spandsp = %{version}
Requires: libtiff-devel
PreReq: /sbin/install-info
Summary: SpanDSP development files
Group: Development/Libraries
Requires: spandsp%{?_isa} = %{version}-%{release}
Requires: libtiff-devel%{?_isa}
Requires: libjpeg-turbo-devel%{?_isa}
%description devel
SpanDSP development files.
%package apidoc
Summary: SpanDSP API documentation
Group: Development/Libraries
%description apidoc
SpanDSP API documentation.
%prep
%setup -q
%build
%configure --enable-doc --disable-static --disable-rpath
make
find doc/api -type f | xargs touch -r configure
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
rm %{buildroot}%{_libdir}/libspandsp.la
mkdir -p %{buildroot}%{_datadir}/spandsp
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README
%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README
%{_libdir}/libspandsp.so.*
%{_datadir}/spandsp
%files devel
%defattr(-,root,root,-)
%doc doc/api
%{_includedir}/spandsp.h
%{_includedir}/spandsp
%{_libdir}/libspandsp.so
%{_libdir}/pkgconfig/spandsp.pc
%files apidoc
%defattr(-,root,root,-)
%doc doc/api/html/*
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog
* Mon Oct 03 2011 Steve Underwood <steveu@coppice.org> 0.0.6-1
- Converge with what Fedora do
* Wed Sep 24 2008 Tzafrir Cohen <tzafrir.cohen@xorcom.com> 0.0.5-1
- Preparing for 0.0.5pre4 release
- License: LGPL
......
Summary: A DSP library for telephony.
Name: @PACKAGE@
Version: @VERSION@
Release: 1
License: LGPL
Group: System Environment/Libraries
URL: http://www.soft-switch.org/spandsp
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Source: http://www.soft-switch.org/downloads/spandsp/@PACKAGE@-@VERSION@.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtiff-devel
BuildRequires: audiofile-devel
%global pre 21
Summary: A DSP library for telephony.
Name: @PACKAGE@
Version: @VERSION@
Release: 1
License: LGPLv2 and GPLv2
Group: System Environment/Libraries
URL: http://www.soft-switch.org/spandsp
Source: http://www.soft-switch.org/downloads/spandsp/@PACKAGE@-@VERSION@.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtiff-devel%{?_isa}
BuildRequires: libjpeg-turbo-devel%{?_isa}
BuildRequires: libxml2-devel%{?_isa}
BuildRequires: libsndfile-devel%{?_isa}
BuildRequires: doxygen
# for xsltproc:
BuildRequires: libxslt
BuildRequires: docbook-style-xsl
%description
SpanDSP is a library of DSP functions for telephony, in the 8000
......@@ -26,49 +29,66 @@ relevant patents have expired. See the file DueDiligence for important
information about these intellectual property issues.
%package devel
Summary: SpanDSP development files
Group: Development/Libraries
Requires: spandsp = %{version}
Requires: libtiff-devel
PreReq: /sbin/install-info
Summary: SpanDSP development files
Group: Development/Libraries
Requires: spandsp%{?_isa} = %{version}-%{release}
Requires: libtiff-devel%{?_isa}
Requires: libjpeg-turbo-devel%{?_isa}
%description devel
SpanDSP development files.
%package apidoc
Summary: SpanDSP API documentation
Group: Development/Libraries
%description apidoc
SpanDSP API documentation.
%prep
%setup -q
%build
%configure --enable-doc --disable-static --disable-rpath
make
find doc/api -type f | xargs touch -r configure
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
rm %{buildroot}%{_libdir}/libspandsp.la
mkdir -p %{buildroot}%{_datadir}/spandsp
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README
%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README
%{_libdir}/libspandsp.so.*
%{_datadir}/spandsp
%files devel
%defattr(-,root,root,-)
%doc doc/api
%{_includedir}/spandsp.h
%{_includedir}/spandsp
%{_libdir}/libspandsp.so
%{_libdir}/pkgconfig/spandsp.pc
%files apidoc
%defattr(-,root,root,-)
%doc doc/api/html/*
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog
* Mon Oct 03 2011 Steve Underwood <steveu@coppice.org> 0.0.6-1
- Converge with what Fedora do
* Wed Sep 24 2008 Tzafrir Cohen <tzafrir.cohen@xorcom.com> 0.0.5-1
- Preparing for 0.0.5pre4 release
- License: LGPL
......
......@@ -87,7 +87,8 @@ INCLUDES = -I$(top_builddir)
lib_LTLIBRARIES = libspandsp.la
libspandsp_la_SOURCES = adsi.c \
libspandsp_la_SOURCES = ademco_contactid.c \
adsi.c \
async.c \
at_interpreter.c \
awgn.c \
......@@ -173,7 +174,8 @@ libspandsp_la_SOURCES = adsi.c \
libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
nobase_include_HEADERS = spandsp/adsi.h \
nobase_include_HEADERS = spandsp/ademco_contactid.h \
spandsp/adsi.h \
spandsp/async.h \
spandsp/arctan2.h \
spandsp/at_interpreter.h \
......@@ -257,6 +259,7 @@ nobase_include_HEADERS = spandsp/adsi.h \
spandsp/vector_float.h \
spandsp/vector_int.h \
spandsp/version.h \
spandsp/private/ademco_contactid.h \
spandsp/private/adsi.h \
spandsp/private/async.h \
spandsp/private/at_interpreter.h \
......
差异被折叠。
......@@ -647,9 +647,9 @@ SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int
}
memset(s, 0, sizeof(*s));
#if !defined(SPANDSP_USE_FIXED_POINT)
for (j = 0; j < 2; j++)
for (j = 0; j < 3; j++)
{
for (i = 0; i < 3; i++)
for (i = 0; i < 2; i++)
{
s->tone[j].notch_z1[i] = 0.0f;
s->tone[j].notch_z2[i] = 0.0f;
......
......@@ -33,15 +33,19 @@
@SPANDSP_USE_EXPORT_CAPABILITY@
@SPANDSP_SUPPORT_T42@
@SPANDSP_SUPPORT_T43@
@SPANDSP_SUPPORT_T85@
@SPANDSP_SUPPORT_V34@
#include <stdlib.h>
@INSERT_INTTYPES_HEADER@
#include <string.h>
#include <limits.h>
#include <time.h>
@INSERT_MATH_HEADER@
#if !defined(SPANDSP_NO_TIFF)
#include <tiffio.h>
#endif
#include <spandsp/telephony.h>
#include <spandsp/fast_convert.h>
#include <spandsp/logging.h>
......@@ -106,6 +110,8 @@
#include <spandsp/t4_t6_encode.h>
/*#include <spandsp/t81_t82_arith_coding.h>*/
/*#include <spandsp/t85.h>*/
/*#include <spandsp/t42.h>*/
/*#include <spandsp/t43.h>*/
#include <spandsp/t30.h>
#include <spandsp/t30_api.h>
#include <spandsp/t30_fcf.h>
......@@ -120,6 +126,7 @@
#include <spandsp/t38_terminal.h>
#include <spandsp/t31.h>
#include <spandsp/adsi.h>
#include <spandsp/ademco_contactid.h>
#include <spandsp/oki_adpcm.h>
#include <spandsp/ima_adpcm.h>
#include <spandsp/g722.h>
......
差异被折叠。
......@@ -93,6 +93,7 @@
#include <spandsp/private/t31.h>
#include <spandsp/private/v18.h>
#include <spandsp/private/adsi.h>
#include <spandsp/private/ademco_contactid.h>
#endif
/*- End of file ------------------------------------------------------------*/
/*
* SpanDSP - a series of DSP components for telephony
*
* private/ademco_contactid.h - Ademco ContactID alarm protocol
*
* 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 Lesser General Public License version 2.1,
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if !defined(_SPANDSP_PRIVATE_ADEMCO_CONTACTID_H_)
#define _SPANDSP_PRIVATE_ADEMCO_CONTACTID_H_
struct ademco_contactid_receiver_state_s
{
ademco_contactid_report_func_t callback;
void *callback_user_data;
int step;
int remaining_samples;
uint32_t tone_phase;
int32_t tone_phase_rate;
int16_t tone_level;
dtmf_rx_state_t dtmf;
char rx_digits[16 + 1];
int rx_digits_len;
/*! \brief Error and flow logging control */
logging_state_t logging;
};
struct ademco_contactid_sender_state_s
{
tone_report_func_t callback;
void *callback_user_data;
int step;
int remaining_samples;
dtmf_tx_state_t dtmf;
#if defined(SPANDSP_USE_FIXED_POINT)
/*! Minimum acceptable tone level for detection. */
int32_t threshold;
/*! The accumlating total energy on the same period over which the Goertzels work. */
int32_t energy;
#else
/*! Minimum acceptable tone level for detection. */
float threshold;
/*! The accumlating total energy on the same period over which the Goertzels work. */
float energy;
#endif
goertzel_state_t tone_1400;
goertzel_state_t tone_2300;
/*! The current sample number within a processing block. */
int current_sample;
/*! \brief A buffer to save the sent message, in case we need to retry. */
char tx_digits[16 + 1];
int tx_digits_len;
/*! \brief The number of consecutive retries. */
int tries;
int tone_state;
int duration;
int last_hit;
int in_tone;
int clear_to_send;
int timer;
int busy;
/*! \brief Error and flow logging control */
logging_state_t logging;
};
#endif
/*- End of file ------------------------------------------------------------*/
......@@ -2534,7 +2534,7 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
we sent - which would have been a T30_MCF - If the block is for the previous
page, or the previous block of the current page, we can assume we have hit this
condition. */
if (((s->rx_page_number & 0xFF) == page && (s->ecm_block & 0xFF) == block)
if (((s->rx_page_number & 0xFF) == page && ((s->ecm_block - 1) & 0xFF) == block)
||
(((s->rx_page_number - 1) & 0xFF) == page && s->ecm_block == 0))
{
......@@ -2568,7 +2568,6 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
for (j = 0; j < 8; j++)
{
frame_no = (i << 3) + j;
#if defined(VET_ALL_FCD_FRAMES)
if (s->ecm_len[frame_no] >= 0)
{
/* The correct pattern of frame lengths is they will all be 64 or 256 octets long, except the
......@@ -2598,7 +2597,6 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
}
}
}
#endif
if (s->ecm_len[frame_no] < 0)
{
s->ecm_frame_map[i + 3] |= (1 << j);
......
......@@ -383,7 +383,6 @@ static void hdlc_underflow_handler(void *user_data)
{
t38_gateway_state_t *s;
t38_gateway_hdlc_state_t *t;
int old_data_type;
s = (t38_gateway_state_t *) user_data;
t = &s->core.hdlc_to_modem;
......@@ -392,7 +391,6 @@ static void hdlc_underflow_handler(void *user_data)
underflow must be an end of preamble condition. */
if ((t->buf[t->out].flags & HDLC_FLAG_PROCEED_WITH_OUTPUT))
{
old_data_type = t->buf[t->out].contents;
t->buf[t->out].len = 0;
t->buf[t->out].flags = 0;
t->buf[t->out].contents = 0;
......@@ -2117,6 +2115,7 @@ static void t38_hdlc_rx_put_bit(hdlc_rx_state_t *t, int new_bit)
static int restart_rx_modem(t38_gateway_state_t *s)
{
fax_modems_state_t *t;
put_bit_func_t put_bit_func;
void *put_bit_user_data;
......@@ -2138,19 +2137,20 @@ static int restart_rx_modem(t38_gateway_state_t *s)
s->core.short_train,
s->core.ecm_mode);
hdlc_rx_init(&(s->audio.modems.hdlc_rx), FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, NULL, s);
s->audio.modems.rx_signal_present = FALSE;
s->audio.modems.rx_trained = FALSE;
t = &s->audio.modems;
hdlc_rx_init(&t->hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, NULL, s);
t->rx_signal_present = FALSE;
t->rx_trained = FALSE;
/* Default to the transmit data being V.21, unless a faster modem pops up trained. */
s->t38x.current_tx_data_type = T38_DATA_V21;
fsk_rx_init(&(s->audio.modems.v21_rx), &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) t38_hdlc_rx_put_bit, &(s->audio.modems.hdlc_rx));
fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) t38_hdlc_rx_put_bit, &t->hdlc_rx);
#if 0
fsk_rx_signal_cutoff(&(s->audio.modems.v21_rx), -45.5f);
fsk_rx_signal_cutoff(&t->v21_rx, -45.5f);
#endif
if (s->core.image_data_mode && s->core.ecm_mode)
{
put_bit_func = (put_bit_func_t) t38_hdlc_rx_put_bit;
put_bit_user_data = (void *) &(s->audio.modems.hdlc_rx);
put_bit_user_data = (void *) &t->hdlc_rx;
}
else
{
......@@ -2166,26 +2166,26 @@ static int restart_rx_modem(t38_gateway_state_t *s)
s->core.to_t38.octets_per_data_packet = 1;
switch (s->core.fast_rx_modem)
{
case FAX_MODEM_V17_RX:
v17_rx_restart(&s->audio.modems.fast_modems.v17_rx, s->core.fast_bit_rate, s->core.short_train);
v17_rx_set_put_bit(&s->audio.modems.fast_modems.v17_rx, put_bit_func, put_bit_user_data);
set_rx_handler(s, &v17_v21_rx, &v17_v21_rx_fillin, s);
s->core.fast_rx_active = FAX_MODEM_V17_RX;
break;
case FAX_MODEM_V27TER_RX:
v27ter_rx_restart(&s->audio.modems.fast_modems.v27ter_rx, s->core.fast_bit_rate, FALSE);
v27ter_rx_set_put_bit(&s->audio.modems.fast_modems.v27ter_rx, put_bit_func, put_bit_user_data);
v27ter_rx_restart(&t->fast_modems.v27ter_rx, s->core.fast_bit_rate, FALSE);
v27ter_rx_set_put_bit(&t->fast_modems.v27ter_rx, put_bit_func, put_bit_user_data);
set_rx_handler(s, &v27ter_v21_rx, &v27ter_v21_rx_fillin, s);
s->core.fast_rx_active = FAX_MODEM_V27TER_RX;
break;
case FAX_MODEM_V29_RX:
v29_rx_restart(&s->audio.modems.fast_modems.v29_rx, s->core.fast_bit_rate, FALSE);
v29_rx_set_put_bit(&s->audio.modems.fast_modems.v29_rx, put_bit_func, put_bit_user_data);
v29_rx_restart(&t->fast_modems.v29_rx, s->core.fast_bit_rate, FALSE);
v29_rx_set_put_bit(&t->fast_modems.v29_rx, put_bit_func, put_bit_user_data);
set_rx_handler(s, &v29_v21_rx, &v29_v21_rx_fillin, s);
s->core.fast_rx_active = FAX_MODEM_V29_RX;
break;
case FAX_MODEM_V17_RX:
v17_rx_restart(&t->fast_modems.v17_rx, s->core.fast_bit_rate, s->core.short_train);
v17_rx_set_put_bit(&t->fast_modems.v17_rx, put_bit_func, put_bit_user_data);
set_rx_handler(s, &v17_v21_rx, &v17_v21_rx_fillin, s);
s->core.fast_rx_active = FAX_MODEM_V17_RX;
break;
default:
set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &(s->audio.modems.v21_rx));
set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &t->v21_rx);
s->core.fast_rx_active = FAX_MODEM_NONE;
break;
}
......
......@@ -152,9 +152,12 @@ enum
T38_TIMED_STEP_NO_SIGNAL = 0x60
};
static __inline__ void front_end_status(t38_terminal_state_t *s, int status)
static __inline__ int front_end_status(t38_terminal_state_t *s, int status)
{
t30_front_end_status(&s->t30, status);
if (s->t38_fe.timed_step == T38_TIMED_STEP_NONE)
return -1;
return 0;
}
/*- End of function --------------------------------------------------------*/
......@@ -749,6 +752,9 @@ static int stream_non_ecm(t38_terminal_state_t *s)
contain data. Hopefully, following the current spec will not cause compatibility
issues. */
len = t30_non_ecm_get_chunk(&s->t30, buf, fe->octets_per_data_packet);
if (len < 0)
return -1;
/*endif*/
if (len > 0)
bit_reverse(buf, buf, len);
/*endif*/
......@@ -776,7 +782,8 @@ static int stream_non_ecm(t38_terminal_state_t *s)
return res;
/*endif*/
fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5;
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
break;
}
/*endif*/
......@@ -806,7 +813,8 @@ static int stream_non_ecm(t38_terminal_state_t *s)
if (fe->us_per_tx_chunk)
delay = bits_to_us(s, 8*len) + 60000;
/*endif*/
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
break;
}
/*endif*/
......@@ -910,7 +918,8 @@ static int stream_hdlc(t38_terminal_state_t *s)
previous = fe->current_tx_data_type;
fe->hdlc_tx.ptr = 0;
fe->hdlc_tx.len = 0;
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
/* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */
if (fe->hdlc_tx.len >= 0)
{
......@@ -940,7 +949,8 @@ static int stream_hdlc(t38_terminal_state_t *s)
if (fe->us_per_tx_chunk)
delay += 100000;
/*endif*/
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
}
/*endif*/
break;
......@@ -969,7 +979,8 @@ static int stream_hdlc(t38_terminal_state_t *s)
previous = fe->current_tx_data_type;
fe->hdlc_tx.ptr = 0;
fe->hdlc_tx.len = 0;
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
/* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */
if (fe->hdlc_tx.len >= 0)
{
......@@ -1003,7 +1014,8 @@ static int stream_hdlc(t38_terminal_state_t *s)
if (fe->us_per_tx_chunk)
delay += 100000;
/*endif*/
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
}
/*endif*/
break;
......@@ -1059,7 +1071,8 @@ static int stream_ced(t38_terminal_state_t *s)
case T38_TIMED_STEP_CED_3:
/* End of CED */
fe->timed_step = fe->queued_timed_step;
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE);
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
return 0;
}
/*endswitch*/
......
......@@ -112,9 +112,11 @@ static const int year_lengths[2] =
DAYS_PER_LEAP_YEAR
};
static int increment_overflow(int *number, int delta)
static int add_with_overflow_detection(int *number, int delta)
{
int last_number;
/* This needs to be considered volatile, or clever optimisation destroys
the effect of the the rollover detection logic */
volatile int last_number;
last_number = *number;
*number += delta;
......@@ -209,7 +211,7 @@ static struct tm *time_sub(const time_t * const timep, const long int offset, co
if (idelta == 0)
idelta = (tdays < 0) ? -1 : 1;
newy = y;
if (increment_overflow(&newy, idelta))
if (add_with_overflow_detection(&newy, idelta))
return NULL;
leapdays = leaps_thru_end_of(newy - 1) - leaps_thru_end_of(y - 1);
tdays -= ((time_t) newy - y)*DAYS_PER_NON_LEAP_YEAR;
......@@ -234,18 +236,18 @@ static struct tm *time_sub(const time_t * const timep, const long int offset, co
}
while (idays < 0)
{
if (increment_overflow(&y, -1))
if (add_with_overflow_detection(&y, -1))
return NULL;
idays += year_lengths[isleap(y)];
}
while (idays >= year_lengths[isleap(y)])
{
idays -= year_lengths[isleap(y)];
if (increment_overflow(&y, 1))
if (add_with_overflow_detection(&y, 1))
return NULL;
}
tmp->tm_year = y;
if (increment_overflow(&tmp->tm_year, -TM_YEAR_BASE))
if (add_with_overflow_detection(&tmp->tm_year, -TM_YEAR_BASE))
return NULL;
tmp->tm_yday = idays;
/* The "extra" mods below avoid overflow problems. */
......
......@@ -567,9 +567,11 @@ SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch)
static void v18_rx_dtmf(void *user_data, const char digits[], int len)
{
#if 0
v18_state_t *s;
s = (v18_state_t *) user_data;
#endif
}
/*- End of function --------------------------------------------------------*/
......
......@@ -124,7 +124,7 @@ SPAN_DECLARE(const char *) v8_call_function_to_str(int call_function)
case V8_CALL_FUNCTION_EXTENSION:
return "Call function is in extension octet";
}
return "???";
return "Unknown call function";
}
/*- End of function --------------------------------------------------------*/
......@@ -199,7 +199,7 @@ SPAN_DECLARE(const char *) v8_pstn_access_to_str(int pstn_access)
case V8_PSTN_ACCESS_DCE_ON_DIGITAL | V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR | V8_PSTN_ACCESS_CALL_DCE_CELLULAR:
return "DCE on digital, and answering and calling modems on cellular";
}
return "???";
return "PSTN access unknown";
}
/*- End of function --------------------------------------------------------*/
......@@ -235,7 +235,7 @@ SPAN_DECLARE(const char *) v8_pcm_modem_availability_to_str(int pcm_modem_availa
case V8_PSTN_PCM_MODEM_V91 | V8_PSTN_PCM_MODEM_V90_V92_DIGITAL | V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE:
return "V.91 and V.90/V.92 digital/analogue available";
}
return "???";
return "PCM availability unknown";
}
/*- End of function --------------------------------------------------------*/
......@@ -374,6 +374,7 @@ static const uint8_t *process_pstn_access(v8_state_t *s, const uint8_t *p)
static const uint8_t *process_non_standard_facilities(v8_state_t *s, const uint8_t *p)
{
/* TODO: This is wrong */
s->result.nsf = (*p >> 5) & 0x07;
span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_nsf_to_str(s->result.nsf));
return p;
......
......@@ -50,7 +50,8 @@ INCLUDES = -I$(top_builddir)/src -I$(top_builddir)/spandsp-sim -DDATADIR="\"$(pk
LIBDIR = -L$(top_builddir)/src
noinst_PROGRAMS = adsi_tests \
noinst_PROGRAMS = ademco_contactid_tests \
adsi_tests \
async_tests \
at_interpreter_tests \
awgn_tests \
......@@ -134,6 +135,9 @@ noinst_HEADERS = echo_monitor.h \
pcap_parse.h \
udptl.h
ademco_contactid_tests_SOURCES = ademco_contactid_tests.c
ademco_contactid_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
adsi_tests_SOURCES = adsi_tests.c
adsi_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
......
差异被折叠。
......@@ -633,20 +633,20 @@ static int perform_test_sanity(void)
int16_t tx;
int16_t clean;
int far_tx;
int16_t far_sound[SAMPLE_RATE];
//int16_t far_sound[SAMPLE_RATE];
int16_t result_sound[64000];
int result_cur;
int outframes;
int local_cur;
int far_cur;
//int local_cur;
//int far_cur;
//int32_t coeffs[200][128];
//int coeff_index;
print_test_title("Performing basic sanity test\n");
ctx = echo_can_init(TEST_EC_TAPS, 0);
local_cur = 0;
far_cur = 0;
//local_cur = 0;
//far_cur = 0;
result_cur = 0;
echo_can_flush(ctx);
......@@ -684,7 +684,7 @@ static int perform_test_sanity(void)
far_tx = 0;
}
#else
far_sound[0] = 0;
//far_sound[0] = 0;
far_tx = 0;
#endif
rx = channel_model(&chan_model, tx, far_tx);
......
......@@ -89,7 +89,7 @@ int decode_test = FALSE;
int rx_bits = 0;
t30_state_t t30_dummy;
t4_state_t t4_state;
t4_state_t t4_rx_state;
int t4_up = FALSE;
hdlc_rx_state_t hdlcrx;
......@@ -291,12 +291,12 @@ static void t4_begin(void)
int i;
//printf("Begin T.4 - %d %d %d %d\n", line_encoding, x_resolution, y_resolution, image_width);
t4_rx_set_rx_encoding(&t4_state, line_encoding);
t4_rx_set_x_resolution(&t4_state, x_resolution);
t4_rx_set_y_resolution(&t4_state, y_resolution);
t4_rx_set_image_width(&t4_state, image_width);
t4_rx_set_rx_encoding(&t4_rx_state, line_encoding);
t4_rx_set_x_resolution(&t4_rx_state, x_resolution);
t4_rx_set_y_resolution(&t4_rx_state, y_resolution);
t4_rx_set_image_width(&t4_rx_state, image_width);
t4_rx_start_page(&t4_state);
t4_rx_start_page(&t4_rx_state);
t4_up = TRUE;
for (i = 0; i < 256; i++)
......@@ -316,13 +316,13 @@ static void t4_end(void)
for (i = 0; i < 256; i++)
{
if (ecm_len[i] > 0)
t4_rx_put_chunk(&t4_state, ecm_data[i], ecm_len[i]);
t4_rx_put_chunk(&t4_rx_state, ecm_data[i], ecm_len[i]);
fprintf(stderr, "%d", (ecm_len[i] <= 0) ? 0 : 1);
}
fprintf(stderr, "\n");
}
t4_rx_end_page(&t4_state);
t4_rx_get_transfer_statistics(&t4_state, &stats);
t4_rx_end_page(&t4_rx_state);
t4_rx_get_transfer_statistics(&t4_rx_state, &stats);
fprintf(stderr, "Pages = %d\n", stats.pages_transferred);
fprintf(stderr, "Image size = %dx%d\n", stats.width, stats.length);
fprintf(stderr, "Image resolution = %dx%d\n", stats.x_resolution, stats.y_resolution);
......@@ -378,7 +378,7 @@ static void v17_put_bit(void *user_data, int bit)
}
else
{
if (t4_rx_put_bit(&t4_state, bit))
if (t4_rx_put_bit(&t4_rx_state, bit))
{
t4_end();
fprintf(stderr, "End of page detected\n");
......@@ -414,7 +414,7 @@ static void v29_put_bit(void *user_data, int bit)
}
else
{
if (t4_rx_put_bit(&t4_state, bit))
if (t4_rx_put_bit(&t4_rx_state, bit))
{
t4_end();
fprintf(stderr, "End of page detected\n");
......@@ -450,7 +450,7 @@ static void v27ter_put_bit(void *user_data, int bit)
}
else
{
if (t4_rx_put_bit(&t4_state, bit))
if (t4_rx_put_bit(&t4_rx_state, bit))
{
t4_end();
fprintf(stderr, "End of page detected\n");
......@@ -527,7 +527,7 @@ int main(int argc, char *argv[])
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
#endif
if (t4_rx_init(&t4_state, "fax_decode.tif", T4_COMPRESSION_ITU_T4_2D) == NULL)
if (t4_rx_init(&t4_rx_state, "fax_decode.tif", T4_COMPRESSION_ITU_T4_2D) == NULL)
{
fprintf(stderr, "Failed to init\n");
exit(0);
......@@ -543,7 +543,7 @@ int main(int argc, char *argv[])
v29_rx(v29, amp, len);
//v27ter_rx(v27ter, amp, len);
}
t4_rx_release(&t4_state);
t4_rx_release(&t4_rx_state);
if (sf_close(inhandle))
{
......
......@@ -271,14 +271,11 @@ static void non_ecm_rx_status(void *user_data, int status)
static void non_ecm_put_bit(void *user_data, int bit)
{
faxtester_state_t *s;
if (bit < 0)
{
non_ecm_rx_status(user_data, bit);
return;
}
s = (faxtester_state_t *) user_data;
}
/*- End of function --------------------------------------------------------*/
......
......@@ -18,7 +18,7 @@
run_fax_test()
{
rm -f fax_tests_1.tif
echo -i ${FILE} ${OPTS} -i ${FILE}
echo ./fax_tests -i ${FILE} ${OPTS} -i ${FILE}
./fax_tests ${OPTS} -i ${FILE} >xyzzy 2>xyzzy2
RETVAL=$?
if [ $RETVAL != 0 ]
......@@ -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
......
......@@ -307,7 +307,7 @@ static void itu_compliance_tests(void)
/* Get the upper reference output data */
len_comp_upper = get_test_vector(decode_test_files[file + 4], itu_ref_upper, MAX_TEST_VECTOR_LEN);
if (len_data != len_comp_lower || len_data != len_comp_lower)
if (len_data != len_comp_lower || len_data != len_comp_upper)
{
printf("Test data length mismatch\n");
exit(2);
......
......@@ -634,7 +634,7 @@ do
done
echo v27ter_tests completed OK
for OPTS in "-b 9600 -s -42 -n -62" "-b 7200 -s -42 -n -58" "-b 4800 -s -42 -n -55"
for OPTS in "-b 9600 -s -42 -n -62" "-b 7200 -s -42 -n -59" "-b 4800 -s -42 -n -55"
do
./v29_tests ${OPTS} >$STDOUT_DEST 2>$STDERR_DEST
RETVAL=$?
......
......@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
int i;
span_sched_state_t sched;
uint64_t when;
span_schedule_init(&sched);
span_schedule_event(&sched, 500000, callback1, NULL);
......
......@@ -410,7 +410,6 @@ static int detection_range_tests(super_tone_rx_state_t *super)
int16_t amp[SAMPLES_PER_CHUNK];
int i;
int j;
int x;
uint32_t phase;
int32_t phase_inc;
int scale;
......@@ -427,7 +426,7 @@ static int detection_range_tests(super_tone_rx_state_t *super)
{
for (i = 0; i < SAMPLES_PER_CHUNK; i++)
amp[i] = (dds(&phase, phase_inc)*scale) >> 15;
x = super_tone_rx(super, amp, SAMPLES_PER_CHUNK);
super_tone_rx(super, amp, SAMPLES_PER_CHUNK);
}
}
return 0;
......
......@@ -80,6 +80,8 @@ int test_local_interrupt = FALSE;
const char *output_tiff_file_name;
int log_audio = FALSE;
fax_state_t *fax;
faxtester_state_t state;
......@@ -1058,10 +1060,8 @@ static void exchange(faxtester_state_t *s)
int len;
int i;
int total_audio_time;
int log_audio;
logging_state_t *logging;
log_audio = TRUE;
output_tiff_file_name = OUTPUT_TIFF_FILE_NAME;
if (log_audio)
......@@ -1295,10 +1295,14 @@ int main(int argc, char *argv[])
xml_file_name = "../spandsp/tsb85.xml";
test_name = "MRGN01";
while ((opt = getopt(argc, argv, "x:")) != -1)
log_audio = FALSE;
while ((opt = getopt(argc, argv, "lx:")) != -1)
{
switch (opt)
{
case 'l':
log_audio = TRUE;
break;
case 'x':
xml_file_name = optarg;
break;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论