Merge branch 'master' into v1.4.beta

This commit is contained in:
Ken Rice
2013-08-13 17:22:00 -05:00
257 changed files with 6020 additions and 3981 deletions
+19
View File
@@ -38,6 +38,11 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_console", "src\mod\loggers\mod_console\mod_console.2010.vcxproj", "{1C453396-D912-4213-89FD-9B489162B7B5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_rpc", "src\mod\xml_int\mod_xml_rpc\mod_xml_rpc.2010.vcxproj", "{CBEC7225-0C21-4DA8-978E-1F158F8AD950}"
ProjectSection(ProjectDependencies) = postProject
{9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6} = {9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6}
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981} = {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}
{329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_rss", "src\mod\applications\mod_rss\mod_rss.2010.vcxproj", "{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}"
EndProject
@@ -221,6 +226,7 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libs\spandsp\src\libspandsp.2010.vcxproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
ProjectSection(ProjectDependencies) = postProject
{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} = {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981} = {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libs\speex\win32\VS2008\libspeex\libspeex.vcxproj", "{E972C52F-9E85-4D65-B19C-031E511E9DB4}"
@@ -338,6 +344,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gennmtab", "libs\win32\xmlr
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_math_fixed_tables", "libs\spandsp\src\msvc\make_math_fixed_tables.2010.vcxproj", "{9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_cielab_luts", "libs\spandsp\src\msvc\make_cielab_luts.2010.vcxproj", "{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Win32 = All|Win32
@@ -2067,6 +2075,17 @@ Global
{9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6}.Release|Win32.Build.0 = All|Win32
{9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6}.Release|x64.ActiveCfg = All|Win32
{9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6}.Release|x64.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x64.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.Build.0 = All|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+2
View File
@@ -3801,11 +3801,13 @@ Global
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64 Setup.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x86 Setup.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64 Setup.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x86 Setup.ActiveCfg = All|Win32
EndGlobalSection
+2
View File
@@ -3811,11 +3811,13 @@ Global
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64 Setup.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x86 Setup.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64 Setup.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x86 Setup.ActiveCfg = All|Win32
EndGlobalSection
+1
View File
@@ -291,6 +291,7 @@ libfreeswitch_la_SOURCES = \
libs/libnatpmp/natpmp.c \
libs/libnatpmp/getgateway.c\
libs/spandsp/src/plc.c \
libs/spandsp/src/alloc.c \
libs/spandsp/src/bit_operations.c
if ENABLE_CPP
+34 -1
View File
@@ -716,11 +716,13 @@ App.usersController = Ember.ArrayController.create({
App.initialize();
var global_debug_event = false;
var global_background_job = false;
function eventCallback(data) {
console.log(data["Event-Name"]);
if (global_debug_event) {
if (global_debug_event ||
(global_background_job && data["Event-Name"] == "BACKGROUND_JOB")) {
console.log(data);
}
@@ -783,3 +785,34 @@ function eventCallback(data) {
}
}
// execute api
function api(cmdstr)
{
cmdarr = cmdstr.split(" ");
cmd = cmdarr.shift();
arg = escape(cmdarr.join(" "));
arg = arg ? "?" + arg : "";
url = "/txtapi/" + cmd + arg;
$.get(url, function(data){
console.log(data);
});
return url;
}
//execute bgapi
function bgapi(cmd)
{
if (!global_background_job) {
socket.send("event json BACKGROUND_JOB");
global_background_job = true;
}
api("bgapi " + cmd);
}
// subscribe event
function event(e)
{
cmd = "event json " + e;
socket.send(cmd);
return cmd;
}
+256 -141
View File
@@ -1,121 +1,80 @@
Building and installing spandsp
===============================
A number of distributions include spandsp, but they usually use older versions
of the library, which lack a lot of the features of the current version. Before
installing spandsp, make sure there are no older versions already on your
machine. Make sure libtiff is installed on your machine. Versions 3.5.7,
3.6.0, 3.7.1 and 3.8.2 seem to work OK. There have been several bugs related
to FAX document handling in some versions of libtiff. Also, some people have
had trouble using spandsp because they had more than one version of libtiff
on their machine. Take care with this. If you are using an RPM based system,
such as RedHat or Fedora, you will need the libtiff and libtiff-devel RPMs
installed to be able to build spandsp.
You can use the usual:
./configure
make
make install
process to build the spandsp library. Note that if you use configure in this
way, the software will be installed in /usr/local. In this case make sure your
/etc/ld.so.conf file has an entry for /usr/local/lib. If you wish the software
to be installed in /usr, you should build it with the commands.
./configure --prefix=/usr
make
make install
Building the programming documentation
======================================
If you wish to build the programming documentation for spandsp, configure
spandsp with:
./configure --enable-doc
You need doxygen installed on your machine.
Building the test suite
=======================
Most sections of the spandsp library have an accompanying test program in the
test directory. If you wish to build these test programs, configure spandsp
with:
./configure --enable-tests
To build these tests you will need libaudiofile installed on your machine. To
build the modem tests, with the GUI monitoring feature you will need Fltk 1.1.4
or later, an audio meter module and a cartesian plotting module. Fltk may be
obtained from http://www.fltk.org. The audio meter module may be obtained from
http://www.soft-switch.org/downloads/Fl_Audio_Meter.tgz . The cartesian plotting
module may be obtained from http://134.226.68.29/fltk. However, there is no
suitable makefile supplied with that. You can find a version at
http://www.soft-switch.org/downloads/Fl_Cartesian.tgz which will build as a
Linux library. The actual code in both these versions is identical.
You need to have Fltk 1.1.4 or later installed before building the plotting
library.
Applications
============
Applications support for spandsp is built into packages such as Callweaver,
FreeSwitch and iaxmodem. Code to add spandsp based FAX support to Asterisk may
be found at http://sourceforge.net/projects/agx-ast-addons.
Installation Instructions
*************************
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
These are generic installation instructions.
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' is used to create `configure' by a program
called `autoconf'. You only need `configure.ac' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
`./configure' to configure the package for your system.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
documentation.
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
privileges.
5. You can remove the program binaries and object files from the
5. Optionally, type `make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
@@ -124,62 +83,119 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type `make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
source code in the directory that `configure' is in and in `..'. This
is known as a "VPATH" build.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple `-arch' options to the
compiler but only a single `-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the `lipo' tool if you have problems.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
@@ -192,25 +208,80 @@ find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX `make' updates targets which have the same time stamps as
their prerequisites, which makes it generally unusable when shipped
generated files such as `configure' are involved. Use GNU `make'
instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
to try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
where SYSTEM can have one of these forms:
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
@@ -223,19 +294,56 @@ default values for variables like `CC', `cache_file', and `prefix'.
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf limitation. Until the limitation is lifted, you can use
this workaround:
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`-h'
Print a summary of all of the options to `configure', and exit.
`--help=short'
`--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
@@ -248,8 +356,15 @@ operates.
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
`configure' also accepts some other, not widely useful, options.
`--no-create'
`-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
+7
View File
@@ -138,6 +138,7 @@ AC_ARG_ENABLE(avx, [ --enable-avx Enable AVX support])
AC_ARG_ENABLE(avx2, [ --enable-avx2 Enable AVX2 support])
AC_ARG_ENABLE(neon, [ --enable-neon Enable NEON support])
AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support])
# The following is for MSVC, where we may be using a local copy of libtiff, built alongside spandsp
AC_ARG_ENABLE(builtin_tiff,
[AC_HELP_STRING([--enable-builtin-tiff],[build with builtin libtiff])],[enable_builtin_tiff="$enableval"],[enable_builtin_tiff="no"])
@@ -164,6 +165,8 @@ fi
AX_C99_FLEXIBLE_ARRAY
AC_CHECK_FUNCS([aligned_alloc])
AC_CHECK_FUNCS([memalign])
AC_CHECK_FUNCS([posix_memalign])
AC_CHECK_FUNCS([memmove])
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([select])
@@ -184,6 +187,9 @@ AC_HEADER_TIME
AC_CHECK_HEADERS([socket.h])
AC_CHECK_HEADERS([inttypes.h], [INSERT_INTTYPES_HEADER="#include <inttypes.h>"])
AC_CHECK_HEADERS([stdint.h], [INSERT_STDINT_HEADER="#include <stdint.h>"])
AC_CHECK_HEADERS([stdatomic.h])
AC_CHECK_HEADERS([stdbool.h], [INSERT_STDBOOL_HEADER="#include <stdbool.h>"], [INSERT_STDBOOL_HEADER="#include <spandsp/stdbool.h>"])
AC_CHECK_HEADERS([stdfix.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
@@ -589,6 +595,7 @@ AC_SUBST(INSERT_INTTYPES_HEADER)
AC_SUBST(INSERT_STDINT_HEADER)
AC_SUBST(INSERT_TGMATH_HEADER)
AC_SUBST(INSERT_MATH_HEADER)
AC_SUBST(INSERT_STDBOOL_HEADER)
AC_CONFIG_FILES([Makefile
doc/Makefile
+1 -1
View File
@@ -34,7 +34,7 @@ EXTRA_DIST = libspandsp_sim.dsp \
msvc/vc9proj.head \
msvc/vc9proj.foot
INCLUDES = -I$(top_builddir) -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\""
AM_CPPFLAGS = -I$(top_builddir) -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\""
noinst_PROGRAMS = make_line_models
+4 -1
View File
@@ -78,12 +78,13 @@ EXTRA_DIST = floating_fudge.h \
spandsp/private/README \
spandsp/version.h.in
INCLUDES = -I$(top_builddir)
AM_CPPFLAGS = -I$(top_builddir)
lib_LTLIBRARIES = libspandsp.la
libspandsp_la_SOURCES = ademco_contactid.c \
adsi.c \
alloc.c \
async.c \
at_interpreter.c \
awgn.c \
@@ -178,6 +179,7 @@ libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@
nobase_include_HEADERS = spandsp/ademco_contactid.h \
spandsp/adsi.h \
spandsp/alloc.h \
spandsp/async.h \
spandsp/arctan2.h \
spandsp/at_interpreter.h \
@@ -222,6 +224,7 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \
spandsp/queue.h \
spandsp/saturated.h \
spandsp/schedule.h \
spandsp/stdbool.h \
spandsp/sig_tone.h \
spandsp/silence_gen.h \
spandsp/super_tone_rx.h \
+22 -16
View File
@@ -39,6 +39,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <memory.h>
#include <string.h>
@@ -46,6 +51,7 @@
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
@@ -447,7 +453,7 @@ static const struct ademco_code_s ademco_codes[] =
#define TONE_TO_TOTAL_ENERGY 45.2233f /* -0.85dB [GOERTZEL_SAMPLES_PER_BLOCK*10^(-0.85/10.0)] */
#endif
static int tone_rx_init = FALSE;
static int tone_rx_init = false;
static goertzel_descriptor_t tone_1400_desc;
static goertzel_descriptor_t tone_2300_desc;
@@ -749,7 +755,7 @@ SPAN_DECLARE(ademco_contactid_receiver_state_t *) ademco_contactid_receiver_init
{
if (s == NULL)
{
if ((s = (ademco_contactid_receiver_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (ademco_contactid_receiver_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -776,7 +782,7 @@ SPAN_DECLARE(int) ademco_contactid_receiver_release(ademco_contactid_receiver_st
SPAN_DECLARE(int) ademco_contactid_receiver_free(ademco_contactid_receiver_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -793,7 +799,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_tx(ademco_contactid_sender_state_t *s,
case 0:
if (!s->clear_to_send)
return 0;
s->clear_to_send = FALSE;
s->clear_to_send = false;
s->step++;
s->remaining_samples = ms_to_samples(250);
/* Fall through */
@@ -810,7 +816,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_tx(ademco_contactid_sender_state_t *s,
samples = dtmf_tx(&s->dtmf, &amp[sample], max_samples - sample);
if (samples == 0)
{
s->clear_to_send = FALSE;
s->clear_to_send = false;
s->step = 0;
return sample;
}
@@ -947,7 +953,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
s->callback(s->callback_user_data, -1, 0, 0);
s->tone_state = 4;
/* Release the transmit side, and it will time the 250ms post tone delay */
s->clear_to_send = TRUE;
s->clear_to_send = true;
s->tries = 0;
if (s->tx_digits_len)
s->timer = ms_to_samples(3000);
@@ -968,7 +974,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
case 5:
if (hit == 0)
{
s->busy = FALSE;
s->busy = false;
if (s->duration < ms_to_samples(400) || s->duration > ms_to_samples(1500))
{
span_log(&s->logging, SPAN_LOG_FLOW, "Bad kissoff duration %d\n", s->duration);
@@ -982,18 +988,18 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
{
s->timer = 0;
if (s->callback)
s->callback(s->callback_user_data, FALSE, 0, 0);
s->callback(s->callback_user_data, false, 0, 0);
}
}
else
{
span_log(&s->logging, SPAN_LOG_FLOW, "Received good kissoff\n");
s->clear_to_send = TRUE;
s->clear_to_send = true;
s->tx_digits_len = 0;
if (s->callback)
s->callback(s->callback_user_data, TRUE, 0, 0);
s->callback(s->callback_user_data, true, 0, 0);
s->tone_state = 4;
s->clear_to_send = TRUE;
s->clear_to_send = true;
s->tries = 0;
if (s->tx_digits_len)
s->timer = ms_to_samples(3000);
@@ -1023,7 +1029,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
{
s->timer = 0;
if (s->callback)
s->callback(s->callback_user_data, FALSE, 0, 0);
s->callback(s->callback_user_data, false, 0, 0);
}
}
}
@@ -1058,7 +1064,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_put(ademco_contactid_sender_state_t *s
return -1;
if ((s->tx_digits_len = encode_msg(s->tx_digits, report)) < 0)
return -1;
s->busy = TRUE;
s->busy = true;
return dtmf_tx_put(&s->dtmf, s->tx_digits, s->tx_digits_len);
}
/*- End of function --------------------------------------------------------*/
@@ -1084,7 +1090,7 @@ SPAN_DECLARE(ademco_contactid_sender_state_t *) ademco_contactid_sender_init(ade
{
if (s == NULL)
{
if ((s = (ademco_contactid_sender_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (ademco_contactid_sender_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -1095,7 +1101,7 @@ SPAN_DECLARE(ademco_contactid_sender_state_t *) ademco_contactid_sender_init(ade
{
make_goertzel_descriptor(&tone_1400_desc, 1400.0f, GOERTZEL_SAMPLES_PER_BLOCK);
make_goertzel_descriptor(&tone_2300_desc, 2300.0f, GOERTZEL_SAMPLES_PER_BLOCK);
tone_rx_init = TRUE;
tone_rx_init = true;
}
goertzel_init(&s->tone_1400, &tone_1400_desc);
goertzel_init(&s->tone_2300, &tone_2300_desc);
@@ -1121,7 +1127,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_release(ademco_contactid_sender_state_
SPAN_DECLARE(int) ademco_contactid_sender_free(ademco_contactid_sender_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+17 -10
View File
@@ -40,10 +40,16 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
@@ -63,6 +69,7 @@
#include "spandsp/private/queue.h"
#include "spandsp/private/tone_generate.h"
#include "spandsp/private/async.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/dtmf.h"
#include "spandsp/private/adsi.h"
@@ -150,7 +157,7 @@ static int adsi_tx_get_bit(void *user_data)
if (s->tx_signal_on)
{
/* The FSK should now be switched off. */
s->tx_signal_on = FALSE;
s->tx_signal_on = false;
s->msg_len = 0;
}
}
@@ -169,7 +176,7 @@ static int adsi_tdd_get_async_byte(void *user_data)
if (s->tx_signal_on)
{
/* The FSK should now be switched off. */
s->tx_signal_on = FALSE;
s->tx_signal_on = false;
s->msg_len = 0;
}
return 0x1F;
@@ -385,12 +392,12 @@ static void start_tx(adsi_tx_state_t *s)
break;
case ADSI_STANDARD_TDD:
fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_WEITBRECHT_4545], async_tx_get_bit, &s->asynctx);
async_tx_init(&s->asynctx, 5, ASYNC_PARITY_NONE, 2, FALSE, adsi_tdd_get_async_byte, s);
async_tx_init(&s->asynctx, 5, ASYNC_PARITY_NONE, 2, false, adsi_tdd_get_async_byte, s);
/* Schedule an explicit shift at the start of baudot transmission */
s->baudot_shift = 2;
break;
}
s->tx_signal_on = TRUE;
s->tx_signal_on = true;
}
/*- End of function --------------------------------------------------------*/
@@ -426,7 +433,7 @@ SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s,
{
if (s == NULL)
{
if ((s = (adsi_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (adsi_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -465,7 +472,7 @@ SPAN_DECLARE(int) adsi_rx_release(adsi_rx_state_t *s)
SPAN_DECLARE(int) adsi_rx_free(adsi_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -488,7 +495,7 @@ SPAN_DECLARE(int) adsi_tx(adsi_tx_state_t *s, int16_t amp[], int max_len)
if (len < max_len)
{
if ((lenx = fsk_tx(&s->fsktx, amp + len, max_len - len)) <= 0)
s->tx_signal_on = FALSE;
s->tx_signal_on = false;
len += lenx;
}
break;
@@ -658,7 +665,7 @@ SPAN_DECLARE(adsi_tx_state_t *) adsi_tx_init(adsi_tx_state_t *s, int standard)
{
if (s == NULL)
{
if ((s = (adsi_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (adsi_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -671,7 +678,7 @@ SPAN_DECLARE(adsi_tx_state_t *) adsi_tx_init(adsi_tx_state_t *s, int standard)
60,
0,
0,
FALSE);
false);
s->standard = standard;
adsi_tx_set_preamble(s, -1, -1, -1, -1);
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
@@ -688,7 +695,7 @@ SPAN_DECLARE(int) adsi_tx_release(adsi_tx_state_t *s)
SPAN_DECLARE(int) adsi_tx_free(adsi_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+145
View File
@@ -0,0 +1,145 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* alloc.c - memory allocation handling.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2013 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(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <limits.h>
#include <stdio.h>
#include <stdarg.h>
#include <fcntl.h>
#if !defined(__USE_ISOC11)
#define __USE_ISOC11
#endif
#include <stdlib.h>
#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
#include <inttypes.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <sys/time.h>
#include <time.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4232) /* address of dllimport is not static, identity not guaranteed */
#endif
#if defined(HAVE_ALIGNED_ALLOC)
static span_aligned_alloc_t __span_aligned_alloc = aligned_alloc;
#elif defined(HAVE_MEMALIGN)
static span_aligned_alloc_t __span_aligned_alloc = memalign;
#elif defined(HAVE_POSIX_MEMALIGN)
static void *fake_posix_memalign(size_t alignment, size_t size);
static span_aligned_alloc_t __span_aligned_alloc = fake_posix_memalign;
#else
static void *fake_aligned_alloc(size_t alignment, size_t size);
static span_aligned_alloc_t __span_aligned_alloc = fake_aligned_alloc;
#endif
static span_alloc_t __span_alloc = malloc;
static span_realloc_t __span_realloc = realloc;
static span_free_t __span_free = free;
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#if defined(HAVE_ALIGNED_ALLOC)
#elif defined(HAVE_MEMALIGN)
#elif defined(HAVE_POSIX_MEMALIGN)
static void *fake_posix_memalign(size_t alignment, size_t size)
{
void *ptr;
/* Make posix_memalign look like the more modern aligned_alloc */
posix_memalign(&ptr, alignment, size);
return ptr;
}
/*- End of function --------------------------------------------------------*/
#else
static void *fake_aligned_alloc(size_t alignment, size_t size)
{
return malloc(size);
}
/*- End of function --------------------------------------------------------*/
#endif
SPAN_DECLARE(void *) span_aligned_alloc(size_t alignment, size_t size)
{
return __span_aligned_alloc(alignment, size);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void *) span_alloc(size_t size)
{
return __span_alloc(size);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void *) span_realloc(void *ptr, size_t size)
{
return __span_realloc(ptr, size);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) span_free(void *ptr)
{
__span_free(ptr);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) span_mem_allocators(span_aligned_alloc_t custom_aligned_alloc,
span_alloc_t custom_alloc,
span_realloc_t custom_realloc,
span_free_t custom_free)
{
__span_aligned_alloc = (custom_aligned_alloc)
?
custom_aligned_alloc
:
#if defined(HAVE_ALIGNED_ALLOC)
aligned_alloc;
#elif defined(HAVE_MEMALIGN)
memalign;
#elif defined(HAVE_POSIX_MEMALIGN)
fake_posix_memalign;
#else
fake_aligned_alloc;
#endif
__span_alloc = (custom_alloc) ? custom_alloc : malloc;
__span_realloc = (custom_realloc) ? custom_realloc : realloc;
__span_free = (custom_free) ? custom_free : free;
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
+12 -6
View File
@@ -33,8 +33,14 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bit_operations.h"
#include "spandsp/async.h"
@@ -168,13 +174,13 @@ SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s,
int data_bits,
int parity,
int stop_bits,
int use_v14,
bool use_v14,
put_byte_func_t put_byte,
void *user_data)
{
if (s == NULL)
{
if ((s = (async_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (async_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->data_bits = data_bits;
@@ -203,7 +209,7 @@ SPAN_DECLARE(int) async_rx_release(async_rx_state_t *s)
SPAN_DECLARE(int) async_rx_free(async_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -268,13 +274,13 @@ SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s,
int data_bits,
int parity,
int stop_bits,
int use_v14,
bool use_v14,
get_byte_func_t get_byte,
void *user_data)
{
if (s == NULL)
{
if ((s = (async_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (async_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
/* We have a use_v14 parameter for completeness, but right now V.14 only
@@ -304,7 +310,7 @@ SPAN_DECLARE(int) async_tx_release(async_tx_state_t *s)
SPAN_DECLARE(int) async_tx_free(async_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+68 -62
View File
@@ -43,9 +43,15 @@
#include <memory.h>
#include <string.h>
#include <ctype.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
#include "spandsp/power_meter.h"
@@ -77,20 +83,20 @@ static at_profile_t profiles[3] =
{
{
#if defined(_MSC_VER) || defined(__sunos) || defined(__solaris) || defined(__sun)
/*.echo =*/ TRUE,
/*.verbose =*/ TRUE,
/*.echo =*/ true,
/*.verbose =*/ true,
/*.result_code_format =*/ ASCII_RESULT_CODES,
/*.pulse_dial =*/ FALSE,
/*.double_escape =*/ FALSE,
/*.adaptive_receive =*/ FALSE,
/*.pulse_dial =*/ false,
/*.double_escape =*/ false,
/*.adaptive_receive =*/ false,
/*.s_regs[100] =*/ {0, 0, 0, '\r', '\n', '\b', 1, 60, 5, 0, 0}
#else
.echo = TRUE,
.verbose = TRUE,
.echo = true,
.verbose = true,
.result_code_format = ASCII_RESULT_CODES,
.pulse_dial = FALSE,
.double_escape = FALSE,
.adaptive_receive = FALSE,
.pulse_dial = false,
.double_escape = false,
.adaptive_receive = false,
.s_regs[0] = 0,
.s_regs[3] = '\r',
.s_regs[4] = '\n',
@@ -255,11 +261,11 @@ SPAN_DECLARE(void) at_put_response_code(at_state_t *s, int code)
static int answer_call(at_state_t *s)
{
if (at_modem_control(s, AT_MODEM_CONTROL_ANSWER, NULL) < 0)
return FALSE;
return false;
/* Answering should now be in progress. No AT response should be
issued at this point. */
s->do_hangup = FALSE;
return TRUE;
s->do_hangup = false;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -318,7 +324,7 @@ SPAN_DECLARE(void) at_call_event(at_state_t *s, int event)
at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_NOCNG_TONE_TX);
else
at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CNG_TONE_TX);
s->dte_is_waiting = TRUE;
s->dte_is_waiting = true;
}
}
break;
@@ -342,13 +348,13 @@ SPAN_DECLARE(void) at_call_event(at_state_t *s, int event)
if (s->ok_is_pending)
{
at_put_response_code(s, AT_RESPONSE_CODE_OK);
s->ok_is_pending = FALSE;
s->ok_is_pending = false;
}
else
{
at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER);
}
s->dte_is_waiting = FALSE;
s->dte_is_waiting = false;
at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
}
else if (s->fclass_mode && s->rx_signal_present)
@@ -360,7 +366,7 @@ SPAN_DECLARE(void) at_call_event(at_state_t *s, int event)
}
if (s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND && s->at_rx_mode != AT_MODE_ONHOOK_COMMAND)
at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER);
s->rx_signal_present = FALSE;
s->rx_signal_present = false;
at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0);
at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
break;
@@ -379,11 +385,11 @@ SPAN_DECLARE(void) at_reset_call_info(at_state_t *s)
for (call_id = s->call_id; call_id; call_id = next)
{
next = call_id->next;
free(call_id);
span_free(call_id);
}
s->call_id = NULL;
s->rings_indicated = 0;
s->call_info_displayed = FALSE;
s->call_info_displayed = false;
}
/*- End of function --------------------------------------------------------*/
@@ -392,8 +398,8 @@ SPAN_DECLARE(void) at_set_call_info(at_state_t *s, char const *id, char const *v
at_call_id_t *new_call_id;
at_call_id_t *call_id;
/* TODO: We should really not merely ignore a failure to malloc */
if ((new_call_id = (at_call_id_t *) malloc(sizeof(*new_call_id))) == NULL)
/* TODO: We should really not merely ignore a failure to allocate */
if ((new_call_id = (at_call_id_t *) span_alloc(sizeof(*new_call_id))) == NULL)
return;
call_id = s->call_id;
/* If these strdups fail its pretty harmless. We just appear to not
@@ -430,7 +436,7 @@ SPAN_DECLARE(void) at_display_call_info(at_state_t *s)
at_put_response(s, buf);
call_id = call_id->next;
}
s->call_info_displayed = TRUE;
s->call_info_displayed = true;
}
/*- End of function --------------------------------------------------------*/
@@ -525,7 +531,7 @@ static int parse_out(at_state_t *s, const char **t, int *target, int max_value,
default:
/* Set value */
if ((val = parse_num(t, max_value)) < 0)
return FALSE;
return false;
if (target)
*target = val;
break;
@@ -538,9 +544,9 @@ static int parse_out(at_state_t *s, const char **t, int *target, int max_value,
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -564,14 +570,14 @@ static int parse_2_out(at_state_t *s, const char **t, int *target1, int max_valu
default:
/* Set value */
if ((val1 = parse_num(t, max_value1)) < 0)
return FALSE;
return false;
if (target1)
*target1 = val1;
if (**t == ',')
{
(*t)++;
if ((val2 = parse_num(t, max_value2)) < 0)
return FALSE;
return false;
if (target2)
*target2 = val2;
}
@@ -586,9 +592,9 @@ static int parse_2_out(at_state_t *s, const char **t, int *target1, int max_valu
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -621,7 +627,7 @@ static int parse_n_out(at_state_t *s,
for (i = 0; i < entries; i++)
{
if ((val = parse_num(t, max_values[i])) < 0)
return FALSE;
return false;
if (targets[i])
*targets[i] = val;
if (**t != ',')
@@ -644,9 +650,9 @@ static int parse_n_out(at_state_t *s,
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -669,7 +675,7 @@ static int parse_hex_out(at_state_t *s, const char **t, int *target, int max_val
default:
/* Set value */
if ((val = parse_hex_num(t, max_value)) < 0)
return FALSE;
return false;
if (target)
*target = val;
break;
@@ -682,9 +688,9 @@ static int parse_hex_out(at_state_t *s, const char **t, int *target, int max_val
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -709,7 +715,7 @@ static int parse_string_list_out(at_state_t *s, const char **t, int *target, int
default:
/* Set value */
if ((val = match_element(t, def)) < 0)
return FALSE;
return false;
if (target)
*target = val;
break;
@@ -728,9 +734,9 @@ static int parse_string_list_out(at_state_t *s, const char **t, int *target, int
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -752,7 +758,7 @@ static int parse_string_out(at_state_t *s, const char **t, char **target, const
default:
/* Set value */
if (*target)
free(*target);
span_free(*target);
/* If this strdup fails, it should be harmless */
*target = strdup(*t);
break;
@@ -763,11 +769,11 @@ static int parse_string_out(at_state_t *s, const char **t, char **target, const
at_put_response(s, (*target) ? *target : "");
break;
default:
return FALSE;
return false;
}
while (*t)
t++;
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -862,18 +868,18 @@ static int process_class1_cmd(at_state_t *s, const char **t)
val = -1;
if (!parse_out(s, t, &val, 255, NULL, allowed))
return TRUE;
return true;
if (val < 0)
{
/* It was just a query */
return TRUE;
return true;
}
/* All class 1 FAX commands are supposed to give an ERROR response, if the phone
is on-hook. */
if (s->at_rx_mode == AT_MODE_ONHOOK_COMMAND)
return FALSE;
return false;
result = TRUE;
result = true;
if (s->class1_handler)
result = s->class1_handler(s, s->class1_user_data, direction, operation, val);
switch (result)
@@ -881,11 +887,11 @@ static int process_class1_cmd(at_state_t *s, const char **t)
case 0:
/* Inhibit an immediate response. (These commands should not be part of a multi-command entry.) */
*t = (const char *) -1;
return TRUE;
return true;
case -1:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -915,11 +921,11 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
/* V.250 6.3.1 - Dial (abortable) */
at_reset_call_info(s);
s->do_hangup = FALSE;
s->silent_dial = FALSE;
s->command_dial = FALSE;
s->do_hangup = false;
s->silent_dial = false;
s->command_dial = false;
t += 1;
ok = FALSE;
ok = false;
/* There are a numbers of options in a dial command string.
Many are completely irrelevant in this application. */
u = num;
@@ -961,11 +967,11 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
break;
case 'T':
/* V.250 6.3.1.3 Tone dial */
s->p.pulse_dial = FALSE;
s->p.pulse_dial = false;
break;
case 'P':
/* V.250 6.3.1.4 Pulse dial */
s->p.pulse_dial = TRUE;
s->p.pulse_dial = true;
break;
case '!':
/* V.250 6.3.1.5 Hook flash, register recall */
@@ -977,7 +983,7 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
break;
case '@':
/* V.250 6.3.1.7 Wait for quiet answer */
s->silent_dial = TRUE;
s->silent_dial = true;
break;
case 'S':
/* V.250 6.3.1.8 Invoke stored string */
@@ -998,7 +1004,7 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
break;
case ';':
/* V.250 6.3.1 - Dial string terminator - make voice call and remain in command mode */
s->command_dial = TRUE;
s->command_dial = true;
break;
case '>':
/* GSM07.07 6.2 - Direct dialling from phone book supplementary service subscription
@@ -1054,7 +1060,7 @@ static const char *at_cmd_H(at_state_t *s, const char *t)
{
/* Push out the last of the audio (probably by sending a short silence). */
at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_FLUSH);
s->do_hangup = TRUE;
s->do_hangup = true;
at_set_at_rx_mode(s, AT_MODE_CONNECTED);
return (const char *) -1;
}
@@ -1137,7 +1143,7 @@ static const char *at_cmd_P(at_state_t *s, const char *t)
{
/* V.250 6.3.3 - Select pulse dialling (command) */
t += 1;
s->p.pulse_dial = TRUE;
s->p.pulse_dial = true;
return t;
}
/*- End of function --------------------------------------------------------*/
@@ -1231,7 +1237,7 @@ static const char *at_cmd_T(at_state_t *s, const char *t)
{
/* V.250 6.3.2 - Select tone dialling (command) */
t += 1;
s->p.pulse_dial = FALSE;
s->p.pulse_dial = false;
return t;
}
/*- End of function --------------------------------------------------------*/
@@ -5590,7 +5596,7 @@ SPAN_DECLARE(at_state_t *) at_init(at_state_t *s,
{
if (s == NULL)
{
if ((s = (at_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (at_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, '\0', sizeof(*s));
@@ -5615,7 +5621,7 @@ SPAN_DECLARE(int) at_release(at_state_t *s)
{
at_reset_call_info(s);
if (s->local_id)
free(s->local_id);
span_free(s->local_id);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -5625,7 +5631,7 @@ SPAN_DECLARE(int) at_free(at_state_t *s)
int ret;
ret = at_release(s);
free(s);
span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -55,6 +55,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/awgn.h"
@@ -100,7 +101,7 @@ SPAN_DECLARE(awgn_state_t *) awgn_init_dbov(awgn_state_t *s, int idum, float lev
if (s == NULL)
{
if ((s = (awgn_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (awgn_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
if (idum < 0)
@@ -140,7 +141,7 @@ SPAN_DECLARE(int) awgn_release(awgn_state_t *s)
SPAN_DECLARE(int) awgn_free(awgn_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+28 -22
View File
@@ -40,9 +40,15 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/fast_convert.h"
#include "spandsp/queue.h"
@@ -77,10 +83,10 @@ typedef struct
uint8_t off_time; /* Minimum post tone silence (ms) */
} mf_digit_tones_t;
int bell_mf_gen_inited = FALSE;
int bell_mf_gen_inited = false;
tone_gen_descriptor_t bell_mf_digit_tones[15];
int r2_mf_gen_inited = FALSE;
int r2_mf_gen_inited = false;
tone_gen_descriptor_t r2_mf_fwd_digit_tones[15];
tone_gen_descriptor_t r2_mf_back_digit_tones[15];
@@ -270,10 +276,10 @@ static void bell_mf_gen_init(void)
tones->off_time,
0,
0,
FALSE);
false);
tones++;
}
bell_mf_gen_inited = TRUE;
bell_mf_gen_inited = true;
}
/*- End of function --------------------------------------------------------*/
@@ -325,7 +331,7 @@ SPAN_DECLARE(bell_mf_tx_state_t *) bell_mf_tx_init(bell_mf_tx_state_t *s)
{
if (s == NULL)
{
if ((s = (bell_mf_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (bell_mf_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -348,7 +354,7 @@ SPAN_DECLARE(int) bell_mf_tx_release(bell_mf_tx_state_t *s)
SPAN_DECLARE(int) bell_mf_tx_free(bell_mf_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -390,14 +396,14 @@ SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd)
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, bool fwd)
{
int i;
const mf_digit_tones_t *tones;
if (s == NULL)
{
if ((s = (r2_mf_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (r2_mf_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -436,7 +442,7 @@ SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd)
(tones->off_time == 0));
tones++;
}
r2_mf_gen_inited = TRUE;
r2_mf_gen_inited = true;
}
s->fwd = fwd;
return s;
@@ -451,7 +457,7 @@ SPAN_DECLARE(int) r2_mf_tx_release(r2_mf_tx_state_t *s)
SPAN_DECLARE(int) r2_mf_tx_free(r2_mf_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -629,11 +635,11 @@ SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s,
void *user_data)
{
int i;
static int initialised = FALSE;
static int initialised = false;
if (s == NULL)
{
if ((s = (bell_mf_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (bell_mf_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -642,7 +648,7 @@ SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s,
{
for (i = 0; i < 6; i++)
make_goertzel_descriptor(&bell_mf_detect_desc[i], (float) bell_mf_frequencies[i], BELL_MF_SAMPLES_PER_BLOCK);
initialised = TRUE;
initialised = true;
}
s->digits_callback = callback;
s->digits_callback_data = user_data;
@@ -671,7 +677,7 @@ SPAN_DECLARE(int) bell_mf_rx_release(bell_mf_rx_state_t *s)
SPAN_DECLARE(int) bell_mf_rx_free(bell_mf_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -745,7 +751,7 @@ SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples
}
}
/* Basic signal level and twist tests */
hit = FALSE;
hit = false;
if (energy[best] >= R2_MF_THRESHOLD
&&
energy[second_best] >= R2_MF_THRESHOLD
@@ -755,7 +761,7 @@ SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples
energy[best]*R2_MF_TWIST > energy[second_best])
{
/* Relative peak test */
hit = TRUE;
hit = true;
for (i = 0; i < 6; i++)
{
if (i != best && i != second_best)
@@ -763,7 +769,7 @@ SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples
if (energy[i]*R2_MF_RELATIVE_PEAK >= energy[second_best])
{
/* The best two are not clearly the best */
hit = FALSE;
hit = false;
break;
}
}
@@ -804,16 +810,16 @@ SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s)
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
int fwd,
bool fwd,
tone_report_func_t callback,
void *user_data)
{
int i;
static int initialised = FALSE;
static int initialised = false;
if (s == NULL)
{
if ((s = (r2_mf_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (r2_mf_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -827,7 +833,7 @@ SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
make_goertzel_descriptor(&mf_fwd_detect_desc[i], (float) r2_mf_fwd_frequencies[i], R2_MF_SAMPLES_PER_BLOCK);
make_goertzel_descriptor(&mf_back_detect_desc[i], (float) r2_mf_back_frequencies[i], R2_MF_SAMPLES_PER_BLOCK);
}
initialised = TRUE;
initialised = true;
}
if (fwd)
{
@@ -855,7 +861,7 @@ SPAN_DECLARE(int) r2_mf_rx_release(r2_mf_rx_state_t *s)
SPAN_DECLARE(int) r2_mf_rx_free(r2_mf_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+11 -5
View File
@@ -33,8 +33,14 @@
#include <string.h>
#include <assert.h>
#include <time.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/bert.h"
@@ -136,14 +142,14 @@ static void assess_error_rate(bert_state_t *s)
int i;
int j;
int sum;
int test;
bool test;
/* We assess the error rate in decadic steps. For each decade we assess the error over 10 times
the number of bits, to smooth the result. This means we assess the 1 in 100 rate based on 1000 bits
(i.e. we look for >=10 errors in 1000 bits). We make an assessment every 100 bits, using a sliding
window over the last 1000 bits. We assess the 1 in 1000 rate over 10000 bits in a similar way, and
so on for the lower error rates. */
test = TRUE;
test = false;
for (i = 2; i <= 7; i++)
{
if (++s->decade_ptr[i] < 10)
@@ -156,7 +162,7 @@ static void assess_error_rate(bert_state_t *s)
if (test && sum > 10)
{
/* We overflow into the next decade */
test = FALSE;
test = false;
if (s->error_rate != i && s->reporter)
s->reporter(s->user_data, BERT_REPORT_GT_10_2 + i - 2, &s->results);
s->error_rate = i;
@@ -350,7 +356,7 @@ SPAN_DECLARE(bert_state_t *) bert_init(bert_state_t *s, int limit, int pattern,
if (s == NULL)
{
if ((s = (bert_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (bert_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -503,7 +509,7 @@ SPAN_DECLARE(int) bert_release(bert_state_t *s)
SPAN_DECLARE(int) bert_free(bert_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+8 -2
View File
@@ -33,8 +33,14 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bitstream.h"
#include "spandsp/private/bitstream.h"
@@ -132,7 +138,7 @@ SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int lsb_f
{
if (s == NULL)
{
if ((s = (bitstream_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (bitstream_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->bitstream = 0;
@@ -151,7 +157,7 @@ SPAN_DECLARE(int) bitstream_release(bitstream_state_t *s)
SPAN_DECLARE(int) bitstream_free(bitstream_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+7 -6
View File
@@ -32,6 +32,7 @@
#include <inttypes.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/complex.h"
#include "spandsp/complex_filters.h"
@@ -40,7 +41,7 @@ SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs)
int i;
filter_t *fi;
if ((fi = (filter_t *) malloc(sizeof(*fi) + sizeof(float)*(fs->np + 1))))
if ((fi = (filter_t *) span_alloc(sizeof(*fi) + sizeof(float)*(fs->np + 1))))
{
fi->fs = fs;
fi->sum = 0.0;
@@ -56,7 +57,7 @@ SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs)
SPAN_DECLARE(void) filter_delete(filter_t *fi)
{
if (fi)
free(fi);
span_free(fi);
}
/*- End of function --------------------------------------------------------*/
@@ -70,17 +71,17 @@ SPAN_DECLARE(cfilter_t *) cfilter_create(fspec_t *fs)
{
cfilter_t *cfi;
if ((cfi = (cfilter_t *) malloc(sizeof(*cfi))))
if ((cfi = (cfilter_t *) span_alloc(sizeof(*cfi))))
{
if ((cfi->ref = filter_create(fs)) == NULL)
{
free(cfi);
span_free(cfi);
return NULL;
}
if ((cfi->imf = filter_create(fs)) == NULL)
{
free(cfi->ref);
free(cfi);
span_free(cfi->ref);
span_free(cfi);
return NULL;
}
}
+5
View File
@@ -39,6 +39,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include <assert.h>
#include "floating_fudge.h"
+5
View File
@@ -39,6 +39,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include <assert.h>
#include "floating_fudge.h"
+7 -2
View File
@@ -32,6 +32,11 @@
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/crc.h"
@@ -102,7 +107,7 @@ SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len)
SPAN_DECLARE(bool) crc_itu32_check(const uint8_t *buf, int len)
{
uint32_t crc;
int i;
@@ -193,7 +198,7 @@ SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) crc_itu16_check(const uint8_t *buf, int len)
SPAN_DECLARE(bool) crc_itu16_check(const uint8_t *buf, int len)
{
uint16_t crc;
int i;
+19 -13
View File
@@ -31,18 +31,24 @@
#include <stdlib.h>
#include <inttypes.h>
#include <memory.h>
#include <string.h>
#include <limits.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <memory.h>
#include <string.h>
#include <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/fast_convert.h"
#include "spandsp/queue.h"
@@ -93,11 +99,11 @@ static const float dtmf_col[] =
static const char dtmf_positions[] = "123A" "456B" "789C" "*0#D";
static int dtmf_rx_inited = FALSE;
static bool dtmf_rx_inited = false;
static goertzel_descriptor_t dtmf_detect_row[4];
static goertzel_descriptor_t dtmf_detect_col[4];
static int dtmf_tx_inited = FALSE;
static bool dtmf_tx_inited = false;
static tone_gen_descriptor_t dtmf_digit_tones[16];
SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples)
@@ -413,7 +419,7 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
if (s == NULL)
{
if ((s = (dtmf_rx_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (dtmf_rx_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -423,7 +429,7 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
s->digits_callback_data = user_data;
s->realtime_callback = NULL;
s->realtime_callback_data = NULL;
s->filter_dialtone = FALSE;
s->filter_dialtone = false;
s->normal_twist = DTMF_NORMAL_TWIST;
s->reverse_twist = DTMF_REVERSE_TWIST;
s->threshold = DTMF_THRESHOLD;
@@ -438,7 +444,7 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
make_goertzel_descriptor(&dtmf_detect_row[i], dtmf_row[i], DTMF_SAMPLES_PER_BLOCK);
make_goertzel_descriptor(&dtmf_detect_col[i], dtmf_col[i], DTMF_SAMPLES_PER_BLOCK);
}
dtmf_rx_inited = TRUE;
dtmf_rx_inited = true;
}
for (i = 0; i < 4; i++)
{
@@ -466,7 +472,7 @@ SPAN_DECLARE(int) dtmf_rx_release(dtmf_rx_state_t *s)
SPAN_DECLARE(int) dtmf_rx_free(dtmf_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -491,10 +497,10 @@ static void dtmf_tx_initialise(void)
DEFAULT_DTMF_TX_OFF_TIME,
0,
0,
FALSE);
false);
}
}
dtmf_tx_inited = TRUE;
dtmf_tx_inited = true;
}
/*- End of function --------------------------------------------------------*/
@@ -578,7 +584,7 @@ SPAN_DECLARE(dtmf_tx_state_t *) dtmf_tx_init(dtmf_tx_state_t *s,
{
if (s == NULL)
{
if ((s = (dtmf_tx_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (dtmf_tx_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -603,7 +609,7 @@ SPAN_DECLARE(int) dtmf_tx_release(dtmf_tx_state_t *s)
SPAN_DECLARE(int) dtmf_tx_free(dtmf_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+23 -23
View File
@@ -88,11 +88,17 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <string.h>
#include <stdio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/saturated.h"
@@ -105,12 +111,6 @@
#if !defined(NULL)
#define NULL (void *) 0
#endif
#if !defined(FALSE)
#define FALSE 0
#endif
#if !defined(TRUE)
#define TRUE (!FALSE)
#endif
#define NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */
@@ -244,26 +244,26 @@ SPAN_DECLARE(echo_can_state_t *) echo_can_init(int len, int adaption_mode)
int i;
int j;
if ((ec = (echo_can_state_t *) malloc(sizeof(*ec))) == NULL)
if ((ec = (echo_can_state_t *) span_alloc(sizeof(*ec))) == NULL)
return NULL;
memset(ec, 0, sizeof(*ec));
ec->taps = len;
ec->curr_pos = ec->taps - 1;
ec->tap_mask = ec->taps - 1;
if ((ec->fir_taps32 = (int32_t *) malloc(ec->taps*sizeof(int32_t))) == NULL)
if ((ec->fir_taps32 = (int32_t *) span_alloc(ec->taps*sizeof(int32_t))) == NULL)
{
free(ec);
span_free(ec);
return NULL;
}
memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t));
for (i = 0; i < 4; i++)
{
if ((ec->fir_taps16[i] = (int16_t *) malloc(ec->taps*sizeof(int16_t))) == NULL)
if ((ec->fir_taps16[i] = (int16_t *) span_alloc(ec->taps*sizeof(int16_t))) == NULL)
{
for (j = 0; j < i; j++)
free(ec->fir_taps16[j]);
free(ec->fir_taps32);
free(ec);
span_free(ec->fir_taps16[j]);
span_free(ec->fir_taps32);
span_free(ec);
return NULL;
}
memset(ec->fir_taps16[i], 0, ec->taps*sizeof(int16_t));
@@ -274,7 +274,7 @@ SPAN_DECLARE(echo_can_state_t *) echo_can_init(int len, int adaption_mode)
ec->rx_power_threshold = 10000000;
ec->geigel_max = 0;
ec->geigel_lag = 0;
ec->dtd_onset = FALSE;
ec->dtd_onset = false;
ec->tap_set = 0;
ec->tap_rotate_counter = 1600;
ec->cng_level = 1000;
@@ -294,10 +294,10 @@ SPAN_DECLARE(int) echo_can_free(echo_can_state_t *ec)
int i;
fir16_free(&ec->fir_state);
free(ec->fir_taps32);
span_free(ec->fir_taps32);
for (i = 0; i < 4; i++)
free(ec->fir_taps16[i]);
free(ec);
span_free(ec->fir_taps16[i]);
span_free(ec);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -337,7 +337,7 @@ SPAN_DECLARE(void) echo_can_flush(echo_can_state_t *ec)
ec->geigel_max = 0;
ec->geigel_lag = 0;
ec->dtd_onset = FALSE;
ec->dtd_onset = false;
ec->tap_set = 0;
ec->tap_rotate_counter = 1600;
@@ -485,7 +485,7 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
ec->narrowband_score = 0;
}
}
ec->dtd_onset = FALSE;
ec->dtd_onset = false;
if (--ec->tap_rotate_counter <= 0)
{
printf("Rotate to %d at %d\n", ec->tap_set, sample_no);
@@ -532,7 +532,7 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
for (i = 0; i < ec->taps; i++)
ec->fir_taps32[i] = ec->fir_taps16[(ec->tap_set + 1)%3][i] << 15;
ec->tap_rotate_counter = 1600;
ec->dtd_onset = TRUE;
ec->dtd_onset = true;
}
ec->nonupdate_dwell = NONUPDATE_DWELL_TIME;
}
@@ -575,7 +575,7 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
if (!ec->cng)
{
ec->cng_level = ec->clean_rx_power;
ec->cng = TRUE;
ec->cng = true;
}
if ((ec->adaption_mode & ECHO_CAN_USE_CNG))
{
@@ -594,12 +594,12 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
}
else
{
ec->cng = FALSE;
ec->cng = false;
}
}
else
{
ec->cng = FALSE;
ec->cng = false;
}
printf("Narrowband score %4d %5d at %d\n", ec->narrowband_score, score, sample_no);
+19 -12
View File
@@ -40,6 +40,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include <fcntl.h>
@@ -50,6 +55,7 @@
#include <tiffio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
#include "spandsp/dc_restore.h"
@@ -95,6 +101,7 @@
#include "spandsp/private/logging.h"
#include "spandsp/private/silence_gen.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/modem_connect_tones.h"
#include "spandsp/private/v8.h"
@@ -209,7 +216,7 @@ static int set_next_tx_type(fax_state_t *s)
silence_gen_alter(&t->silence_gen, 0);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
t->transmit = FALSE;
t->transmit = false;
return -1;
}
/*- End of function --------------------------------------------------------*/
@@ -276,7 +283,7 @@ static void fax_set_rx_type(void *user_data, int type, int bit_rate, int short_t
t->current_rx_type = type;
t->rx_bit_rate = bit_rate;
if (use_hdlc)
hdlc_rx_init(&t->hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
hdlc_rx_init(&t->hdlc_rx, false, true, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
switch (type)
{
@@ -319,14 +326,14 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
silence_gen_alter(&t->silence_gen, ms_to_samples(short_train));
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_CED:
case T30_MODEM_CNG:
tone = (type == T30_MODEM_CED) ? FAX_MODEM_CED_TONE_TX : FAX_MODEM_CNG_TONE_TX;
fax_modems_start_slow_modem(t, tone);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_V21:
fax_modems_start_slow_modem(t, FAX_MODEM_V21_TX);
@@ -339,7 +346,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &fsk_tx, &t->v21_tx);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_V17:
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
@@ -348,7 +355,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
fax_modems_start_fast_modem(t, FAX_MODEM_V17_TX, bit_rate, short_train, use_hdlc);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v17_tx, &t->fast_modems.v17_tx);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_V27TER:
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
@@ -357,7 +364,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
fax_modems_start_fast_modem(t, FAX_MODEM_V27TER_TX, bit_rate, short_train, use_hdlc);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v27ter_tx, &t->fast_modems.v27ter_tx);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_V29:
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
@@ -366,7 +373,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
fax_modems_start_fast_modem(t, FAX_MODEM_V29_TX, bit_rate, short_train, use_hdlc);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v29_tx, &t->fast_modems.v29_tx);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_DONE:
span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n");
@@ -375,7 +382,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
silence_gen_alter(&t->silence_gen, 0);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
t->transmit = FALSE;
t->transmit = false;
break;
}
t->tx_bit_rate = bit_rate;
@@ -470,14 +477,14 @@ SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party)
if (s == NULL)
{
if ((s = (fax_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (fax_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
span_log_set_protocol(&s->logging, "FAX");
fax_modems_init(&s->modems,
FALSE,
false,
t30_hdlc_accept,
hdlc_underflow_handler,
t30_non_ecm_put_bit,
@@ -525,7 +532,7 @@ SPAN_DECLARE(int) fax_release(fax_state_t *s)
SPAN_DECLARE(int) fax_free(fax_state_t *s)
{
t30_release(&s->t30);
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+18 -11
View File
@@ -39,6 +39,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include <fcntl.h>
@@ -48,6 +53,7 @@
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/dc_restore.h"
@@ -73,6 +79,7 @@
#include "spandsp/private/logging.h"
#include "spandsp/private/silence_gen.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/v17tx.h"
#include "spandsp/private/v17rx.h"
@@ -92,7 +99,7 @@ static void fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len,
s = (fax_modems_state_t *) user_data;
if (ok)
s->rx_frame_received = TRUE;
s->rx_frame_received = false;
if (s->hdlc_accept)
s->hdlc_accept(s->hdlc_accept_user_data, msg, len, ok);
}
@@ -263,7 +270,7 @@ SPAN_DECLARE(void) fax_modems_start_slow_modem(fax_modems_state_t *s, int which)
fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx);
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fsk_rx, &s->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx);
fsk_rx_signal_cutoff(&s->v21_rx, -39.09f);
s->rx_frame_received = FALSE;
s->rx_frame_received = false;
break;
case FAX_MODEM_CED_TONE_RX:
modem_connect_tones_rx_init(&s->connect_rx, MODEM_CONNECT_TONES_FAX_CED, s->tone_callback, s->tone_callback_user_data);
@@ -321,10 +328,10 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
if (s->fast_modem != which)
{
s->current_rx_type = which;
s->short_train = FALSE;
s->short_train = false;
s->fast_modem = which;
if (hdlc_mode)
s->rx_frame_received = FALSE;
s->rx_frame_received = false;
switch (s->fast_modem)
{
case FAX_MODEM_V27TER_RX:
@@ -367,13 +374,13 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
switch (s->fast_modem)
{
case FAX_MODEM_V27TER_RX:
v27ter_rx_restart(&s->fast_modems.v27ter_rx, s->bit_rate, FALSE);
v27ter_rx_restart(&s->fast_modems.v27ter_rx, s->bit_rate, false);
v27ter_rx_set_put_bit(&s->fast_modems.v27ter_rx, put_bit, put_bit_user_data);
v27ter_rx_set_modem_status_handler(&s->fast_modems.v27ter_rx, v27ter_rx_status_handler, s);
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fax_modems_v27ter_v21_rx, s, (span_rx_fillin_handler_t) &fax_modems_v27ter_v21_rx_fillin, s);
break;
case FAX_MODEM_V29_RX:
v29_rx_restart(&s->fast_modems.v29_rx, s->bit_rate, FALSE);
v29_rx_restart(&s->fast_modems.v29_rx, s->bit_rate, false);
v29_rx_set_put_bit(&s->fast_modems.v29_rx, put_bit, put_bit_user_data);
v29_rx_set_modem_status_handler(&s->fast_modems.v29_rx, v29_rx_status_handler, s);
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fax_modems_v29_v21_rx, s, (span_rx_fillin_handler_t) &fax_modems_v29_v21_rx_fillin, s);
@@ -503,7 +510,7 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
{
if (s == NULL)
{
if ((s = (fax_modems_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (fax_modems_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
/*endif*/
@@ -534,15 +541,15 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
s->hdlc_accept = hdlc_accept;
s->hdlc_accept_user_data = user_data;
hdlc_rx_init(&s->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, fax_modems_hdlc_accept, s);
hdlc_tx_init(&s->hdlc_tx, FALSE, 2, FALSE, hdlc_tx_underflow, user_data);
hdlc_rx_init(&s->hdlc_rx, false, false, HDLC_FRAMING_OK_THRESHOLD, fax_modems_hdlc_accept, s);
hdlc_tx_init(&s->hdlc_tx, false, 2, false, hdlc_tx_underflow, user_data);
fax_modems_start_slow_modem(s, FAX_MODEM_V21_RX);
fsk_tx_init(&s->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &s->hdlc_tx);
silence_gen_init(&s->silence_gen, 0);
s->rx_signal_present = FALSE;
s->rx_signal_present = false;
s->rx_handler = (span_rx_handler_t) &span_dummy_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &span_dummy_rx;
s->rx_user_data = NULL;
@@ -562,7 +569,7 @@ SPAN_DECLARE(int) fax_modems_release(fax_modems_state_t *s)
SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s)
{
if (s)
free(s);
span_free(s);
/*endif*/
return 0;
}
+9 -11
View File
@@ -32,29 +32,27 @@
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#include "spandsp/telephony.h"
#include "spandsp/complex.h"
#include "filter_tools.h"
#if !defined(FALSE)
#define FALSE 0
#endif
#if !defined(TRUE)
#define TRUE (!FALSE)
#endif
#define MAXPZ 8192
#define SEQ_LEN 8192
#define MAX_FFT_LEN SEQ_LEN
+13 -6
View File
@@ -38,16 +38,23 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/complex.h"
#include "spandsp/dds.h"
#include "spandsp/power_meter.h"
#include "spandsp/async.h"
#include "spandsp/fsk.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
const fsk_spec_t preset_fsk_specs[] =
@@ -154,7 +161,7 @@ SPAN_DECLARE(int) fsk_tx_restart(fsk_tx_state_t *s, const fsk_spec_t *spec)
s->baud_frac = 0;
s->current_phase_rate = s->phase_rates[1];
s->shutdown = FALSE;
s->shutdown = false;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -166,7 +173,7 @@ SPAN_DECLARE(fsk_tx_state_t *) fsk_tx_init(fsk_tx_state_t *s,
{
if (s == NULL)
{
if ((s = (fsk_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (fsk_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -186,7 +193,7 @@ SPAN_DECLARE(int) fsk_tx_release(fsk_tx_state_t *s)
SPAN_DECLARE(int) fsk_tx_free(fsk_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -213,7 +220,7 @@ SPAN_DECLARE_NONSTD(int) fsk_tx(fsk_tx_state_t *s, int16_t amp[], int len)
s->status_handler(s->status_user_data, SIG_STATUS_END_OF_DATA);
if (s->status_handler)
s->status_handler(s->status_user_data, SIG_STATUS_SHUTDOWN_COMPLETE);
s->shutdown = TRUE;
s->shutdown = true;
break;
}
s->current_phase_rate = s->phase_rates[bit & 1];
@@ -328,7 +335,7 @@ SPAN_DECLARE(fsk_rx_state_t *) fsk_rx_init(fsk_rx_state_t *s,
{
if (s == NULL)
{
if ((s = (fsk_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (fsk_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -348,7 +355,7 @@ SPAN_DECLARE(int) fsk_rx_release(fsk_rx_state_t *s)
SPAN_DECLARE(int) fsk_rx_free(fsk_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -35,6 +35,7 @@
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bit_operations.h"
#include "spandsp/g711.h"
#include "spandsp/private/g711.h"
@@ -171,7 +172,7 @@ SPAN_DECLARE(g711_state_t *) g711_init(g711_state_t *s, int mode)
{
if (s == NULL)
{
if ((s = (g711_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (g711_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->mode = mode;
@@ -187,7 +188,7 @@ SPAN_DECLARE(int) g711_release(g711_state_t *s)
SPAN_DECLARE(int) g711_free(g711_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+16 -10
View File
@@ -38,9 +38,15 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/vector_int.h"
@@ -251,7 +257,7 @@ SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int
{
if (s == NULL)
{
if ((s = (g722_decode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (g722_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -262,11 +268,11 @@ SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int
else
s->bits_per_sample = 8;
if ((options & G722_SAMPLE_RATE_8000))
s->eight_k = TRUE;
s->eight_k = true;
if ((options & G722_PACKED) && s->bits_per_sample != 8)
s->packed = TRUE;
s->packed = true;
else
s->packed = FALSE;
s->packed = false;
s->band[0].det = 32;
s->band[1].det = 8;
return s;
@@ -281,7 +287,7 @@ SPAN_DECLARE(int) g722_decode_release(g722_decode_state_t *s)
SPAN_DECLARE(int) g722_decode_free(g722_decode_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -432,7 +438,7 @@ SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int
{
if (s == NULL)
{
if ((s = (g722_encode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (g722_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -443,11 +449,11 @@ SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int
else
s->bits_per_sample = 8;
if ((options & G722_SAMPLE_RATE_8000))
s->eight_k = TRUE;
s->eight_k = true;
if ((options & G722_PACKED) && s->bits_per_sample != 8)
s->packed = TRUE;
s->packed = true;
else
s->packed = FALSE;
s->packed = false;
s->band[0].det = 32;
s->band[1].det = 8;
return s;
@@ -462,7 +468,7 @@ SPAN_DECLARE(int) g722_encode_release(g722_encode_state_t *s)
SPAN_DECLARE(int) g722_encode_free(g722_encode_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+16 -10
View File
@@ -64,9 +64,15 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bitstream.h"
#include "spandsp/bit_operations.h"
#include "spandsp/g711.h"
@@ -393,7 +399,7 @@ static void update(g726_state_t *s,
int16_t thr;
int16_t pk0;
int i;
int tr;
bool tr;
a2p = 0;
/* Needed in updating predictor poles */
@@ -408,11 +414,11 @@ static void update(g726_state_t *s,
thr = (ylint > 9) ? (31 << 10) : ((32 + ylfrac) << ylint);
dqthr = (thr + (thr >> 1)) >> 1; /* dqthr = 0.75 * thr */
if (!s->td) /* signal supposed voice */
tr = FALSE;
tr = false;
else if (mag <= dqthr) /* supposed data, but small mag */
tr = FALSE; /* treated as voice */
tr = false; /* treated as voice */
else /* signal is data (modem) */
tr = TRUE;
tr = true;
/*
* Quantizer scale factor adaptation.
@@ -563,11 +569,11 @@ static void update(g726_state_t *s,
/* TONE */
if (tr) /* this sample has been treated as data */
s->td = FALSE; /* next one will be treated as voice */
s->td = false; /* next one will be treated as voice */
else if (a2p < -11776) /* small sample-to-sample correlation */
s->td = TRUE; /* signal may be data */
s->td = true; /* signal may be data */
else /* signal is voice */
s->td = FALSE;
s->td = false;
/* Adaptation speed control. */
/* FILTA */
@@ -1002,7 +1008,7 @@ SPAN_DECLARE(g726_state_t *) g726_init(g726_state_t *s, int bit_rate, int ext_co
return NULL;
if (s == NULL)
{
if ((s = (g726_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (g726_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->yl = 34816;
@@ -1024,7 +1030,7 @@ SPAN_DECLARE(g726_state_t *) g726_init(g726_state_t *s, int bit_rate, int ext_co
s->b[i] = 0;
s->dq[i] = 32;
}
s->td = FALSE;
s->td = false;
switch (bit_rate)
{
case 16000:
@@ -1062,7 +1068,7 @@ SPAN_DECLARE(int) g726_release(g726_state_t *s)
SPAN_DECLARE(int) g726_free(g726_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -45,6 +45,7 @@
#include <memory.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/bitstream.h"
#include "spandsp/saturated.h"
@@ -115,7 +116,7 @@ SPAN_DECLARE(gsm0610_state_t *) gsm0610_init(gsm0610_state_t *s, int packing)
{
if (s == NULL)
{
if ((s = (gsm0610_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (gsm0610_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
/*endif*/
}
@@ -136,7 +137,7 @@ SPAN_DECLARE(int) gsm0610_release(gsm0610_state_t *s)
SPAN_DECLARE(int) gsm0610_free(gsm0610_state_t *s)
{
if (s)
free(s);
span_free(s);
/*endif*/
return 0;
}
+1 -1
View File
@@ -59,7 +59,7 @@
static void weighting_filter(int16_t x[40],
const int16_t *e) // signal [-5..0.39.44] IN)
{
#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__) && !(defined(__APPLE_CC__) && __APPLE_CC__ >= 5448)
#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__)
/* Table 4.4 Coefficients of the weighting filter */
/* This must be padded to a multiple of 4 for MMX to work */
static const union
+29 -23
View File
@@ -33,8 +33,14 @@
#include <inttypes.h>
#include <string.h>
#include <stdio.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/async.h"
#include "spandsp/crc.h"
#include "spandsp/bit_operations.h"
@@ -46,7 +52,7 @@ static void report_status_change(hdlc_rx_state_t *s, int status)
if (s->status_handler)
s->status_handler(s->status_user_data, status);
else if (s->frame_handler)
s->frame_handler(s->frame_user_data, NULL, status, TRUE);
s->frame_handler(s->frame_user_data, NULL, status, true);
}
/*- End of function --------------------------------------------------------*/
@@ -62,7 +68,7 @@ static void rx_special_condition(hdlc_rx_state_t *s, int status)
s->len = 0;
s->num_bits = 0;
s->flags_seen = 0;
s->framing_ok_announced = FALSE;
s->framing_ok_announced = false;
/* Fall through */
case SIG_STATUS_TRAINING_IN_PROGRESS:
case SIG_STATUS_TRAINING_FAILED:
@@ -94,7 +100,7 @@ static __inline__ void octet_set_and_count(hdlc_rx_state_t *s)
}
else
{
s->octet_counting_mode = TRUE;
s->octet_counting_mode = true;
s->octet_count = s->octet_count_report_interval;
}
}
@@ -139,7 +145,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
{
/* Hit HDLC flag */
/* A flag clears octet counting */
s->octet_counting_mode = FALSE;
s->octet_counting_mode = false;
if (s->flags_seen >= s->framing_ok_threshold)
{
/* We may have a frame, or we may have back to back flags */
@@ -155,7 +161,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
s->rx_bytes += s->len - s->crc_bytes;
s->len -= s->crc_bytes;
if (s->frame_handler)
s->frame_handler(s->frame_user_data, s->buffer, s->len, TRUE);
s->frame_handler(s->frame_user_data, s->buffer, s->len, true);
}
else
{
@@ -164,7 +170,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
{
s->len -= s->crc_bytes;
if (s->frame_handler)
s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE);
s->frame_handler(s->frame_user_data, s->buffer, s->len, false);
}
}
}
@@ -180,7 +186,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
else
s->len = 0;
if (s->frame_handler)
s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE);
s->frame_handler(s->frame_user_data, s->buffer, s->len, false);
}
s->rx_length_errors++;
}
@@ -205,7 +211,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
if (++s->flags_seen >= s->framing_ok_threshold && !s->framing_ok_announced)
{
report_status_change(s, SIG_STATUS_FRAMING_OK);
s->framing_ok_announced = TRUE;
s->framing_ok_announced = true;
}
}
}
@@ -306,15 +312,15 @@ SPAN_DECLARE(void) hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s,
int crc32,
int report_bad_frames,
bool crc32,
bool report_bad_frames,
int framing_ok_threshold,
hdlc_frame_handler_t handler,
void *user_data)
{
if (s == NULL)
{
if ((s = (hdlc_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (hdlc_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -350,7 +356,7 @@ SPAN_DECLARE(int) hdlc_rx_release(hdlc_rx_state_t *s)
SPAN_DECLARE(int) hdlc_rx_free(hdlc_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -371,7 +377,7 @@ SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t
{
if (len <= 0)
{
s->tx_end = TRUE;
s->tx_end = true;
return 0;
}
if (s->len + len > s->max_frame_len)
@@ -397,7 +403,7 @@ SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t
s->len += len;
else
s->len = len;
s->tx_end = FALSE;
s->tx_end = false;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -412,8 +418,8 @@ SPAN_DECLARE(int) hdlc_tx_flags(hdlc_tx_state_t *s, int len)
s->flag_octets += -len;
else
s->flag_octets = len;
s->report_flag_underflow = TRUE;
s->tx_end = FALSE;
s->report_flag_underflow = true;
s->tx_end = false;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -452,7 +458,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
/* We are in a timed flag section (preamble, inter frame gap, etc.) */
if (--s->flag_octets <= 0 && s->report_flag_underflow)
{
s->report_flag_underflow = FALSE;
s->report_flag_underflow = false;
if (s->len == 0)
{
/* The timed flags have finished, there is nothing else queued to go,
@@ -508,7 +514,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
s->crc = 0xFFFFFFFF;
/* Report the underflow now. If there are timed flags still in progress, loading the
next frame right now will be harmless. */
s->report_flag_underflow = FALSE;
s->report_flag_underflow = false;
if (s->underflow_handler)
s->underflow_handler(s->user_data);
/* Make sure we finish off with at least one flag octet, if the underflow report did not result
@@ -539,7 +545,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
/* Untimed idling on flags */
if (s->tx_end)
{
s->tx_end = FALSE;
s->tx_end = false;
return SIG_STATUS_END_OF_DATA;
}
return s->idle_octet;
@@ -584,15 +590,15 @@ SPAN_DECLARE(void) hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len)
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s,
int crc32,
bool crc32,
int inter_frame_flags,
int progressive,
bool progressive,
hdlc_underflow_handler_t handler,
void *user_data)
{
if (s == NULL)
{
if ((s = (hdlc_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (hdlc_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -624,7 +630,7 @@ SPAN_DECLARE(int) hdlc_tx_release(hdlc_tx_state_t *s)
SPAN_DECLARE(int) hdlc_tx_free(hdlc_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -42,6 +42,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/ima_adpcm.h"
@@ -282,7 +283,7 @@ SPAN_DECLARE(ima_adpcm_state_t *) ima_adpcm_init(ima_adpcm_state_t *s,
{
if (s == NULL)
{
if ((s = (ima_adpcm_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (ima_adpcm_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
/*endif*/
@@ -301,7 +302,7 @@ SPAN_DECLARE(int) ima_adpcm_release(ima_adpcm_state_t *s)
SPAN_DECLARE(int) ima_adpcm_free(ima_adpcm_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+12 -6
View File
@@ -47,11 +47,17 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <tiffio.h>
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/saturated.h"
@@ -712,7 +718,7 @@ SPAN_DECLARE(int) image_translate_restart(image_translate_state_t *s, int input_
{
if (s->raw_pixel_row[i] == NULL)
{
if ((s->raw_pixel_row[i] = (uint8_t *) malloc(raw_row_size)) == NULL)
if ((s->raw_pixel_row[i] = (uint8_t *) span_alloc(raw_row_size)) == NULL)
return -1;
}
memset(s->raw_pixel_row[i], 0, raw_row_size);
@@ -729,7 +735,7 @@ SPAN_DECLARE(int) image_translate_restart(image_translate_state_t *s, int input_
{
if (s->pixel_row[i] == NULL)
{
if ((s->pixel_row[i] = (uint8_t *) malloc(raw_row_size)) == NULL)
if ((s->pixel_row[i] = (uint8_t *) span_alloc(raw_row_size)) == NULL)
return -1;
}
memset(s->pixel_row[i], 0, raw_row_size);
@@ -757,7 +763,7 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta
{
if (s == NULL)
{
if ((s = (image_translate_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (image_translate_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -794,12 +800,12 @@ SPAN_DECLARE(int) image_translate_release(image_translate_state_t *s)
{
if (s->raw_pixel_row[i])
{
free(s->raw_pixel_row[i]);
span_free(s->raw_pixel_row[i]);
s->raw_pixel_row[i] = NULL;
}
if (s->pixel_row[i])
{
free(s->pixel_row[i]);
span_free(s->pixel_row[i]);
s->pixel_row[i] = NULL;
}
}
@@ -812,7 +818,7 @@ SPAN_DECLARE(int) image_translate_free(image_translate_state_t *s)
int res;
res = image_translate_release(s);
free(s);
span_free(s);
return res;
}
/*- End of function --------------------------------------------------------*/
+1
View File
@@ -157,6 +157,7 @@
<ItemGroup>
<ClCompile Include="ademco_contactid.c" />
<ClCompile Include="adsi.c" />
<ClCompile Include="alloc.c" />
<ClCompile Include="async.c" />
<ClCompile Include="at_interpreter.c" />
<ClCompile Include="awgn.c" />
@@ -283,6 +283,9 @@
<ClCompile Include="math_fixed.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="alloc.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="spandsp\adsi.h">
+1
View File
@@ -161,6 +161,7 @@
<ItemGroup>
<ClCompile Include="ademco_contactid.c" />
<ClCompile Include="adsi.c" />
<ClCompile Include="alloc.c" />
<ClCompile Include="async.c" />
<ClCompile Include="at_interpreter.c" />
<ClCompile Include="awgn.c" />
@@ -283,6 +283,9 @@
<ClCompile Include="math_fixed.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="alloc.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="spandsp\adsi.h">
+11 -5
View File
@@ -40,8 +40,14 @@
#include <signal.h>
#include <sys/time.h>
#include <time.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/private/logging.h"
@@ -73,11 +79,11 @@ static void default_message_handler(void *user_data, int level, const char *text
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) span_log_test(logging_state_t *s, int level)
SPAN_DECLARE(bool) span_log_test(logging_state_t *s, int level)
{
if (s && (s->level & SPAN_LOG_SEVERITY_MASK) >= (level & SPAN_LOG_SEVERITY_MASK))
return TRUE;
return FALSE;
return true;
return false;
}
/*- End of function --------------------------------------------------------*/
@@ -229,7 +235,7 @@ SPAN_DECLARE(logging_state_t *) span_log_init(logging_state_t *s, int level, con
{
if (s == NULL)
{
if ((s = (logging_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (logging_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->span_message = __span_message;
@@ -252,7 +258,7 @@ SPAN_DECLARE(int) span_log_release(logging_state_t *s)
SPAN_DECLARE(int) span_log_free(logging_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+7 -2
View File
@@ -41,6 +41,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
@@ -349,7 +354,7 @@ static void onset(lpc10_encode_state_t *s,
osbuf[*osptr - 1] = i - 9;
(*osptr)++;
}
s->hyst = TRUE;
s->hyst = true;
}
s->lasti = i;
/* After one onset detection, at least OSHYST sample times must go */
@@ -357,7 +362,7 @@ static void onset(lpc10_encode_state_t *s,
}
else if (s->hyst && i - s->lasti >= 10)
{
s->hyst = FALSE;
s->hyst = false;
}
}
}
+14 -8
View File
@@ -34,16 +34,22 @@
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <memory.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <memory.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/lpc10.h"
#include "spandsp/private/lpc10.h"
@@ -279,7 +285,7 @@ static int pitsyn(lpc10_decode_state_t *s,
ipiti[i] = *pitch;
rmsi[i] = *rms;
}
s->first_pitsyn = FALSE;
s->first_pitsyn = false;
}
else
{
@@ -406,7 +412,7 @@ static int pitsyn(lpc10_decode_state_t *s,
/* NOUT | -- -- -- -- ?? ?? */
/* IVOICE | -- -- -- -- 0 0 */
/* UVPIT is always 0.0 on the first pass through the DO WHILE (TRUE)
/* UVPIT is always 0.0 on the first pass through the DO WHILE (true)
loop below. */
/* The only possible non-0 value of SLOPE (in column 111) is
@@ -857,7 +863,7 @@ static void decode(lpc10_decode_state_t *s,
/* Skip decoding on first frame because present data not yet available */
if (s->first)
{
s->first = FALSE;
s->first = false;
/* Assign PITCH a "default" value on the first call, since */
/* otherwise it would be left uninitialized. The two lines */
/* below were copied from above, since it seemed like a */
@@ -1016,7 +1022,7 @@ SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s,
if (s == NULL)
{
if ((s = (lpc10_decode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (lpc10_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
@@ -1024,7 +1030,7 @@ SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s,
/* State used by function decode */
s->iptold = 60;
s->first = TRUE;
s->first = true;
s->ivp2h = 0;
s->iovoic = 0;
s->iavgp = 60;
@@ -1044,7 +1050,7 @@ SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s,
/* State used by function pitsyn */
s->rmso = 1.0f;
s->first_pitsyn = TRUE;
s->first_pitsyn = true;
/* State used by function bsynz */
s->ipo = 0;
@@ -1084,7 +1090,7 @@ SPAN_DECLARE(int) lpc10_decode_release(lpc10_decode_state_t *s)
SPAN_DECLARE(int) lpc10_decode_free(lpc10_decode_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+9 -3
View File
@@ -41,9 +41,15 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/lpc10.h"
#include "spandsp/private/lpc10.h"
@@ -269,7 +275,7 @@ SPAN_DECLARE(lpc10_encode_state_t *) lpc10_encode_init(lpc10_encode_state_t *s,
if (s == NULL)
{
if ((s = (lpc10_encode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (lpc10_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
@@ -321,7 +327,7 @@ SPAN_DECLARE(lpc10_encode_state_t *) lpc10_encode_init(lpc10_encode_state_t *s,
s->l2sum1 = 0.0f;
s->l2ptr1 = 1;
s->l2ptr2 = 9;
s->hyst = FALSE;
s->hyst = false;
/* State used by function lpc10_voicing */
s->dither = 20.0f;
@@ -367,7 +373,7 @@ SPAN_DECLARE(int) lpc10_encode_release(lpc10_encode_state_t *s)
SPAN_DECLARE(int) lpc10_encode_free(lpc10_encode_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+11 -6
View File
@@ -41,6 +41,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
@@ -67,7 +72,7 @@ void lpc10_placea(int32_t *ipitch,
int32_t k;
int32_t l;
int32_t hrange;
int ephase;
bool ephase;
int32_t lrange;
lrange = (af - 2)*lframe + 1;
@@ -148,14 +153,14 @@ void lpc10_placea(int32_t *ipitch,
awin[af - 1][1] += *ipitch;
}
/* Make energy window be phase-synchronous. */
ephase = TRUE;
ephase = true;
}
else
{
/* Case 3 */
awin[af - 1][0] = vwin[af - 1][0];
awin[af - 1][1] = vwin[af - 1][1];
ephase = FALSE;
ephase = false;
}
/* RMS is computed over an integer number of pitch periods in the analysis
window. When it is not placed phase-synchronously, it is placed as close
@@ -193,7 +198,7 @@ void lpc10_placev(int32_t *osbuf,
{
int32_t i1;
int32_t i2;
int crit;
bool crit;
int32_t q;
int32_t osptr1;
int32_t hrange;
@@ -286,12 +291,12 @@ void lpc10_placev(int32_t *osbuf,
q++;
/* Check for case 2 (placement before onset): */
/* Check for critical region exception: */
crit = FALSE;
crit = false;
for (i = q + 1; i < osptr1; i++)
{
if (osbuf[i - 1] - osbuf[q - 1] >= minwin)
{
crit = TRUE;
crit = true;
break;
}
}
+5
View File
@@ -41,6 +41,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+14 -16
View File
@@ -31,17 +31,22 @@
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#if defined(__sunos) || defined(__solaris) || defined(__sun)
#include <getopt.h>
#endif
@@ -50,13 +55,6 @@
#include "spandsp/complex.h"
#include "filter_tools.h"
#if !defined(FALSE)
#define FALSE 0
#endif
#if !defined(TRUE)
#define TRUE (!FALSE)
#endif
//#define SAMPLE_RATE 8000.0
#define MAX_COEFFS_PER_FILTER 128
#define MAX_COEFF_SETS 384
@@ -84,7 +82,7 @@ static void make_tx_filter(int coeff_sets,
alpha = baud_rate/(2.0*(double) (coeff_sets*baud_rate));
beta = excess_bandwidth;
compute_raised_cosine_filter(coeffs, total_coeffs, TRUE, FALSE, alpha, beta);
compute_raised_cosine_filter(coeffs, total_coeffs, true, false, alpha, beta);
/* Find the DC gain of the filter, and adjust the filter to unity gain. */
floating_gain = 0.0;
@@ -180,7 +178,7 @@ static void make_rx_filter(int coeff_sets,
beta = excess_bandwidth;
carrier *= 2.0*3.1415926535/SAMPLE_RATE;
compute_raised_cosine_filter(coeffs, total_coeffs, TRUE, FALSE, alpha, beta);
compute_raised_cosine_filter(coeffs, total_coeffs, true, false, alpha, beta);
/* Find the DC gain of the filter, and adjust the filter to unity gain. */
floating_gain = 0.0;
@@ -284,7 +282,7 @@ int main(int argc, char **argv)
const char *tx_tag;
const char *modem;
transmit_modem = FALSE;
transmit_modem = false;
modem = "";
while ((opt = getopt(argc, argv, "m:rt")) != -1)
{
@@ -294,10 +292,10 @@ int main(int argc, char **argv)
modem = optarg;
break;
case 'r':
transmit_modem = FALSE;
transmit_modem = false;
break;
case 't':
transmit_modem = TRUE;
transmit_modem = true;
break;
default:
usage();
+22 -15
View File
@@ -53,10 +53,16 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <stdio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/complex.h"
@@ -69,6 +75,7 @@
#include "spandsp/fsk.h"
#include "spandsp/modem_connect_tones.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/modem_connect_tones.h"
@@ -255,12 +262,12 @@ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem
{
int alloced;
alloced = FALSE;
alloced = false;
if (s == NULL)
{
if ((s = (modem_connect_tones_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (modem_connect_tones_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
alloced = TRUE;
alloced = true;
}
s->tone_type = tone_type;
switch (s->tone_type)
@@ -341,7 +348,7 @@ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem
break;
default:
if (alloced)
free(s);
span_free(s);
return NULL;
}
return s;
@@ -356,7 +363,7 @@ SPAN_DECLARE(int) modem_connect_tones_tx_release(modem_connect_tones_tx_state_t
SPAN_DECLARE(int) modem_connect_tones_tx_free(modem_connect_tones_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -398,7 +405,7 @@ static void v21_put_bit(void *user_data, int bit)
s->raw_bit_stream = 0;
s->num_bits = 0;
s->flags_seen = 0;
s->framing_ok_announced = FALSE;
s->framing_ok_announced = false;
break;
}
return;
@@ -429,7 +436,7 @@ static void v21_put_bit(void *user_data, int bit)
if (++s->flags_seen >= HDLC_FRAMING_OK_THRESHOLD && !s->framing_ok_announced)
{
report_tone_state(s, MODEM_CONNECT_TONES_FAX_PREAMBLE, lfastrintf(fsk_rx_signal_power(&(s->v21rx))));
s->framing_ok_announced = TRUE;
s->framing_ok_announced = true;
}
}
}
@@ -441,7 +448,7 @@ static void v21_put_bit(void *user_data, int bit)
{
if (s->num_bits == 8)
{
s->framing_ok_announced = FALSE;
s->framing_ok_announced = false;
s->flags_seen = 0;
}
}
@@ -547,7 +554,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
report_tone_state(s, MODEM_CONNECT_TONES_NONE, -99);
s->tone_cycle_duration = 0;
s->good_cycles = 0;
s->tone_on = FALSE;
s->tone_on = false;
continue;
}
/* There is adequate energy in the channel. Is it mostly at 2100Hz? */
@@ -589,7 +596,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
s->tone_cycle_duration = ms_to_samples(450 + 100);
}
}
s->tone_on = TRUE;
s->tone_on = true;
}
else if (s->notch_level*5 > s->channel_level)
{
@@ -608,7 +615,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
s->good_cycles = 0;
}
}
s->tone_on = FALSE;
s->tone_on = false;
}
}
break;
@@ -716,7 +723,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
{
if (s == NULL)
{
if ((s = (modem_connect_tones_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (modem_connect_tones_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
@@ -742,7 +749,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
s->tone_cycle_duration = 0;
s->good_cycles = 0;
s->hit = MODEM_CONNECT_TONES_NONE;
s->tone_on = FALSE;
s->tone_on = false;
s->tone_callback = tone_callback;
s->callback_data = user_data;
s->znotch_1 = 0.0f;
@@ -751,7 +758,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
s->z15hz_2 = 0.0f;
s->num_bits = 0;
s->flags_seen = 0;
s->framing_ok_announced = FALSE;
s->framing_ok_announced = false;
s->raw_bit_stream = 0;
return s;
}
@@ -765,7 +772,7 @@ SPAN_DECLARE(int) modem_connect_tones_rx_release(modem_connect_tones_rx_state_t
SPAN_DECLARE(int) modem_connect_tones_rx_free(modem_connect_tones_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+13 -12
View File
@@ -47,6 +47,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bit_operations.h"
#include "spandsp/dc_restore.h"
#include "spandsp/modem_echo.h"
@@ -56,9 +57,9 @@
SPAN_DECLARE(void) modem_echo_can_free(modem_echo_can_state_t *ec)
{
fir16_free(&ec->fir_state);
free(ec->fir_taps32);
free(ec->fir_taps16);
free(ec);
span_free(ec->fir_taps32);
span_free(ec->fir_taps16);
span_free(ec);
}
/*- End of function --------------------------------------------------------*/
@@ -66,29 +67,29 @@ SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_init(int len)
{
modem_echo_can_state_t *ec;
if ((ec = (modem_echo_can_state_t *) malloc(sizeof(*ec))) == NULL)
if ((ec = (modem_echo_can_state_t *) span_alloc(sizeof(*ec))) == NULL)
return NULL;
memset(ec, 0, sizeof(*ec));
ec->taps = len;
ec->curr_pos = ec->taps - 1;
if ((ec->fir_taps32 = (int32_t *) malloc(ec->taps*sizeof(int32_t))) == NULL)
if ((ec->fir_taps32 = (int32_t *) span_alloc(ec->taps*sizeof(int32_t))) == NULL)
{
free(ec);
span_free(ec);
return NULL;
}
memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t));
if ((ec->fir_taps16 = (int16_t *) malloc(ec->taps*sizeof(int16_t))) == NULL)
if ((ec->fir_taps16 = (int16_t *) span_alloc(ec->taps*sizeof(int16_t))) == NULL)
{
free(ec->fir_taps32);
free(ec);
span_free(ec->fir_taps32);
span_free(ec);
return NULL;
}
memset(ec->fir_taps16, 0, ec->taps*sizeof(int16_t));
if (fir16_create(&ec->fir_state, ec->fir_taps16, ec->taps) == NULL)
{
free(ec->fir_taps16);
free(ec->fir_taps32);
free(ec);
span_free(ec->fir_taps16);
span_free(ec->fir_taps32);
span_free(ec);
return NULL;
}
return ec;
+3 -2
View File
@@ -43,6 +43,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/noise.h"
@@ -84,7 +85,7 @@ SPAN_DECLARE(noise_state_t *) noise_init_dbov(noise_state_t *s, int seed, float
if (s == NULL)
{
if ((s = (noise_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (noise_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -121,7 +122,7 @@ SPAN_DECLARE(int) noise_release(noise_state_t *s)
SPAN_DECLARE(int) noise_free(noise_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -39,6 +39,7 @@
#include <string.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/oki_adpcm.h"
#include "spandsp/private/oki_adpcm.h"
@@ -246,7 +247,7 @@ SPAN_DECLARE(oki_adpcm_state_t *) oki_adpcm_init(oki_adpcm_state_t *s, int bit_r
return NULL;
if (s == NULL)
{
if ((s = (oki_adpcm_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (oki_adpcm_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -264,7 +265,7 @@ SPAN_DECLARE(int) oki_adpcm_release(oki_adpcm_state_t *s)
SPAN_DECLARE(int) oki_adpcm_free(oki_adpcm_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+17 -9
View File
@@ -39,10 +39,18 @@
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/playout.h"
#include "spandsp/private/playout.h"
static playout_frame_t *queue_get(playout_state_t *s, timestamp_t sender_stamp)
{
playout_frame_t *frame;
@@ -120,7 +128,7 @@ SPAN_DECLARE(int) playout_get(playout_state_t *s, playout_frame_t *frameout, tim
if (!s->not_first)
{
/* Prime things the first time through */
s->not_first = TRUE;
s->not_first = true;
s->latest_expected = frame->receiver_stamp + s->min_length;
}
/* Leaky integrate the rate of occurance of frames received just in time and late */
@@ -236,7 +244,7 @@ SPAN_DECLARE(int) playout_put(playout_state_t *s, void *data, int type, timestam
}
else
{
if ((frame = (playout_frame_t *) malloc(sizeof(*frame))) == NULL)
if ((frame = (playout_frame_t *) span_alloc(sizeof(*frame))) == NULL)
return PLAYOUT_ERROR;
}
@@ -296,7 +304,7 @@ SPAN_DECLARE(int) playout_put(playout_state_t *s, void *data, int type, timestam
{
s->last_speech_sender_stamp = sender_stamp - sender_len - s->min_length;
s->last_speech_sender_len = sender_len;
s->start = FALSE;
s->start = false;
}
return PLAYOUT_OK;
@@ -312,7 +320,7 @@ SPAN_DECLARE(void) playout_restart(playout_state_t *s, int min_length, int max_l
for (frame = s->free_frames; frame; frame = next)
{
next = frame->later;
free(frame);
span_free(frame);
}
memset(s, 0, sizeof(*s));
@@ -320,7 +328,7 @@ SPAN_DECLARE(void) playout_restart(playout_state_t *s, int min_length, int max_l
s->min_length = min_length;
s->max_length = (max_length > min_length) ? max_length : min_length;
s->dropable_threshold = 1*0x10000000/100;
s->start = TRUE;
s->start = true;
s->since_last_step = 0x7FFFFFFF;
/* Start with the minimum buffer length allowed, and work from there */
s->actual_buffer_length =
@@ -332,7 +340,7 @@ SPAN_DECLARE(playout_state_t *) playout_init(int min_length, int max_length)
{
playout_state_t *s;
if ((s = (playout_state_t *) malloc(sizeof(playout_state_t))) == NULL)
if ((s = (playout_state_t *) span_alloc(sizeof(playout_state_t))) == NULL)
return NULL;
memset(s, 0, sizeof(*s));
playout_restart(s, min_length, max_length);
@@ -350,13 +358,13 @@ SPAN_DECLARE(int) playout_release(playout_state_t *s)
for (frame = s->first_frame; frame; frame = next)
{
next = frame->later;
free(frame);
span_free(frame);
}
/* Free all the frames on the free list */
for (frame = s->free_frames; frame; frame = next)
{
next = frame->later;
free(frame);
span_free(frame);
}
return 0;
}
@@ -368,7 +376,7 @@ SPAN_DECLARE(int) playout_free(playout_state_t *s)
{
playout_release(s);
/* Finally, free ourselves! */
free(s);
span_free(s);
}
return 0;
}
+5 -2
View File
@@ -43,10 +43,13 @@
#include <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/plc.h"
#include "spandsp/private/plc.h"
/* We do a straight line fade to zero volume in 50ms when we are filling in for missing data. */
#define ATTENUATION_INCREMENT 0.0025f /* Attenuation per sample */
@@ -234,7 +237,7 @@ SPAN_DECLARE(plc_state_t *) plc_init(plc_state_t *s)
{
if (s == NULL)
{
if ((s = (plc_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (plc_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -251,7 +254,7 @@ SPAN_DECLARE(int) plc_release(plc_state_t *s)
SPAN_DECLARE(int) plc_free(plc_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+14 -6
View File
@@ -41,17 +41,25 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/power_meter.h"
#include "spandsp/private/power_meter.h"
SPAN_DECLARE(power_meter_t *) power_meter_init(power_meter_t *s, int shift)
{
if (s == NULL)
{
if ((s = (power_meter_t *) malloc(sizeof(*s))) == NULL)
if ((s = (power_meter_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->shift = shift;
@@ -69,7 +77,7 @@ SPAN_DECLARE(int) power_meter_release(power_meter_t *s)
SPAN_DECLARE(int) power_meter_free(power_meter_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -147,14 +155,14 @@ SPAN_DECLARE(int32_t) power_surge_detector(power_surge_detector_state_t *s, int1
{
if (pow_short <= s->surge*(pow_medium >> 10))
return 0;
s->signal_present = TRUE;
s->signal_present = true;
s->medium_term.reading = s->short_term.reading;
}
else
{
if (pow_short < s->sag*(pow_medium >> 10))
{
s->signal_present = FALSE;
s->signal_present = false;
s->medium_term.reading = s->short_term.reading;
return 0;
}
@@ -181,7 +189,7 @@ SPAN_DECLARE(power_surge_detector_state_t *) power_surge_detector_init(power_sur
if (s == NULL)
{
if ((s = (power_surge_detector_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (power_surge_detector_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -205,7 +213,7 @@ SPAN_DECLARE(int) power_surge_detector_release(power_surge_detector_state_t *s)
SPAN_DECLARE(int) power_surge_detector_free(power_surge_detector_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+12 -3
View File
@@ -35,15 +35,24 @@
#include <ctype.h>
#include <stdlib.h>
#include <inttypes.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#if defined(HAVE_STDATOMIC_H)
#include <stdatomic.h>
#endif
#include <sys/types.h>
#define SPANDSP_FULLY_DEFINE_QUEUE_STATE_T
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/queue.h"
#include "spandsp/private/queue.h"
SPAN_DECLARE(int) queue_empty(queue_state_t *s)
SPAN_DECLARE(bool) queue_empty(queue_state_t *s)
{
return (s->iptr == s->optr);
}
@@ -395,7 +404,7 @@ SPAN_DECLARE(queue_state_t *) queue_init(queue_state_t *s, int len, int flags)
{
if (s == NULL)
{
if ((s = (queue_state_t *) malloc(sizeof(*s) + len + 1)) == NULL)
if ((s = (queue_state_t *) span_alloc(sizeof(*s) + len + 1)) == NULL)
return NULL;
}
s->iptr =
@@ -414,7 +423,7 @@ SPAN_DECLARE(int) queue_release(queue_state_t *s)
SPAN_DECLARE(int) queue_free(queue_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+9 -3
View File
@@ -31,8 +31,14 @@
#include <inttypes.h>
#include <stdlib.h>
#include <memory.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/schedule.h"
@@ -53,7 +59,7 @@ SPAN_DECLARE(int) span_schedule_event(span_sched_state_t *s, int us, span_sched_
if (i >= s->allocated)
{
s->allocated += 5;
s->sched = (span_sched_t *) realloc(s->sched, sizeof(span_sched_t)*s->allocated);
s->sched = (span_sched_t *) span_realloc(s->sched, sizeof(span_sched_t)*s->allocated);
}
/*endif*/
if (i >= s->max_to_date)
@@ -141,7 +147,7 @@ SPAN_DECLARE(int) span_schedule_release(span_sched_state_t *s)
{
if (s->sched)
{
free(s->sched);
span_free(s->sched);
s->sched = NULL;
}
return 0;
@@ -152,7 +158,7 @@ SPAN_DECLARE(int) span_schedule_free(span_sched_state_t *s)
{
span_schedule_release(s);
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+17 -10
View File
@@ -38,12 +38,18 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <memory.h>
#include <string.h>
#include <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/vector_int.h"
@@ -53,6 +59,7 @@
#include "spandsp/super_tone_rx.h"
#include "spandsp/sig_tone.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/sig_tone.h"
/*! PI */
@@ -225,7 +232,7 @@ SPAN_DECLARE(int) sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len)
int k;
int n;
int16_t tone;
int need_update;
bool need_update;
int high_low;
for (i = 0; i < len; i += n)
@@ -235,19 +242,19 @@ SPAN_DECLARE(int) sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len)
if (s->current_tx_timeout <= len - i)
{
n = s->current_tx_timeout;
need_update = TRUE;
need_update = true;
}
else
{
n = len - i;
need_update = FALSE;
need_update = false;
}
s->current_tx_timeout -= n;
}
else
{
n = len - i;
need_update = FALSE;
need_update = false;
}
if (!(s->current_tx_tone & SIG_TONE_TX_PASSTHROUGH))
vec_zeroi16(&amp[i], n);
@@ -325,7 +332,7 @@ SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int
if (s == NULL)
{
if ((s = (sig_tone_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (sig_tone_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -357,7 +364,7 @@ SPAN_DECLARE(int) sig_tone_tx_release(sig_tone_tx_state_t *s)
SPAN_DECLARE(int) sig_tone_tx_free(sig_tone_tx_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -448,13 +455,13 @@ SPAN_DECLARE(int) sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len)
if ((s->signalling_state & (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT)))
{
if (s->flat_mode_timeout && --s->flat_mode_timeout == 0)
s->flat_mode = TRUE;
s->flat_mode = true;
/*endif*/
}
else
{
s->flat_mode_timeout = s->desc->sharp_flat_timeout;
s->flat_mode = FALSE;
s->flat_mode = false;
}
/*endif*/
@@ -641,7 +648,7 @@ SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int
if (s == NULL)
{
if ((s = (sig_tone_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (sig_tone_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -685,7 +692,7 @@ SPAN_DECLARE(int) sig_tone_rx_release(sig_tone_rx_state_t *s)
SPAN_DECLARE(int) sig_tone_rx_free(sig_tone_rx_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+8 -2
View File
@@ -40,11 +40,17 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/silence_gen.h"
@@ -119,7 +125,7 @@ SPAN_DECLARE(silence_gen_state_t *) silence_gen_init(silence_gen_state_t *s, int
{
if (s == NULL)
{
if ((s = (silence_gen_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (silence_gen_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -137,7 +143,7 @@ SPAN_DECLARE(int) silence_gen_release(silence_gen_state_t *s)
SPAN_DECLARE(int) silence_gen_free(silence_gen_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+2
View File
@@ -45,9 +45,11 @@
#include <limits.h>
#include <time.h>
@INSERT_MATH_HEADER@
@INSERT_STDBOOL_HEADER@
#include <tiffio.h>
#include <spandsp/telephony.h>
#include <spandsp/alloc.h>
#include <spandsp/fast_convert.h>
#include <spandsp/logging.h>
#include <spandsp/complex.h>
+63
View File
@@ -0,0 +1,63 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* alloc.h - memory allocation handling.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2013 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_ALLOC_H_)
#define _SPANDSP_ALLOC_H_
typedef void *(*span_aligned_alloc_t)(size_t alignment, size_t size);
typedef void *(*span_alloc_t)(size_t size);
typedef void *(*span_realloc_t)(void *ptr, size_t size);
typedef void (*span_free_t)(void *ptr);
#if defined(__cplusplus)
extern "C"
{
#endif
/* Allocate size bytes allocated to ALIGNMENT bytes. */
SPAN_DECLARE(void *) span_aligned_alloc(size_t alignment, size_t size);
/* Allocate size bytes of memory. */
SPAN_DECLARE(void *) span_alloc(size_t size);
/* Re-allocate the previously allocated block in ptr, making the new block size bytes long. */
SPAN_DECLARE(void *) span_realloc(void *ptr, size_t size);
/* Free a block allocated by span_alloc, span_aligned_alloc, or span_realloc. */
SPAN_DECLARE(void) span_free(void *ptr);
SPAN_DECLARE(int) span_mem_allocators(span_aligned_alloc_t custom_aligned_alloc,
span_alloc_t custom_alloc,
span_realloc_t custom_realloc,
span_free_t custom_free);
#if defined(__cplusplus)
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/
+4 -4
View File
@@ -164,7 +164,7 @@ SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data, int bit);
\param data_bits The number of data bits.
\param parity_bits The type of parity.
\param stop_bits The number of stop bits.
\param use_v14 TRUE if V.14 rate adaption processing should be used.
\param use_v14 True if V.14 rate adaption processing should be used.
\param put_byte The callback routine used to put the received data.
\param user_data An opaque pointer.
\return A pointer to the initialised context, or NULL if there was a problem. */
@@ -172,7 +172,7 @@ SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s,
int data_bits,
int parity_bits,
int stop_bits,
int use_v14,
bool use_v14,
put_byte_func_t put_byte,
void *user_data);
@@ -198,7 +198,7 @@ SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data);
\param data_bits The number of data bit.
\param parity_bits The type of parity.
\param stop_bits The number of stop bits.
\param use_v14 TRUE if V.14 rate adaption processing should be used.
\param use_v14 True if V.14 rate adaption processing should be used.
\param get_byte The callback routine used to get the data to be transmitted.
\param user_data An opaque pointer.
\return A pointer to the initialised context, or NULL if there was a problem. */
@@ -206,7 +206,7 @@ SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s,
int data_bits,
int parity_bits,
int stop_bits,
int use_v14,
bool use_v14,
get_byte_func_t get_byte,
void *user_data);
+7 -7
View File
@@ -115,14 +115,14 @@ enum
*/
typedef struct
{
/*! TRUE if character echo is enabled */
int echo;
/*! TRUE if verbose reporting is enabled */
int verbose;
/*! TRUE if result codes are verbose */
/*! True if character echo is enabled */
bool echo;
/*! True if verbose reporting is enabled */
bool verbose;
/*! Result code format code - numeic or verbose */
int result_code_format;
/*! TRUE if pulse dialling is the default */
int pulse_dial;
/*! True if pulse dialling is the default */
bool pulse_dial;
/*! ??? */
int double_escape;
/*! ??? */
+4 -4
View File
@@ -175,10 +175,10 @@ SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit);
/*! \brief Initialise an R2 MF tone generator context.
\param s The R2 MF generator context.
\param fwd TRUE if the context is for forward signals. FALSE if the
\param fwd True if the context is for forward signals. False if the
context is for backward signals.
\return A pointer to the MFC/R2 generator context.*/
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd);
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, bool fwd);
/*! \brief Release an R2 MF tone generator context.
\param s The R2 MF tone generator context.
@@ -242,7 +242,7 @@ SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s);
/*! \brief Initialise an R2 MF receiver context.
\param s The R2 MF receiver context.
\param fwd TRUE if the context is for forward signals. FALSE if the
\param fwd True if the context is for forward signals. False if the
context is for backward signals.
\param callback An optional callback routine, used to report received digits. If
no callback routine is set, digits may be collected, using the r2_mf_rx_get()
@@ -251,7 +251,7 @@ SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s);
and supplied in callbacks.
\return A pointer to the R2 MF receiver context. */
SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
int fwd,
bool fwd,
tone_report_func_t callback,
void *user_data);
+1 -1
View File
@@ -71,7 +71,7 @@ SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c);
/*! \brief Initialise a bitstream context.
\param s A pointer to the bitstream context.
\param lsb_first TRUE if the bit stream is LSB first, else its MSB first.
\param lsb_first True if the bit stream is LSB first, else its MSB first.
\return A pointer to the bitstream context. */
SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int direction);
+4 -4
View File
@@ -60,9 +60,9 @@ SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len);
/*! \brief Check the ITU/CCITT CRC-32 value in a frame.
\param buf The buffer containing the frame.
\param len The length of the frame.
\return TRUE if the CRC is OK, else FALSE.
\return True if the CRC is OK, else false.
*/
SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len);
SPAN_DECLARE(bool) crc_itu32_check(const uint8_t *buf, int len);
/*! \brief Calculate the ITU/CCITT CRC-16 value in buffer by whole bytes.
\param buf The buffer containing the data.
@@ -93,9 +93,9 @@ SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len);
/*! \brief Check the ITU/CCITT CRC-16 value in a frame.
\param buf The buffer containing the frame.
\param len The length of the frame.
\return TRUE if the CRC is OK, else FALSE.
\return True if the CRC is OK, else false.
*/
SPAN_DECLARE(int) crc_itu16_check(const uint8_t *buf, int len);
SPAN_DECLARE(bool) crc_itu16_check(const uint8_t *buf, int len);
#if defined(__cplusplus)
}
+1 -1
View File
@@ -156,7 +156,7 @@ SPAN_DECLARE(void) dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s,
/*! \brief Adjust a DTMF receiver context.
\param s The DTMF receiver context.
\param filter_dialtone TRUE to enable filtering of dialtone, FALSE
\param filter_dialtone True to enable filtering of dialtone, false
to disable, < 0 to leave unchanged.
\param twist Acceptable twist, in dB. < 0.0 to leave unchanged.
\param reverse_twist Acceptable reverse twist, in dB. < 0.0 to leave unchanged.
+4 -2
View File
@@ -40,6 +40,7 @@
#include <spandsp/private/awgn.h>
#include <spandsp/private/noise.h>
#include <spandsp/private/bert.h>
#include <spandsp/private/power_meter.h>
#include <spandsp/private/tone_generate.h>
#include <spandsp/private/bell_r2_mf.h>
#include <spandsp/private/sig_tone.h>
@@ -49,6 +50,8 @@
#include <spandsp/private/g726.h>
#include <spandsp/private/lpc10.h>
#include <spandsp/private/gsm0610.h>
#include <spandsp/private/plc.h>
#include <spandsp/private/playout.h>
#include <spandsp/private/oki_adpcm.h>
#include <spandsp/private/ima_adpcm.h>
#include <spandsp/private/hdlc.h>
@@ -70,11 +73,10 @@
#include <spandsp/private/v27ter_tx.h>
#include <spandsp/private/v29rx.h>
#include <spandsp/private/v29tx.h>
/*#include <spandsp/private/v32bis.h>*/
/*#include <spandsp/private/v34.h>*/
#include <spandsp/private/v42.h>
#include <spandsp/private/v42bis.h>
#include <spandsp/private/at_interpreter.h>
//#include <spandsp/private/data_modems.h>
#include <spandsp/private/fax_modems.h>
#include <spandsp/private/timezone.h>
#include <spandsp/private/image_translate.h>
+6 -6
View File
@@ -75,16 +75,16 @@ SPAN_DECLARE_NONSTD(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len);
/*! Select whether silent audio will be sent when FAX transmit is idle.
\brief Select whether silent audio will be sent when FAX transmit is idle.
\param s The FAX context.
\param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is
idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default
behaviour is FALSE.
\param transmit_on_idle True if silent audio should be output when the FAX transmitter is
idle. False to transmit zero length audio when the FAX transmitter is idle. The default
behaviour is false.
*/
SPAN_DECLARE(void) fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle);
/*! Select whether talker echo protection tone will be sent for the image modems.
\brief Select whether TEP will be sent for the image modems.
\param s The FAX context.
\param use_tep TRUE if TEP should be sent.
\param use_tep True if TEP should be sent.
*/
SPAN_DECLARE(void) fax_set_tep_mode(fax_state_t *s, int use_tep);
@@ -105,7 +105,7 @@ SPAN_DECLARE(logging_state_t *) fax_get_logging_state(fax_state_t *s);
/*! Restart a FAX context.
\brief Restart a FAX context.
\param s The FAX context.
\param calling_party TRUE if the context is for a calling party. FALSE if the
\param calling_party True if the context is for a calling party. False if the
context is for an answering party.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) fax_restart(fax_state_t *s, int calling_party);
@@ -113,7 +113,7 @@ SPAN_DECLARE(int) fax_restart(fax_state_t *s, int calling_party);
/*! Initialise a FAX context.
\brief Initialise a FAX context.
\param s The FAX context.
\param calling_party TRUE if the context is for a calling party. FALSE if the
\param calling_party True if the context is for a calling party. False if the
context is for an answering party.
\return A pointer to the FAX context, or NULL if there was a problem.
*/
+8 -8
View File
@@ -83,8 +83,8 @@ extern "C"
/*! \brief Initialise an HDLC receiver context.
\param s A pointer to an HDLC receiver context.
\param crc32 TRUE to use ITU CRC32. FALSE to use ITU CRC16.
\param report_bad_frames TRUE to request the reporting of bad frames.
\param crc32 True to use ITU CRC32. False to use ITU CRC16.
\param report_bad_frames True to request the reporting of bad frames.
\param framing_ok_threshold The number of back-to-back flags needed to
start the framing OK condition. This may be used where a series of
flag octets is used as a preamble, such as in the T.30 protocol.
@@ -93,8 +93,8 @@ extern "C"
\return A pointer to the HDLC receiver context.
*/
SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s,
int crc32,
int report_bad_frames,
bool crc32,
bool report_bad_frames,
int framing_ok_threshold,
hdlc_frame_handler_t handler,
void *user_data);
@@ -169,17 +169,17 @@ SPAN_DECLARE_NONSTD(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], i
/*! \brief Initialise an HDLC transmitter context.
\param s A pointer to an HDLC transmitter context.
\param crc32 TRUE to use ITU CRC32. FALSE to use ITU CRC16.
\param crc32 True to use ITU CRC32. False to use ITU CRC16.
\param inter_frame_flags The minimum flag octets to insert between frames (usually one).
\param progressive TRUE if frame creation works in progressive mode.
\param progressive True if frame creation works in progressive mode.
\param handler The callback function called when the HDLC transmitter underflows.
\param user_data An opaque parameter for the callback routine.
\return A pointer to the HDLC transmitter context.
*/
SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s,
int crc32,
bool crc32,
int inter_frame_flags,
int progressive,
bool progressive,
hdlc_underflow_handler_t handler,
void *user_data);
+2 -2
View File
@@ -80,9 +80,9 @@ extern "C"
\brief Test if logging of a specified severity level is enabled.
\param s The logging context.
\param level The severity level to be tested.
\return TRUE if logging is enable, else FALSE.
\return True if logging is enable.
*/
SPAN_DECLARE(int) span_log_test(logging_state_t *s, int level);
SPAN_DECLARE(bool) span_log_test(logging_state_t *s, int level);
/*! Generate a log entry.
\brief Generate a log entry.
@@ -153,7 +153,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx_fillin(modem_connect_tones_rx_st
/*! \brief Test if a modem_connect tone has been detected.
\param s The context.
\return TRUE if tone is detected, else FALSE.
\return The code for the detected tone.
*/
SPAN_DECLARE(int) modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s);
+2 -69
View File
@@ -56,80 +56,13 @@ enum
typedef int timestamp_t;
typedef struct playout_frame_s
{
/*! The actual frame data */
void *data;
/*! The type of frame */
int type;
/*! The timestamp assigned by the sending end */
timestamp_t sender_stamp;
/*! The timespan covered by the data in this frame */
timestamp_t sender_len;
/*! The timestamp assigned by the receiving end */
timestamp_t receiver_stamp;
/*! Pointer to the next earlier frame */
struct playout_frame_s *earlier;
/*! Pointer to the next later frame */
struct playout_frame_s *later;
} playout_frame_t;
typedef struct playout_frame_s playout_frame_t;
/*!
Playout (jitter buffer) descriptor. This defines the working state
for a single instance of playout buffering.
*/
typedef struct
{
/*! TRUE if the buffer is dynamically sized */
int dynamic;
/*! The minimum length (dynamic) or fixed length (static) of the buffer */
int min_length;
/*! The maximum length (dynamic) or fixed length (static) of the buffer */
int max_length;
/*! The target filter threshold for adjusting dynamic buffering. */
int dropable_threshold;
int start;
/*! The queued frame list */
playout_frame_t *first_frame;
playout_frame_t *last_frame;
/*! The free frame pool */
playout_frame_t *free_frames;
/*! The total frames input to the buffer, to date. */
int frames_in;
/*! The total frames output from the buffer, to date. */
int frames_out;
/*! The number of frames received out of sequence. */
int frames_oos;
/*! The number of frames which were discarded, due to late arrival. */
int frames_late;
/*! The number of frames which were never received. */
int frames_missing;
/*! The number of frames trimmed from the stream, due to buffer shrinkage. */
int frames_trimmed;
timestamp_t latest_expected;
/*! The present jitter adjustment */
timestamp_t current;
/*! The sender_stamp of the last speech frame */
timestamp_t last_speech_sender_stamp;
/*! The duration of the last speech frame */
timestamp_t last_speech_sender_len;
int not_first;
/*! The time since the target buffer length was last changed. */
timestamp_t since_last_step;
/*! Filter state for tracking the packets arriving just in time */
int32_t state_just_in_time;
/*! Filter state for tracking the packets arriving late */
int32_t state_late;
/*! The current target length of the buffer */
int target_buffer_length;
/*! The current actual length of the buffer, which may lag behind the target value */
int actual_buffer_length;
} playout_state_t;
typedef struct playout_state_s playout_state_t;
#if defined(__cplusplus)
extern "C"
+1 -15
View File
@@ -109,21 +109,7 @@ That's it!
/*!
The generic packet loss concealer context.
*/
typedef struct
{
/*! Consecutive erased samples */
int missing_samples;
/*! Current offset into pitch period */
int pitch_offset;
/*! Pitch estimate */
int pitch;
/*! Buffer for a cycle of speech */
float pitchbuf[PLC_PITCH_MIN];
/*! History buffer */
int16_t history[PLC_HISTORY_LEN];
/*! Current pointer into the history buffer */
int buf_ptr;
} plc_state_t;
typedef struct plc_state_s plc_state_t;
#if defined(__cplusplus)
+4 -19
View File
@@ -23,8 +23,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(_POWER_METER_H_)
#define _POWER_METER_H_
#if !defined(_SPANDSP_POWER_METER_H_)
#define _SPANDSP_POWER_METER_H_
/*! \page power_meter_page Power metering
@@ -45,24 +45,9 @@ values +/-8031, and this square wave represents 0dBov. This translates into 6.1
Power meter descriptor. This defines the working state for a
single instance of a power measurement device.
*/
typedef struct
{
/*! The shift factor, which controls the damping of the power meter. */
int shift;
typedef struct power_meter_s power_meter_t;
/*! The current power reading. */
int32_t reading;
} power_meter_t;
typedef struct
{
power_meter_t short_term;
power_meter_t medium_term;
int signal_present;
int32_t surge;
int32_t sag;
int32_t min;
} power_surge_detector_state_t;
typedef struct power_surge_detector_state_s power_surge_detector_state_t;
#if defined(__cplusplus)
extern "C"
+2 -2
View File
@@ -69,8 +69,8 @@ struct async_rx_state_s
int parity;
/*! \brief The number of stop bits per character. */
int stop_bits;
/*! \brief TRUE if V.14 rate adaption processing should be performed. */
int use_v14;
/*! \brief True if V.14 rate adaption processing should be performed. */
bool use_v14;
/*! \brief A pointer to the callback routine used to handle received characters. */
put_byte_func_t put_byte;
/*! \brief An opaque pointer passed when calling put_byte. */
@@ -106,10 +106,10 @@ struct at_state_s
int command_dial;
int ok_is_pending;
int dte_is_waiting;
/*! \brief TRUE if a carrier is presnt. Otherwise FALSE. */
int rx_signal_present;
/*! \brief TRUE if a modem has trained, Otherwise FALSE. */
int rx_trained;
/*! \brief True if a carrier is presnt. Otherwise false. */
bool rx_signal_present;
/*! \brief True if a modem has trained, Otherwise false. */
bool rx_trained;
int transmit;
char line[256];
@@ -73,8 +73,8 @@ struct r2_mf_tx_state_s
{
/*! The tone generator. */
tone_gen_state_t tone;
/*! TRUE if generating forward tones, otherwise generating reverse tones. */
int fwd;
/*! True if generating forward tones, otherwise generating reverse tones. */
bool fwd;
/*! The current digit being generated. */
int digit;
};
@@ -88,8 +88,8 @@ struct r2_mf_rx_state_s
tone_report_func_t callback;
/*! An opaque pointer passed to the callback function. */
void *callback_data;
/*! TRUE is we are detecting forward tones. FALSE if we are detecting backward tones */
int fwd;
/*! Tue is we are detecting forward tones. False if we are detecting backward tones */
bool fwd;
/*! Tone detector working states */
goertzel_state_t out[6];
/*! The current sample number within a processing block. */
+2 -2
View File
@@ -33,8 +33,8 @@ struct bitstream_state_s
uint32_t bitstream;
/*! The residual bits in bitstream. */
int residue;
/*! TRUE if the stream is LSB first, else MSB first */
int lsb_first;
/*! True if the stream is LSB first, else MSB first */
bool lsb_first;
};
+2 -2
View File
@@ -61,8 +61,8 @@ struct dtmf_rx_state_s
tone_report_func_t realtime_callback;
/*! An opaque pointer passed to the real time callback function. */
void *realtime_callback_data;
/*! TRUE if dialtone should be filtered before processing */
int filter_dialtone;
/*! True if dialtone should be filtered before processing */
bool filter_dialtone;
#if defined(SPANDSP_USE_FIXED_POINT)
/*! 350Hz filter state for the optional dialtone filter. */
float z350[2];
+11 -11
View File
@@ -33,14 +33,14 @@
*/
struct fax_modems_state_s
{
/*! TRUE is talker echo protection should be sent for the image modems */
int use_tep;
/*! True is talker echo protection should be sent for the image modems */
bool use_tep;
/*! \brief The callback function used to report detected tones. */
tone_report_func_t tone_callback;
/*! \brief A user specified opaque pointer passed to the tone_callback function. */
void *tone_callback_user_data;
/*! If TRUE, transmit silence when there is nothing else to transmit. If FALSE return only
/*! If true, transmit silence when there is nothing else to transmit. If false return only
the actual generated audio. Note that this only affects untimed silences. Timed silences
(e.g. the 75ms silence between V.21 and a high speed modem) will alway be transmitted as
silent audio. */
@@ -110,12 +110,12 @@ struct fax_modems_state_s
hdlc_frame_handler_t hdlc_accept;
void *hdlc_accept_user_data;
/*! \brief TRUE if a carrier is present. Otherwise FALSE. */
int rx_signal_present;
/*! \brief TRUE if a modem has trained correctly. */
int rx_trained;
/*! \brief TRUE if an HDLC frame has been received correctly. */
int rx_frame_received;
/*! \brief True if a carrier is present. Otherwise false. */
bool rx_signal_present;
/*! \brief True if a modem has trained correctly. */
bool rx_trained;
/*! \brief True if an HDLC frame has been received correctly. */
bool rx_frame_received;
int deferred_rx_handler_updates;
/*! \brief The current receive signal handler */
@@ -145,8 +145,8 @@ struct fax_modems_state_s
/*! \brief The current bit rate of the receiver. */
int rx_bit_rate;
/*! \brief If TRUE, transmission is in progress */
int transmit;
/*! \brief If True, transmission is in progress */
bool transmit;
/*! \brief Audio logging file handle for received audio. */
int audio_rx_log;
/*! \brief Audio logging file handle for transmitted audio. */
+12 -12
View File
@@ -47,13 +47,13 @@ typedef struct
*/
struct g722_encode_state_s
{
/*! TRUE if the operating in the special ITU test mode, with the band split filters
/*! True if the operating in the special ITU test mode, with the band split filters
disabled. */
int itu_test_mode;
/*! TRUE if the G.722 data is packed */
int packed;
/*! TRUE if encode from 8k samples/second */
int eight_k;
bool itu_test_mode;
/*! True if the G.722 data is packed */
bool packed;
/*! True if encode from 8k samples/second */
bool eight_k;
/*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
int bits_per_sample;
@@ -75,13 +75,13 @@ struct g722_encode_state_s
*/
struct g722_decode_state_s
{
/*! TRUE if the operating in the special ITU test mode, with the band split filters
/*! True if the operating in the special ITU test mode, with the band split filters
disabled. */
int itu_test_mode;
/*! TRUE if the G.722 data is packed */
int packed;
/*! TRUE if decode to 8k samples/second */
int eight_k;
bool itu_test_mode;
/*! True if the G.722 data is packed */
bool packed;
/*! True if decode to 8k samples/second */
bool eight_k;
/*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
int bits_per_sample;
+14 -14
View File
@@ -43,24 +43,24 @@ struct hdlc_rx_state_s
modem_status_func_t status_handler;
/*! \brief An opaque parameter passed to the status callback routine. */
void *status_user_data;
/*! \brief TRUE if bad frames are to be reported. */
int report_bad_frames;
/*! \brief True if bad frames are to be reported. */
bool report_bad_frames;
/*! \brief The number of consecutive flags which must be seen before framing is
declared OK. */
int framing_ok_threshold;
/*! \brief TRUE if framing OK has been announced. */
int framing_ok_announced;
/*! \brief True if framing OK has been announced. */
bool framing_ok_announced;
/*! \brief Number of consecutive flags seen so far. */
int flags_seen;
/*! \brief The raw (stuffed) bit stream buffer. */
unsigned int raw_bit_stream;
uint32_t raw_bit_stream;
/*! \brief The destuffed bit stream buffer. */
unsigned int byte_in_progress;
uint32_t byte_in_progress;
/*! \brief The current number of bits in byte_in_progress. */
int num_bits;
/*! \brief TRUE if in octet counting mode (e.g. for MTP). */
int octet_counting_mode;
/*! \brief True if in octet counting mode (e.g. for MTP). */
bool octet_counting_mode;
/*! \brief Octet count, to achieve the functionality needed for things
like MTP. */
int octet_count;
@@ -98,8 +98,8 @@ struct hdlc_tx_state_s
void *user_data;
/*! \brief The minimum flag octets to insert between frames. */
int inter_frame_flags;
/*! \brief TRUE if frame creation works in progressive mode. */
int progressive;
/*! \brief True if frame creation works in progressive mode. */
bool progressive;
/*! \brief Maximum permitted frame length. */
size_t max_frame_len;
@@ -113,8 +113,8 @@ struct hdlc_tx_state_s
int flag_octets;
/*! \brief The number of abort octets to send for a timed burst of aborts. */
int abort_octets;
/*! \brief TRUE if the next underflow of timed flag octets should be reported */
int report_flag_underflow;
/*! \brief True if the next underflow of timed flag octets should be reported */
bool report_flag_underflow;
/*! \brief The current message being transmitted, with its CRC attached. */
uint8_t buffer[HDLC_MAXFRAME_LEN + 4];
@@ -130,8 +130,8 @@ struct hdlc_tx_state_s
/*! \brief The number of bits remaining in byte. */
int bits;
/*! \brief TRUE if transmission should end on buffer underflow .*/
int tx_end;
/*! \brief True if transmission should end on buffer underflow .*/
bool tx_end;
};
#endif
+10 -10
View File
@@ -92,8 +92,8 @@ struct lpc10_encode_state_s
int32_t l2ptr2;
/*! \brief No initial value necessary */
int32_t lasti;
/*! \brief Initial value FALSE */
int hyst;
/*! \brief Initial value false */
bool hyst;
/* State used by function lpc10_voicing */
/*! \brief Initial value 20.0f */
@@ -148,8 +148,8 @@ struct lpc10_decode_state_s
/* State used by function decode */
/*! \brief Initial value 60 */
int32_t iptold;
/*! \brief Initial value TRUE */
int first;
/*! \brief Initial value true */
bool first;
/*! \brief ??? */
int32_t ivp2h;
/*! \brief ??? */
@@ -172,18 +172,18 @@ struct lpc10_decode_state_s
int32_t buflen;
/* State used by function pitsyn */
/*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */
/*! \brief No initial value necessary as long as first_pitsyn is initially true */
int32_t ivoico;
/*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */
/*! \brief No initial value necessary as long as first_pitsyn is initially true */
int32_t ipito;
/*! \brief Initial value 1.0f */
float rmso;
/*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */
/*! \brief No initial value necessary as long as first_pitsyn is initially true */
float rco[10];
/*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */
/*! \brief No initial value necessary as long as first_pitsyn is initially true */
int32_t jsamp;
/*! \brief Initial value TRUE */
int first_pitsyn;
/*! \brief Initial value true */
bool first_pitsyn;
/* State used by function bsynz */
/*! \brief ??? */
@@ -77,7 +77,7 @@ struct modem_connect_tones_rx_state_s
int32_t am_level;
/*! \brief Sample counter for the small chunks of samples, after which a test is conducted. */
int chunk_remainder;
/*! \brief TRUE is the tone is currently confirmed present in the audio. */
/*! \brief The code for the tone currently confirmed present in the audio. */
int tone_present;
/*! \brief */
int tone_on;
@@ -85,7 +85,7 @@ struct modem_connect_tones_rx_state_s
int tone_cycle_duration;
/*! \brief A count of the number of good cycles of tone reversal seen. */
int good_cycles;
/*! \brief TRUE if the tone has been seen since the last time the user tested for it */
/*! \brief The confirmed tone code. */
int hit;
/*! \brief A V.21 FSK modem context used when searching for FAX preamble. */
fsk_rx_state_t v21rx;
@@ -95,8 +95,8 @@ struct modem_connect_tones_rx_state_s
int num_bits;
/*! \brief Number of consecutive flags seen so far. */
int flags_seen;
/*! \brief TRUE if framing OK has been announced. */
int framing_ok_announced;
/*! \brief True if framing OK has been announced. */
bool framing_ok_announced;
};
#endif
+105
View File
@@ -0,0 +1,105 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* private/playout.h
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2005 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.
*/
#if !defined(_SPANDSP_PRIVATE_PLAYOUT_H_)
#define _SPANDSP_PRIVATE_PLAYOUT_H_
struct playout_frame_s
{
/*! The actual frame data */
void *data;
/*! The type of frame */
int type;
/*! The timestamp assigned by the sending end */
timestamp_t sender_stamp;
/*! The timespan covered by the data in this frame */
timestamp_t sender_len;
/*! The timestamp assigned by the receiving end */
timestamp_t receiver_stamp;
/*! Pointer to the next earlier frame */
struct playout_frame_s *earlier;
/*! Pointer to the next later frame */
struct playout_frame_s *later;
};
/*!
Playout (jitter buffer) descriptor. This defines the working state
for a single instance of playout buffering.
*/
struct playout_state_s
{
/*! True if the buffer is dynamically sized */
bool dynamic;
/*! The minimum length (dynamic) or fixed length (static) of the buffer */
int min_length;
/*! The maximum length (dynamic) or fixed length (static) of the buffer */
int max_length;
/*! The target filter threshold for adjusting dynamic buffering. */
int dropable_threshold;
int start;
/*! The queued frame list */
playout_frame_t *first_frame;
playout_frame_t *last_frame;
/*! The free frame pool */
playout_frame_t *free_frames;
/*! The total frames input to the buffer, to date. */
int frames_in;
/*! The total frames output from the buffer, to date. */
int frames_out;
/*! The number of frames received out of sequence. */
int frames_oos;
/*! The number of frames which were discarded, due to late arrival. */
int frames_late;
/*! The number of frames which were never received. */
int frames_missing;
/*! The number of frames trimmed from the stream, due to buffer shrinkage. */
int frames_trimmed;
timestamp_t latest_expected;
/*! The present jitter adjustment */
timestamp_t current;
/*! The sender_stamp of the last speech frame */
timestamp_t last_speech_sender_stamp;
/*! The duration of the last speech frame */
timestamp_t last_speech_sender_len;
int not_first;
/*! The time since the target buffer length was last changed. */
timestamp_t since_last_step;
/*! Filter state for tracking the packets arriving just in time */
int32_t state_just_in_time;
/*! Filter state for tracking the packets arriving late */
int32_t state_late;
/*! The current target length of the buffer */
int target_buffer_length;
/*! The current actual length of the buffer, which may lag behind the target value */
int actual_buffer_length;
};
#endif
/*- End of file ------------------------------------------------------------*/
+64
View File
@@ -0,0 +1,64 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* private/plc.h
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2004 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_PLC_H_)
#define _SPANDSP_PRIVATE_PLC_H_
/*! Minimum allowed pitch (66 Hz) */
#define PLC_PITCH_MIN 120
/*! Maximum allowed pitch (200 Hz) */
#define PLC_PITCH_MAX 40
/*! Maximum pitch OLA window */
#define PLC_PITCH_OVERLAP_MAX (PLC_PITCH_MIN >> 2)
/*! The length over which the AMDF function looks for similarity (20 ms) */
#define CORRELATION_SPAN 160
/*! History buffer length. The buffer much also be at leat 1.25 times
PLC_PITCH_MIN, but that is much smaller than the buffer needs to be for
the pitch assessment. */
#define PLC_HISTORY_LEN (CORRELATION_SPAN + PLC_PITCH_MIN)
/*!
The generic packet loss concealer context.
*/
struct plc_state_s
{
/*! Consecutive erased samples */
int missing_samples;
/*! Current offset into pitch period */
int pitch_offset;
/*! Pitch estimate */
int pitch;
/*! Buffer for a cycle of speech */
float pitchbuf[PLC_PITCH_MIN];
/*! History buffer */
int16_t history[PLC_HISTORY_LEN];
/*! Current pointer into the history buffer */
int buf_ptr;
};
#endif
/*- End of file ------------------------------------------------------------*/
@@ -0,0 +1,53 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* private/power_meter.h
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2003 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.
*/
#if !defined(_SPANDSP_PRIVATE_POWER_METER_H_)
#define _SPANDSP_PRIVATE_POWER_METER_H_
/*!
Power meter descriptor. This defines the working state for a
single instance of a power measurement device.
*/
struct power_meter_s
{
/*! The shift factor, which controls the damping of the power meter. */
int shift;
/*! The current power reading. */
int32_t reading;
};
struct power_surge_detector_state_s
{
power_meter_t short_term;
power_meter_t medium_term;
int signal_present;
int32_t surge;
int32_t sag;
int32_t min;
};
#endif
/*- End of file ------------------------------------------------------------*/
+4 -4
View File
@@ -210,10 +210,10 @@ struct sig_tone_rx_state_s
/*! \brief The minimum ratio between notched power and total power for detection */
int32_t detection_ratio;
/*! \brief TRUE if in flat mode. FALSE if in sharp mode. */
int flat_mode;
/*! \brief TRUE if the notch filter is enabled in the media path */
int notch_enabled;
/*! \brief True if in flat mode. False if in sharp mode. */
bool flat_mode;
/*! \brief True if the notch filter is enabled in the media path */
bool notch_enabled;
/*! \brief ??? */
int flat_mode_timeout;
/*! \brief ??? */
+35 -35
View File
@@ -43,8 +43,8 @@ struct t30_state_s
/*! \brief The type of FAX operation currently in progress */
int operation_in_progress;
/*! \brief TRUE if behaving as the calling party */
int calling_party;
/*! \brief True if behaving as the calling party */
bool calling_party;
/*! \brief Internet aware FAX mode bit mask. */
int iaf;
@@ -64,10 +64,10 @@ struct t30_state_s
int supported_image_sizes;
/*! \brief A bit mask of the currently supported T.30 special features. */
int supported_t30_features;
/*! \brief TRUE is ECM mode handling is enabled. */
int ecm_allowed;
/*! \brief TRUE if we are capable of retransmitting pages */
int retransmit_capable;
/*! \brief True is ECM mode handling is enabled. */
bool ecm_allowed;
/*! \brief True if we are capable of retransmitting pages */
bool retransmit_capable;
/*! \brief The received DCS, formatted as an ASCII string, for inclusion
in the TIFF file. */
@@ -75,17 +75,17 @@ struct t30_state_s
/*! \brief The text which will be used in FAX page header. No text results
in no header line. */
char header_info[T30_MAX_PAGE_HEADER_INFO + 1];
/*! \brief TRUE for FAX page headers to overlay (i.e. replace) the beginning of the
page image. FALSE for FAX page headers to add to the overall length of
/*! \brief True for FAX page headers to overlay (i.e. replace) the beginning of the
page image. False for FAX page headers to add to the overall length of
the page. */
int header_overlays_image;
/*! \brief Use private timezone if TRUE */
int use_own_tz;
bool header_overlays_image;
/*! \brief Use private timezone if true */
bool use_own_tz;
/*! \brief Optional per instance time zone for the FAX page header timestamp. */
tz_t tz;
/*! \brief TRUE if remote T.30 procedural interrupts are allowed. */
int remote_interrupts_allowed;
/*! \brief True if remote T.30 procedural interrupts are allowed. */
bool remote_interrupts_allowed;
/*! \brief The information fields received. */
t30_exchanged_info_t rx_info;
@@ -163,11 +163,11 @@ struct t30_state_s
int local_dis_dtc_len;
/*! \brief The last DIS or DTC message received form the far end. */
uint8_t far_dis_dtc_frame[T30_MAX_DIS_DTC_DCS_LEN];
/*! \brief TRUE if a valid DIS has been received from the far end. */
int dis_received;
/*! \brief True if a valid DIS has been received from the far end. */
bool dis_received;
/*! \brief TRUE if the short training sequence should be used. */
int short_train;
/*! \brief True if the short training sequence should be used. */
bool short_train;
/*! \brief A count of the number of bits in the trainability test. This counts down to zero when
sending TCF, and counts up when receiving it. */
@@ -181,12 +181,12 @@ struct t30_state_s
int current_fallback;
/*! \brief The subset of supported modems allowed at the current time, allowing for negotiation. */
int current_permitted_modems;
/*! \brief TRUE if a carrier is present. Otherwise FALSE. */
int rx_signal_present;
/*! \brief TRUE if a modem has trained correctly. */
int rx_trained;
/*! \brief TRUE if a valid HDLC frame has been received in the current reception period. */
int rx_frame_received;
/*! \brief True if a carrier is present. Otherwise false. */
bool rx_signal_present;
/*! \brief True if a modem has trained correctly. */
bool rx_trained;
/*! \brief True if a valid HDLC frame has been received in the current reception period. */
bool rx_frame_received;
/*! \brief Current reception mode. */
int current_rx_type;
@@ -214,14 +214,14 @@ struct t30_state_s
/*! \brief This is only used in full duplex (e.g. ISDN) modes. */
int timer_t8;
/*! \brief TRUE once the far end FAX entity has been detected. */
int far_end_detected;
/*! \brief True once the far end FAX entity has been detected. */
bool far_end_detected;
/*! \brief TRUE once the end of procedure condition has been detected. */
int end_of_procedure_detected;
/*! \brief True once the end of procedure condition has been detected. */
bool end_of_procedure_detected;
/*! \brief TRUE if a local T.30 interrupt is pending. */
int local_interrupt_pending;
/*! \brief True if a local T.30 interrupt is pending. */
bool local_interrupt_pending;
/*! \brief The common ground in compression schemes between the local and far ends. */
int mutual_compressions;
/*! \brief The common group of supported bi-level image resolutions. */
@@ -248,8 +248,8 @@ struct t30_state_s
t4_image_width_t image_width;
/*! \brief Current number of retries of the action in progress. */
int retries;
/*! \brief TRUE if error correcting mode is used. */
int error_correcting_mode;
/*! \brief True if error correcting mode is used. */
bool error_correcting_mode;
/*! \brief The number of HDLC frame retries, if error correcting mode is used. */
int error_correcting_mode_retries;
/*! \brief The current count of consecutive T30_PPR messages. */
@@ -277,9 +277,9 @@ struct t30_state_s
int ecm_frames_this_tx_burst;
/*! \brief The current ECM frame, during ECM transmission. */
int ecm_current_tx_frame;
/*! \brief TRUE if we are at the end of an ECM page to se sent - i.e. there are no more
/*! \brief True if we are at the end of an ECM page to se sent - i.e. there are no more
partial pages still to come. */
int ecm_at_page_end;
bool ecm_at_page_end;
/*! \brief The transmission step queued to follow the one in progress. */
int next_tx_step;
@@ -305,8 +305,8 @@ struct t30_state_s
/*! \brief the FCF2 field of the last PPS message we received. */
uint8_t last_pps_fcf2;
/*! \brief TRUE if all frames of the current received ECM block are now OK */
int rx_ecm_block_ok;
/*! \brief True if all frames of the current received ECM block are now OK */
bool rx_ecm_block_ok;
/*! \brief A count of successfully received ECM frames, to assess progress as a basis for
deciding whether to continue error correction when PPRs keep repeating. */
int ecm_progress;
+20 -20
View File
@@ -108,8 +108,8 @@ typedef struct
/*! \brief The current transmit step being timed */
int timed_step;
/*! \brief TRUE is there has been some T.38 data missed */
int rx_data_missing;
/*! \brief True is there has been some T.38 data missed */
bool rx_data_missing;
/*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
rate and the current specified packet interval. */
@@ -138,9 +138,9 @@ typedef struct
t31_hdlc_state_t hdlc_from_t31;
/*! \brief TRUE if we are using ECM mode. This is used to select HDLC faking, necessary
/*! \brief True if we are using ECM mode. This is used to select HDLC faking, necessary
with clunky class 1 modems. */
int ecm_mode;
bool ecm_mode;
/*! \brief Counter for trailing non-ECM bytes, used to flush out the far end's modem. */
int non_ecm_trailer_bytes;
@@ -179,8 +179,8 @@ struct t31_state_s
t31_audio_front_end_state_t audio;
t31_t38_front_end_state_t t38_fe;
/*! TRUE if working in T.38 mode. */
int t38_mode;
/*! True if working in T.38 mode. */
bool t38_mode;
/*! HDLC buffer, for composing an HDLC frame from the computer to the channel. */
struct
@@ -189,8 +189,8 @@ struct t31_state_s
uint8_t buf[T31_MAX_HDLC_LEN];
int len;
int ptr;
/*! \brief TRUE when the end of HDLC data from the computer has been detected. */
int final;
/*! \brief True when the end of HDLC data from the computer has been detected. */
bool final;
} hdlc_tx;
/*! Buffer for data from the computer to the channel. */
struct
@@ -201,24 +201,24 @@ struct t31_state_s
int in_bytes;
/*! \brief The number of bytes sent from the transmit buffer. */
int out_bytes;
/*! \brief TRUE if the flow of real data has started. */
int data_started;
/*! \brief TRUE if holding up further data into the buffer, for flow control. */
int holding;
/*! \brief TRUE when the end of non-ECM data from the computer has been detected. */
int final;
/*! \brief True if the flow of real data has started. */
bool data_started;
/*! \brief True if holding up further data into the buffer, for flow control. */
bool holding;
/*! \brief True when the end of non-ECM data from the computer has been detected. */
bool final;
} non_ecm_tx;
/*! TRUE if DLE prefix just used */
int dled;
/*! True if DLE prefix just used */
bool dled;
/*! \brief Samples of silence awaited, as specified in a "wait for silence" command */
int silence_awaited;
/*! \brief The current bit rate for the FAX fast message transfer modem. */
int bit_rate;
/*! \brief TRUE if a valid HDLC frame has been received in the current reception period. */
int rx_frame_received;
/*! \brief True if a valid HDLC frame has been received in the current reception period. */
bool rx_frame_received;
/*! \brief Samples elapsed in the current call */
int64_t call_samples;
@@ -226,8 +226,8 @@ struct t31_state_s
/*! \brief The currently queued modem type. */
int modem;
/*! \brief TRUE when short training mode has been selected by the computer. */
int short_train;
/*! \brief True when short training mode has been selected by the computer. */
bool short_train;
queue_state_t *rx_queue;
/*! \brief Error and flow logging control */
+2 -2
View File
@@ -98,9 +98,9 @@ struct t38_core_state_s
/*! \brief Pace transmission */
int pace_transmission;
/*! \brief TRUE if IFP packet sequence numbers are relevant. For some transports, like TPKT
/*! \brief True if IFP packet sequence numbers are relevant. For some transports, like TPKT
over TCP they are not relevent. */
int check_sequence_numbers;
bool check_sequence_numbers;
/*! \brief The number of times each packet type will be sent (low byte). The
depth of redundancy (2nd byte). Higher numbers may increase reliability
+16 -16
View File
@@ -43,12 +43,12 @@ typedef struct
/*! \brief Core T.38 IFP support */
t38_core_state_t t38;
/*! \brief TRUE if the NSF, NSC, and NSS are to be suppressed by altering
their contents to something the far end will not recognise. */
/*! \brief If NSF, NSC, and NSS are to be suppressed by altering their contents to
something the far end will not recognise, this is the amount to overwrite. */
int suppress_nsx_len[2];
/*! \brief TRUE if we need to corrupt the HDLC frame in progress, so the receiver cannot
/*! \brief True if we need to corrupt the HDLC frame in progress, so the receiver cannot
interpret it. The two values are for the two directions. */
int corrupt_current_frame[2];
bool corrupt_current_frame[2];
/*! \brief the current class of field being received - i.e. none, non-ECM or HDLC */
int current_rx_field_class;
@@ -87,8 +87,8 @@ typedef struct
int bit_no;
/*! \brief Progressively calculated CRC for HDLC messages received from a modem. */
uint16_t crc;
/*! \brief TRUE if non-ECM fill bits are to be stripped when sending image data. */
int fill_bit_removal;
/*! \brief True if non-ECM fill bits are to be stripped when sending image data. */
bool fill_bit_removal;
/*! \brief The number of octets to send in each image packet (non-ECM or ECM) at
the current rate and the current specified packet interval. */
int octets_per_data_packet;
@@ -134,27 +134,27 @@ typedef struct
{
/*! \brief A bit mask of the currently supported modem types. */
int supported_modems;
/*! \brief TRUE if ECM FAX mode is allowed through the gateway. */
int ecm_allowed;
/*! \brief True if ECM FAX mode is allowed through the gateway. */
bool ecm_allowed;
/*! \brief Required time between T.38 transmissions, in ms. */
int ms_per_tx_chunk;
/*! \brief TRUE if in image data modem is to use short training. This usually
/*! \brief True if in image data modem is to use short training. This usually
follows image_data_mode, but in ECM mode T.30 defines recovery
conditions in which long training is used for image data. */
int short_train;
/*! \brief TRUE if in image data mode, as opposed to TCF mode. */
int image_data_mode;
bool short_train;
/*! \brief True if in image data mode, as opposed to TCF mode. */
bool image_data_mode;
/*! \brief The minimum permitted bits per FAX scan line row. */
int min_row_bits;
/*! \brief TRUE if we should count the next MCF as a page end, else FALSE */
int count_page_on_mcf;
/*! \brief True if we should count the next MCF as a page end, else false */
bool count_page_on_mcf;
/*! \brief The number of pages for which a confirm (MCF) message was returned. */
int pages_confirmed;
/*! \brief TRUE if we are in error correcting (ECM) mode */
int ecm_mode;
/*! \brief True if we are in error correcting (ECM) mode */
bool ecm_mode;
/*! \brief The current bit rate for the fast modem. */
int fast_bit_rate;
/*! \brief The current fast receive modem type. */
@@ -55,14 +55,14 @@ struct t38_non_ecm_buffer_state_s
uint8_t flow_control_fill_octet;
/*! \brief A code for the phase of input buffering, from initial all ones to completion. */
int input_phase;
/*! \brief TRUE is the end of non-ECM data indication has been received. */
int data_finished;
/*! \brief True is the end of non-ECM data indication has been received. */
bool data_finished;
/*! \brief The current octet being transmitted from the buffer. */
unsigned int octet;
/*! \brief The current bit number in the current non-ECM octet. */
int bit_no;
/*! \brief TRUE if in image data mode, as opposed to TCF mode. */
int image_data_mode;
/*! \brief True if in image data mode, as opposed to TCF mode. */
bool image_data_mode;
/*! \brief The number of octets input to the buffer. */
int in_octets;
@@ -46,9 +46,9 @@ typedef struct
/*! \brief The timed step to go to when we reach idle from the current timed step */
int queued_timed_step;
/*! \brief TRUE is there has been some T.38 data missed (i.e. lost packets) in the current
/*! \brief True is there has been some T.38 data missed (i.e. lost packets) in the current
reception period. */
int rx_data_missing;
bool rx_data_missing;
/*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
rate and the current specified packet interval. */
@@ -84,8 +84,8 @@ typedef struct
/*! \brief The current T.38 data type being transmitted. */
int current_tx_data_type;
/*! \brief TRUE if a carrier is present. Otherwise FALSE. */
int rx_signal_present;
/*! \brief True if a carrier is present. Otherwise false. */
bool rx_signal_present;
/*! \brief The current operating mode of the receiver. */
int current_rx_type;
@@ -81,8 +81,8 @@ struct t4_t6_decode_state_s
int run_length;
/*! \brief 2D horizontal mode control. */
int black_white;
/*! \brief TRUE if the current run is black */
int in_black;
/*! \brief True if the current run is black */
bool in_black;
/*! \brief The current step into the current row run-lengths buffer. */
int a_cursor;
@@ -59,7 +59,7 @@ struct t4_t6_encode_state_s
/*! \brief This variable is set if we are treating the current row as a 2D encoded
one. */
int row_is_2d;
bool row_is_2d;
/*! \brief Encoded data bits buffer. */
uint32_t tx_bitstream;
+3 -3
View File
@@ -124,10 +124,10 @@ struct t4_tx_state_s
/*! \brief The last page to transfer. -1 to continue to the end of the file. */
int stop_page;
/*! \brief TRUE for FAX page headers to overlay (i.e. replace) the beginning of the
page image. FALSE for FAX page headers to add to the overall length of
/*! \brief True for FAX page headers to overlay (i.e. replace) the beginning of the
page image. False for FAX page headers to add to the overall length of
the page. */
int header_overlays_image;
bool header_overlays_image;
/*! \brief The text which will be used in FAX page header. No text results
in no header line. */
const char *header_info;
+2 -2
View File
@@ -89,8 +89,8 @@ struct t85_encode_state_s
uint32_t c[128];
/*! New TX value, or <0 for analysis in progress */
int32_t new_tx;
/*! TRUE if previous row was typical */
int prev_ltp;
/*! True if previous row was typical */
bool prev_ltp;
/*! Pointers to the 3 row buffers */
uint8_t *prev_row[3];
/*! Pointer to a block of allocated memory 3 rows long, which
+2 -2
View File
@@ -54,8 +54,8 @@ struct tz_ttinfo_s
int32_t gmtoff; /* UTC offset in seconds */
int isdst; /* Used to set tm_isdst */
int abbrind; /* Abbreviation list index */
int ttisstd; /* TRUE if transition is std time */
int ttisgmt; /* TRUE if transition is UTC */
bool ttisstd; /* True if transition is std time */
bool ttisgmt; /* True if transition is UTC */
};
/* Leap second information */
+2 -2
View File
@@ -156,8 +156,8 @@ struct v17_rx_state_s
/*! \brief Scrambler tap */
int scrambler_tap;
/*! \brief TRUE if the short training sequence is to be used. */
int short_train;
/*! \brief True if the short training sequence is to be used. */
bool short_train;
/*! \brief The section of the training data we are currently in. */
int training_stage;
/*! \brief A count of how far through the current training step we are. */

Some files were not shown because too many files have changed in this diff Show More