mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-23 03:33:48 +00:00
Changed spandsp from using TRUE and FALSE to using C99 true and false. It seems
like the quirks we used to get using those with C++ have gone away.
This commit is contained in:
parent
bf9809c10c
commit
365fc08719
@ -187,6 +187,9 @@ AC_HEADER_TIME
|
|||||||
AC_CHECK_HEADERS([socket.h])
|
AC_CHECK_HEADERS([socket.h])
|
||||||
AC_CHECK_HEADERS([inttypes.h], [INSERT_INTTYPES_HEADER="#include <inttypes.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([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([unistd.h])
|
||||||
AC_CHECK_HEADERS([stdlib.h])
|
AC_CHECK_HEADERS([stdlib.h])
|
||||||
AC_CHECK_HEADERS([string.h])
|
AC_CHECK_HEADERS([string.h])
|
||||||
@ -592,6 +595,7 @@ AC_SUBST(INSERT_INTTYPES_HEADER)
|
|||||||
AC_SUBST(INSERT_STDINT_HEADER)
|
AC_SUBST(INSERT_STDINT_HEADER)
|
||||||
AC_SUBST(INSERT_TGMATH_HEADER)
|
AC_SUBST(INSERT_TGMATH_HEADER)
|
||||||
AC_SUBST(INSERT_MATH_HEADER)
|
AC_SUBST(INSERT_MATH_HEADER)
|
||||||
|
AC_SUBST(INSERT_STDBOOL_HEADER)
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
doc/Makefile
|
doc/Makefile
|
||||||
|
@ -224,6 +224,7 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \
|
|||||||
spandsp/queue.h \
|
spandsp/queue.h \
|
||||||
spandsp/saturated.h \
|
spandsp/saturated.h \
|
||||||
spandsp/schedule.h \
|
spandsp/schedule.h \
|
||||||
|
spandsp/stdbool.h \
|
||||||
spandsp/sig_tone.h \
|
spandsp/sig_tone.h \
|
||||||
spandsp/silence_gen.h \
|
spandsp/silence_gen.h \
|
||||||
spandsp/super_tone_rx.h \
|
spandsp/super_tone_rx.h \
|
||||||
|
@ -39,6 +39,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -448,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)] */
|
#define TONE_TO_TOTAL_ENERGY 45.2233f /* -0.85dB [GOERTZEL_SAMPLES_PER_BLOCK*10^(-0.85/10.0)] */
|
||||||
#endif
|
#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_1400_desc;
|
||||||
static goertzel_descriptor_t tone_2300_desc;
|
static goertzel_descriptor_t tone_2300_desc;
|
||||||
|
|
||||||
@ -794,7 +799,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_tx(ademco_contactid_sender_state_t *s,
|
|||||||
case 0:
|
case 0:
|
||||||
if (!s->clear_to_send)
|
if (!s->clear_to_send)
|
||||||
return 0;
|
return 0;
|
||||||
s->clear_to_send = FALSE;
|
s->clear_to_send = false;
|
||||||
s->step++;
|
s->step++;
|
||||||
s->remaining_samples = ms_to_samples(250);
|
s->remaining_samples = ms_to_samples(250);
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
@ -811,7 +816,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_tx(ademco_contactid_sender_state_t *s,
|
|||||||
samples = dtmf_tx(&s->dtmf, &[sample], max_samples - sample);
|
samples = dtmf_tx(&s->dtmf, &[sample], max_samples - sample);
|
||||||
if (samples == 0)
|
if (samples == 0)
|
||||||
{
|
{
|
||||||
s->clear_to_send = FALSE;
|
s->clear_to_send = false;
|
||||||
s->step = 0;
|
s->step = 0;
|
||||||
return sample;
|
return sample;
|
||||||
}
|
}
|
||||||
@ -948,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->callback(s->callback_user_data, -1, 0, 0);
|
||||||
s->tone_state = 4;
|
s->tone_state = 4;
|
||||||
/* Release the transmit side, and it will time the 250ms post tone delay */
|
/* 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;
|
s->tries = 0;
|
||||||
if (s->tx_digits_len)
|
if (s->tx_digits_len)
|
||||||
s->timer = ms_to_samples(3000);
|
s->timer = ms_to_samples(3000);
|
||||||
@ -969,7 +974,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
|
|||||||
case 5:
|
case 5:
|
||||||
if (hit == 0)
|
if (hit == 0)
|
||||||
{
|
{
|
||||||
s->busy = FALSE;
|
s->busy = false;
|
||||||
if (s->duration < ms_to_samples(400) || s->duration > ms_to_samples(1500))
|
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);
|
span_log(&s->logging, SPAN_LOG_FLOW, "Bad kissoff duration %d\n", s->duration);
|
||||||
@ -983,18 +988,18 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
|
|||||||
{
|
{
|
||||||
s->timer = 0;
|
s->timer = 0;
|
||||||
if (s->callback)
|
if (s->callback)
|
||||||
s->callback(s->callback_user_data, FALSE, 0, 0);
|
s->callback(s->callback_user_data, false, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
span_log(&s->logging, SPAN_LOG_FLOW, "Received good kissoff\n");
|
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;
|
s->tx_digits_len = 0;
|
||||||
if (s->callback)
|
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->tone_state = 4;
|
||||||
s->clear_to_send = TRUE;
|
s->clear_to_send = true;
|
||||||
s->tries = 0;
|
s->tries = 0;
|
||||||
if (s->tx_digits_len)
|
if (s->tx_digits_len)
|
||||||
s->timer = ms_to_samples(3000);
|
s->timer = ms_to_samples(3000);
|
||||||
@ -1024,7 +1029,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
|
|||||||
{
|
{
|
||||||
s->timer = 0;
|
s->timer = 0;
|
||||||
if (s->callback)
|
if (s->callback)
|
||||||
s->callback(s->callback_user_data, FALSE, 0, 0);
|
s->callback(s->callback_user_data, false, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1059,7 +1064,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_put(ademco_contactid_sender_state_t *s
|
|||||||
return -1;
|
return -1;
|
||||||
if ((s->tx_digits_len = encode_msg(s->tx_digits, report)) < 0)
|
if ((s->tx_digits_len = encode_msg(s->tx_digits, report)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
s->busy = TRUE;
|
s->busy = true;
|
||||||
return dtmf_tx_put(&s->dtmf, s->tx_digits, s->tx_digits_len);
|
return dtmf_tx_put(&s->dtmf, s->tx_digits, s->tx_digits_len);
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
@ -1096,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_1400_desc, 1400.0f, GOERTZEL_SAMPLES_PER_BLOCK);
|
||||||
make_goertzel_descriptor(&tone_2300_desc, 2300.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_1400, &tone_1400_desc);
|
||||||
goertzel_init(&s->tone_2300, &tone_2300_desc);
|
goertzel_init(&s->tone_2300, &tone_2300_desc);
|
||||||
|
@ -40,6 +40,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@ -64,6 +69,7 @@
|
|||||||
#include "spandsp/private/queue.h"
|
#include "spandsp/private/queue.h"
|
||||||
#include "spandsp/private/tone_generate.h"
|
#include "spandsp/private/tone_generate.h"
|
||||||
#include "spandsp/private/async.h"
|
#include "spandsp/private/async.h"
|
||||||
|
#include "spandsp/private/power_meter.h"
|
||||||
#include "spandsp/private/fsk.h"
|
#include "spandsp/private/fsk.h"
|
||||||
#include "spandsp/private/dtmf.h"
|
#include "spandsp/private/dtmf.h"
|
||||||
#include "spandsp/private/adsi.h"
|
#include "spandsp/private/adsi.h"
|
||||||
@ -151,7 +157,7 @@ static int adsi_tx_get_bit(void *user_data)
|
|||||||
if (s->tx_signal_on)
|
if (s->tx_signal_on)
|
||||||
{
|
{
|
||||||
/* The FSK should now be switched off. */
|
/* The FSK should now be switched off. */
|
||||||
s->tx_signal_on = FALSE;
|
s->tx_signal_on = false;
|
||||||
s->msg_len = 0;
|
s->msg_len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -170,7 +176,7 @@ static int adsi_tdd_get_async_byte(void *user_data)
|
|||||||
if (s->tx_signal_on)
|
if (s->tx_signal_on)
|
||||||
{
|
{
|
||||||
/* The FSK should now be switched off. */
|
/* The FSK should now be switched off. */
|
||||||
s->tx_signal_on = FALSE;
|
s->tx_signal_on = false;
|
||||||
s->msg_len = 0;
|
s->msg_len = 0;
|
||||||
}
|
}
|
||||||
return 0x1F;
|
return 0x1F;
|
||||||
@ -386,12 +392,12 @@ static void start_tx(adsi_tx_state_t *s)
|
|||||||
break;
|
break;
|
||||||
case ADSI_STANDARD_TDD:
|
case ADSI_STANDARD_TDD:
|
||||||
fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_WEITBRECHT_4545], async_tx_get_bit, &s->asynctx);
|
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 */
|
/* Schedule an explicit shift at the start of baudot transmission */
|
||||||
s->baudot_shift = 2;
|
s->baudot_shift = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s->tx_signal_on = TRUE;
|
s->tx_signal_on = true;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -489,7 +495,7 @@ SPAN_DECLARE(int) adsi_tx(adsi_tx_state_t *s, int16_t amp[], int max_len)
|
|||||||
if (len < max_len)
|
if (len < max_len)
|
||||||
{
|
{
|
||||||
if ((lenx = fsk_tx(&s->fsktx, amp + len, max_len - len)) <= 0)
|
if ((lenx = fsk_tx(&s->fsktx, amp + len, max_len - len)) <= 0)
|
||||||
s->tx_signal_on = FALSE;
|
s->tx_signal_on = false;
|
||||||
len += lenx;
|
len += lenx;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -672,7 +678,7 @@ SPAN_DECLARE(adsi_tx_state_t *) adsi_tx_init(adsi_tx_state_t *s, int standard)
|
|||||||
60,
|
60,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
FALSE);
|
false);
|
||||||
s->standard = standard;
|
s->standard = standard;
|
||||||
adsi_tx_set_preamble(s, -1, -1, -1, -1);
|
adsi_tx_set_preamble(s, -1, -1, -1, -1);
|
||||||
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
|
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
|
||||||
|
@ -33,7 +33,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#if !defined(__USE_ISOC11)
|
||||||
#define __USE_ISOC11
|
#define __USE_ISOC11
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#if defined(HAVE_MALLOC_H)
|
#if defined(HAVE_MALLOC_H)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
@ -48,26 +50,25 @@
|
|||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
#include "spandsp/alloc.h"
|
#include "spandsp/alloc.h"
|
||||||
|
|
||||||
static void *fake_aligned_alloc(size_t alignment, size_t size);
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4232) /* address of dllimport is not static, identity not guaranteed */
|
#pragma warning(disable:4232) /* address of dllimport is not static, identity not guaranteed */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
span_alloc_t __span_alloc = malloc;
|
|
||||||
#if defined(HAVE_ALIGNED_ALLOC)
|
#if defined(HAVE_ALIGNED_ALLOC)
|
||||||
span_aligned_alloc_t __span_aligned_alloc = aligned_alloc;
|
static span_aligned_alloc_t __span_aligned_alloc = aligned_alloc;
|
||||||
#elif defined(HAVE_MEMALIGN)
|
#elif defined(HAVE_MEMALIGN)
|
||||||
span_aligned_alloc_t __span_aligned_alloc = memalign;
|
static span_aligned_alloc_t __span_aligned_alloc = memalign;
|
||||||
#elif defined(HAVE_POSIX_MEMALIGN)
|
#elif defined(HAVE_POSIX_MEMALIGN)
|
||||||
static void *fake_posix_memalign(size_t alignment, size_t size);
|
static void *fake_posix_memalign(size_t alignment, size_t size);
|
||||||
span_aligned_alloc_t __span_aligned_alloc = fake_posix_memalign;
|
static span_aligned_alloc_t __span_aligned_alloc = fake_posix_memalign;
|
||||||
#else
|
#else
|
||||||
span_aligned_alloc_t __span_aligned_alloc = fake_aligned_alloc;
|
static void *fake_aligned_alloc(size_t alignment, size_t size);
|
||||||
|
static span_aligned_alloc_t __span_aligned_alloc = fake_aligned_alloc;
|
||||||
#endif
|
#endif
|
||||||
span_realloc_t __span_realloc = realloc;
|
static span_alloc_t __span_alloc = malloc;
|
||||||
span_free_t __span_free = free;
|
static span_realloc_t __span_realloc = realloc;
|
||||||
|
static span_free_t __span_free = free;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
@ -85,11 +86,17 @@ static void *fake_posix_memalign(size_t alignment, size_t size)
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
static void *fake_aligned_alloc(size_t alignment, size_t size)
|
static void *fake_aligned_alloc(size_t alignment, size_t size)
|
||||||
{
|
{
|
||||||
return NULL;
|
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 --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -99,12 +106,6 @@ SPAN_DECLARE(void *) span_alloc(size_t size)
|
|||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
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_realloc(void *ptr, size_t size)
|
SPAN_DECLARE(void *) span_realloc(void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
return __span_realloc(ptr, size);
|
return __span_realloc(ptr, size);
|
||||||
@ -117,20 +118,27 @@ SPAN_DECLARE(void) span_free(void *ptr)
|
|||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(int) span_mem_allocators(span_alloc_t custom_alloc,
|
SPAN_DECLARE(int) span_mem_allocators(span_aligned_alloc_t custom_aligned_alloc,
|
||||||
span_aligned_alloc_t custom_aligned_alloc,
|
span_alloc_t custom_alloc,
|
||||||
span_realloc_t custom_realloc,
|
span_realloc_t custom_realloc,
|
||||||
span_free_t custom_free)
|
span_free_t custom_free)
|
||||||
{
|
{
|
||||||
if (custom_alloc == NULL || custom_realloc == NULL || custom_free == NULL)
|
__span_aligned_alloc = (custom_aligned_alloc)
|
||||||
return -1;
|
?
|
||||||
__span_alloc = custom_alloc;
|
custom_aligned_alloc
|
||||||
if (custom_aligned_alloc)
|
:
|
||||||
__span_aligned_alloc = custom_aligned_alloc;
|
#if defined(HAVE_ALIGNED_ALLOC)
|
||||||
else
|
aligned_alloc;
|
||||||
__span_aligned_alloc = fake_aligned_alloc;
|
#elif defined(HAVE_MEMALIGN)
|
||||||
__span_realloc = custom_realloc;
|
memalign;
|
||||||
__span_free = custom_free;
|
#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;
|
return 0;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
@ -33,6 +33,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
#include "spandsp/alloc.h"
|
#include "spandsp/alloc.h"
|
||||||
@ -169,7 +174,7 @@ SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s,
|
|||||||
int data_bits,
|
int data_bits,
|
||||||
int parity,
|
int parity,
|
||||||
int stop_bits,
|
int stop_bits,
|
||||||
int use_v14,
|
bool use_v14,
|
||||||
put_byte_func_t put_byte,
|
put_byte_func_t put_byte,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
@ -269,7 +274,7 @@ SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s,
|
|||||||
int data_bits,
|
int data_bits,
|
||||||
int parity,
|
int parity,
|
||||||
int stop_bits,
|
int stop_bits,
|
||||||
int use_v14,
|
bool use_v14,
|
||||||
get_byte_func_t get_byte,
|
get_byte_func_t get_byte,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
@ -43,6 +43,11 @@
|
|||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
@ -78,20 +83,20 @@ static at_profile_t profiles[3] =
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER) || defined(__sunos) || defined(__solaris) || defined(__sun)
|
#if defined(_MSC_VER) || defined(__sunos) || defined(__solaris) || defined(__sun)
|
||||||
/*.echo =*/ TRUE,
|
/*.echo =*/ true,
|
||||||
/*.verbose =*/ TRUE,
|
/*.verbose =*/ true,
|
||||||
/*.result_code_format =*/ ASCII_RESULT_CODES,
|
/*.result_code_format =*/ ASCII_RESULT_CODES,
|
||||||
/*.pulse_dial =*/ FALSE,
|
/*.pulse_dial =*/ false,
|
||||||
/*.double_escape =*/ FALSE,
|
/*.double_escape =*/ false,
|
||||||
/*.adaptive_receive =*/ FALSE,
|
/*.adaptive_receive =*/ false,
|
||||||
/*.s_regs[100] =*/ {0, 0, 0, '\r', '\n', '\b', 1, 60, 5, 0, 0}
|
/*.s_regs[100] =*/ {0, 0, 0, '\r', '\n', '\b', 1, 60, 5, 0, 0}
|
||||||
#else
|
#else
|
||||||
.echo = TRUE,
|
.echo = true,
|
||||||
.verbose = TRUE,
|
.verbose = true,
|
||||||
.result_code_format = ASCII_RESULT_CODES,
|
.result_code_format = ASCII_RESULT_CODES,
|
||||||
.pulse_dial = FALSE,
|
.pulse_dial = false,
|
||||||
.double_escape = FALSE,
|
.double_escape = false,
|
||||||
.adaptive_receive = FALSE,
|
.adaptive_receive = false,
|
||||||
.s_regs[0] = 0,
|
.s_regs[0] = 0,
|
||||||
.s_regs[3] = '\r',
|
.s_regs[3] = '\r',
|
||||||
.s_regs[4] = '\n',
|
.s_regs[4] = '\n',
|
||||||
@ -256,11 +261,11 @@ SPAN_DECLARE(void) at_put_response_code(at_state_t *s, int code)
|
|||||||
static int answer_call(at_state_t *s)
|
static int answer_call(at_state_t *s)
|
||||||
{
|
{
|
||||||
if (at_modem_control(s, AT_MODEM_CONTROL_ANSWER, NULL) < 0)
|
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
|
/* Answering should now be in progress. No AT response should be
|
||||||
issued at this point. */
|
issued at this point. */
|
||||||
s->do_hangup = FALSE;
|
s->do_hangup = false;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -319,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);
|
at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_NOCNG_TONE_TX);
|
||||||
else
|
else
|
||||||
at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CNG_TONE_TX);
|
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;
|
break;
|
||||||
@ -343,13 +348,13 @@ SPAN_DECLARE(void) at_call_event(at_state_t *s, int event)
|
|||||||
if (s->ok_is_pending)
|
if (s->ok_is_pending)
|
||||||
{
|
{
|
||||||
at_put_response_code(s, AT_RESPONSE_CODE_OK);
|
at_put_response_code(s, AT_RESPONSE_CODE_OK);
|
||||||
s->ok_is_pending = FALSE;
|
s->ok_is_pending = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER);
|
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);
|
at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
|
||||||
}
|
}
|
||||||
else if (s->fclass_mode && s->rx_signal_present)
|
else if (s->fclass_mode && s->rx_signal_present)
|
||||||
@ -361,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)
|
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);
|
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_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0);
|
||||||
at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
|
at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
|
||||||
break;
|
break;
|
||||||
@ -384,7 +389,7 @@ SPAN_DECLARE(void) at_reset_call_info(at_state_t *s)
|
|||||||
}
|
}
|
||||||
s->call_id = NULL;
|
s->call_id = NULL;
|
||||||
s->rings_indicated = 0;
|
s->rings_indicated = 0;
|
||||||
s->call_info_displayed = FALSE;
|
s->call_info_displayed = false;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -431,7 +436,7 @@ SPAN_DECLARE(void) at_display_call_info(at_state_t *s)
|
|||||||
at_put_response(s, buf);
|
at_put_response(s, buf);
|
||||||
call_id = call_id->next;
|
call_id = call_id->next;
|
||||||
}
|
}
|
||||||
s->call_info_displayed = TRUE;
|
s->call_info_displayed = true;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -526,7 +531,7 @@ static int parse_out(at_state_t *s, const char **t, int *target, int max_value,
|
|||||||
default:
|
default:
|
||||||
/* Set value */
|
/* Set value */
|
||||||
if ((val = parse_num(t, max_value)) < 0)
|
if ((val = parse_num(t, max_value)) < 0)
|
||||||
return FALSE;
|
return false;
|
||||||
if (target)
|
if (target)
|
||||||
*target = val;
|
*target = val;
|
||||||
break;
|
break;
|
||||||
@ -539,9 +544,9 @@ static int parse_out(at_state_t *s, const char **t, int *target, int max_value,
|
|||||||
at_put_response(s, buf);
|
at_put_response(s, buf);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -565,14 +570,14 @@ static int parse_2_out(at_state_t *s, const char **t, int *target1, int max_valu
|
|||||||
default:
|
default:
|
||||||
/* Set value */
|
/* Set value */
|
||||||
if ((val1 = parse_num(t, max_value1)) < 0)
|
if ((val1 = parse_num(t, max_value1)) < 0)
|
||||||
return FALSE;
|
return false;
|
||||||
if (target1)
|
if (target1)
|
||||||
*target1 = val1;
|
*target1 = val1;
|
||||||
if (**t == ',')
|
if (**t == ',')
|
||||||
{
|
{
|
||||||
(*t)++;
|
(*t)++;
|
||||||
if ((val2 = parse_num(t, max_value2)) < 0)
|
if ((val2 = parse_num(t, max_value2)) < 0)
|
||||||
return FALSE;
|
return false;
|
||||||
if (target2)
|
if (target2)
|
||||||
*target2 = val2;
|
*target2 = val2;
|
||||||
}
|
}
|
||||||
@ -587,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);
|
at_put_response(s, buf);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -622,7 +627,7 @@ static int parse_n_out(at_state_t *s,
|
|||||||
for (i = 0; i < entries; i++)
|
for (i = 0; i < entries; i++)
|
||||||
{
|
{
|
||||||
if ((val = parse_num(t, max_values[i])) < 0)
|
if ((val = parse_num(t, max_values[i])) < 0)
|
||||||
return FALSE;
|
return false;
|
||||||
if (targets[i])
|
if (targets[i])
|
||||||
*targets[i] = val;
|
*targets[i] = val;
|
||||||
if (**t != ',')
|
if (**t != ',')
|
||||||
@ -645,9 +650,9 @@ static int parse_n_out(at_state_t *s,
|
|||||||
at_put_response(s, buf);
|
at_put_response(s, buf);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -670,7 +675,7 @@ static int parse_hex_out(at_state_t *s, const char **t, int *target, int max_val
|
|||||||
default:
|
default:
|
||||||
/* Set value */
|
/* Set value */
|
||||||
if ((val = parse_hex_num(t, max_value)) < 0)
|
if ((val = parse_hex_num(t, max_value)) < 0)
|
||||||
return FALSE;
|
return false;
|
||||||
if (target)
|
if (target)
|
||||||
*target = val;
|
*target = val;
|
||||||
break;
|
break;
|
||||||
@ -683,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);
|
at_put_response(s, buf);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -710,7 +715,7 @@ static int parse_string_list_out(at_state_t *s, const char **t, int *target, int
|
|||||||
default:
|
default:
|
||||||
/* Set value */
|
/* Set value */
|
||||||
if ((val = match_element(t, def)) < 0)
|
if ((val = match_element(t, def)) < 0)
|
||||||
return FALSE;
|
return false;
|
||||||
if (target)
|
if (target)
|
||||||
*target = val;
|
*target = val;
|
||||||
break;
|
break;
|
||||||
@ -729,9 +734,9 @@ static int parse_string_list_out(at_state_t *s, const char **t, int *target, int
|
|||||||
at_put_response(s, buf);
|
at_put_response(s, buf);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -764,11 +769,11 @@ static int parse_string_out(at_state_t *s, const char **t, char **target, const
|
|||||||
at_put_response(s, (*target) ? *target : "");
|
at_put_response(s, (*target) ? *target : "");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
while (*t)
|
while (*t)
|
||||||
t++;
|
t++;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -863,18 +868,18 @@ static int process_class1_cmd(at_state_t *s, const char **t)
|
|||||||
|
|
||||||
val = -1;
|
val = -1;
|
||||||
if (!parse_out(s, t, &val, 255, NULL, allowed))
|
if (!parse_out(s, t, &val, 255, NULL, allowed))
|
||||||
return TRUE;
|
return true;
|
||||||
if (val < 0)
|
if (val < 0)
|
||||||
{
|
{
|
||||||
/* It was just a query */
|
/* It was just a query */
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
/* All class 1 FAX commands are supposed to give an ERROR response, if the phone
|
/* All class 1 FAX commands are supposed to give an ERROR response, if the phone
|
||||||
is on-hook. */
|
is on-hook. */
|
||||||
if (s->at_rx_mode == AT_MODE_ONHOOK_COMMAND)
|
if (s->at_rx_mode == AT_MODE_ONHOOK_COMMAND)
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
result = TRUE;
|
result = true;
|
||||||
if (s->class1_handler)
|
if (s->class1_handler)
|
||||||
result = s->class1_handler(s, s->class1_user_data, direction, operation, val);
|
result = s->class1_handler(s, s->class1_user_data, direction, operation, val);
|
||||||
switch (result)
|
switch (result)
|
||||||
@ -882,11 +887,11 @@ static int process_class1_cmd(at_state_t *s, const char **t)
|
|||||||
case 0:
|
case 0:
|
||||||
/* Inhibit an immediate response. (These commands should not be part of a multi-command entry.) */
|
/* Inhibit an immediate response. (These commands should not be part of a multi-command entry.) */
|
||||||
*t = (const char *) -1;
|
*t = (const char *) -1;
|
||||||
return TRUE;
|
return true;
|
||||||
case -1:
|
case -1:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -916,11 +921,11 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
|
|||||||
|
|
||||||
/* V.250 6.3.1 - Dial (abortable) */
|
/* V.250 6.3.1 - Dial (abortable) */
|
||||||
at_reset_call_info(s);
|
at_reset_call_info(s);
|
||||||
s->do_hangup = FALSE;
|
s->do_hangup = false;
|
||||||
s->silent_dial = FALSE;
|
s->silent_dial = false;
|
||||||
s->command_dial = FALSE;
|
s->command_dial = false;
|
||||||
t += 1;
|
t += 1;
|
||||||
ok = FALSE;
|
ok = false;
|
||||||
/* There are a numbers of options in a dial command string.
|
/* There are a numbers of options in a dial command string.
|
||||||
Many are completely irrelevant in this application. */
|
Many are completely irrelevant in this application. */
|
||||||
u = num;
|
u = num;
|
||||||
@ -962,11 +967,11 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
|
|||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
/* V.250 6.3.1.3 Tone dial */
|
/* V.250 6.3.1.3 Tone dial */
|
||||||
s->p.pulse_dial = FALSE;
|
s->p.pulse_dial = false;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/* V.250 6.3.1.4 Pulse dial */
|
/* V.250 6.3.1.4 Pulse dial */
|
||||||
s->p.pulse_dial = TRUE;
|
s->p.pulse_dial = true;
|
||||||
break;
|
break;
|
||||||
case '!':
|
case '!':
|
||||||
/* V.250 6.3.1.5 Hook flash, register recall */
|
/* V.250 6.3.1.5 Hook flash, register recall */
|
||||||
@ -978,7 +983,7 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
|
|||||||
break;
|
break;
|
||||||
case '@':
|
case '@':
|
||||||
/* V.250 6.3.1.7 Wait for quiet answer */
|
/* V.250 6.3.1.7 Wait for quiet answer */
|
||||||
s->silent_dial = TRUE;
|
s->silent_dial = true;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
/* V.250 6.3.1.8 Invoke stored string */
|
/* V.250 6.3.1.8 Invoke stored string */
|
||||||
@ -999,7 +1004,7 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
|
|||||||
break;
|
break;
|
||||||
case ';':
|
case ';':
|
||||||
/* V.250 6.3.1 - Dial string terminator - make voice call and remain in command mode */
|
/* 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;
|
break;
|
||||||
case '>':
|
case '>':
|
||||||
/* GSM07.07 6.2 - Direct dialling from phone book supplementary service subscription
|
/* GSM07.07 6.2 - Direct dialling from phone book supplementary service subscription
|
||||||
@ -1055,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). */
|
/* 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);
|
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);
|
at_set_at_rx_mode(s, AT_MODE_CONNECTED);
|
||||||
return (const char *) -1;
|
return (const char *) -1;
|
||||||
}
|
}
|
||||||
@ -1138,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) */
|
/* V.250 6.3.3 - Select pulse dialling (command) */
|
||||||
t += 1;
|
t += 1;
|
||||||
s->p.pulse_dial = TRUE;
|
s->p.pulse_dial = true;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
@ -1232,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) */
|
/* V.250 6.3.2 - Select tone dialling (command) */
|
||||||
t += 1;
|
t += 1;
|
||||||
s->p.pulse_dial = FALSE;
|
s->p.pulse_dial = false;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
@ -40,6 +40,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
@ -78,10 +83,10 @@ typedef struct
|
|||||||
uint8_t off_time; /* Minimum post tone silence (ms) */
|
uint8_t off_time; /* Minimum post tone silence (ms) */
|
||||||
} mf_digit_tones_t;
|
} 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];
|
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_fwd_digit_tones[15];
|
||||||
tone_gen_descriptor_t r2_mf_back_digit_tones[15];
|
tone_gen_descriptor_t r2_mf_back_digit_tones[15];
|
||||||
|
|
||||||
@ -271,10 +276,10 @@ static void bell_mf_gen_init(void)
|
|||||||
tones->off_time,
|
tones->off_time,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
FALSE);
|
false);
|
||||||
tones++;
|
tones++;
|
||||||
}
|
}
|
||||||
bell_mf_gen_inited = TRUE;
|
bell_mf_gen_inited = true;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -391,7 +396,7 @@ SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit)
|
|||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- 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;
|
int i;
|
||||||
const mf_digit_tones_t *tones;
|
const mf_digit_tones_t *tones;
|
||||||
@ -437,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->off_time == 0));
|
||||||
tones++;
|
tones++;
|
||||||
}
|
}
|
||||||
r2_mf_gen_inited = TRUE;
|
r2_mf_gen_inited = true;
|
||||||
}
|
}
|
||||||
s->fwd = fwd;
|
s->fwd = fwd;
|
||||||
return s;
|
return s;
|
||||||
@ -630,7 +635,7 @@ SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s,
|
|||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static int initialised = FALSE;
|
static int initialised = false;
|
||||||
|
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
{
|
{
|
||||||
@ -643,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++)
|
for (i = 0; i < 6; i++)
|
||||||
make_goertzel_descriptor(&bell_mf_detect_desc[i], (float) bell_mf_frequencies[i], BELL_MF_SAMPLES_PER_BLOCK);
|
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 = callback;
|
||||||
s->digits_callback_data = user_data;
|
s->digits_callback_data = user_data;
|
||||||
@ -746,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 */
|
/* Basic signal level and twist tests */
|
||||||
hit = FALSE;
|
hit = false;
|
||||||
if (energy[best] >= R2_MF_THRESHOLD
|
if (energy[best] >= R2_MF_THRESHOLD
|
||||||
&&
|
&&
|
||||||
energy[second_best] >= R2_MF_THRESHOLD
|
energy[second_best] >= R2_MF_THRESHOLD
|
||||||
@ -756,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])
|
energy[best]*R2_MF_TWIST > energy[second_best])
|
||||||
{
|
{
|
||||||
/* Relative peak test */
|
/* Relative peak test */
|
||||||
hit = TRUE;
|
hit = true;
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
if (i != best && i != second_best)
|
if (i != best && i != second_best)
|
||||||
@ -764,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])
|
if (energy[i]*R2_MF_RELATIVE_PEAK >= energy[second_best])
|
||||||
{
|
{
|
||||||
/* The best two are not clearly the best */
|
/* The best two are not clearly the best */
|
||||||
hit = FALSE;
|
hit = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -805,12 +810,12 @@ SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s)
|
|||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
|
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,
|
tone_report_func_t callback,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static int initialised = FALSE;
|
static int initialised = false;
|
||||||
|
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
{
|
{
|
||||||
@ -828,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_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);
|
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)
|
if (fwd)
|
||||||
{
|
{
|
||||||
|
@ -33,6 +33,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <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/telephony.h"
|
||||||
#include "spandsp/alloc.h"
|
#include "spandsp/alloc.h"
|
||||||
@ -137,14 +142,14 @@ static void assess_error_rate(bert_state_t *s)
|
|||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
int sum;
|
int sum;
|
||||||
int test;
|
bool test;
|
||||||
|
|
||||||
/* We assess the error rate in decadic steps. For each decade we assess the error over 10 times
|
/* 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
|
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
|
(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
|
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. */
|
so on for the lower error rates. */
|
||||||
test = TRUE;
|
test = false;
|
||||||
for (i = 2; i <= 7; i++)
|
for (i = 2; i <= 7; i++)
|
||||||
{
|
{
|
||||||
if (++s->decade_ptr[i] < 10)
|
if (++s->decade_ptr[i] < 10)
|
||||||
@ -157,7 +162,7 @@ static void assess_error_rate(bert_state_t *s)
|
|||||||
if (test && sum > 10)
|
if (test && sum > 10)
|
||||||
{
|
{
|
||||||
/* We overflow into the next decade */
|
/* We overflow into the next decade */
|
||||||
test = FALSE;
|
test = false;
|
||||||
if (s->error_rate != i && s->reporter)
|
if (s->error_rate != i && s->reporter)
|
||||||
s->reporter(s->user_data, BERT_REPORT_GT_10_2 + i - 2, &s->results);
|
s->reporter(s->user_data, BERT_REPORT_GT_10_2 + i - 2, &s->results);
|
||||||
s->error_rate = i;
|
s->error_rate = i;
|
||||||
|
@ -33,6 +33,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
#include "spandsp/alloc.h"
|
#include "spandsp/alloc.h"
|
||||||
|
@ -39,6 +39,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
|
@ -39,6 +39,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
|
@ -32,6 +32,11 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
#include "spandsp/crc.h"
|
#include "spandsp/crc.h"
|
||||||
@ -102,7 +107,7 @@ SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len)
|
|||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- 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;
|
uint32_t crc;
|
||||||
int i;
|
int i;
|
||||||
@ -193,7 +198,7 @@ SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len)
|
|||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- 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;
|
uint16_t crc;
|
||||||
int i;
|
int i;
|
||||||
|
@ -31,16 +31,21 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <memory.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <limits.h>
|
||||||
#if defined(HAVE_TGMATH_H)
|
#if defined(HAVE_TGMATH_H)
|
||||||
#include <tgmath.h>
|
#include <tgmath.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <memory.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
#include "spandsp/alloc.h"
|
#include "spandsp/alloc.h"
|
||||||
@ -94,11 +99,11 @@ static const float dtmf_col[] =
|
|||||||
|
|
||||||
static const char dtmf_positions[] = "123A" "456B" "789C" "*0#D";
|
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_row[4];
|
||||||
static goertzel_descriptor_t dtmf_detect_col[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];
|
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)
|
SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples)
|
||||||
@ -424,7 +429,7 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
|
|||||||
s->digits_callback_data = user_data;
|
s->digits_callback_data = user_data;
|
||||||
s->realtime_callback = NULL;
|
s->realtime_callback = NULL;
|
||||||
s->realtime_callback_data = NULL;
|
s->realtime_callback_data = NULL;
|
||||||
s->filter_dialtone = FALSE;
|
s->filter_dialtone = false;
|
||||||
s->normal_twist = DTMF_NORMAL_TWIST;
|
s->normal_twist = DTMF_NORMAL_TWIST;
|
||||||
s->reverse_twist = DTMF_REVERSE_TWIST;
|
s->reverse_twist = DTMF_REVERSE_TWIST;
|
||||||
s->threshold = DTMF_THRESHOLD;
|
s->threshold = DTMF_THRESHOLD;
|
||||||
@ -439,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_row[i], dtmf_row[i], DTMF_SAMPLES_PER_BLOCK);
|
||||||
make_goertzel_descriptor(&dtmf_detect_col[i], dtmf_col[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++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
@ -492,10 +497,10 @@ static void dtmf_tx_initialise(void)
|
|||||||
DEFAULT_DTMF_TX_OFF_TIME,
|
DEFAULT_DTMF_TX_OFF_TIME,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
FALSE);
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dtmf_tx_inited = TRUE;
|
dtmf_tx_inited = true;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -88,6 +88,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -106,12 +111,6 @@
|
|||||||
#if !defined(NULL)
|
#if !defined(NULL)
|
||||||
#define NULL (void *) 0
|
#define NULL (void *) 0
|
||||||
#endif
|
#endif
|
||||||
#if !defined(FALSE)
|
|
||||||
#define FALSE 0
|
|
||||||
#endif
|
|
||||||
#if !defined(TRUE)
|
|
||||||
#define TRUE (!FALSE)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */
|
#define NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */
|
||||||
|
|
||||||
@ -275,7 +274,7 @@ SPAN_DECLARE(echo_can_state_t *) echo_can_init(int len, int adaption_mode)
|
|||||||
ec->rx_power_threshold = 10000000;
|
ec->rx_power_threshold = 10000000;
|
||||||
ec->geigel_max = 0;
|
ec->geigel_max = 0;
|
||||||
ec->geigel_lag = 0;
|
ec->geigel_lag = 0;
|
||||||
ec->dtd_onset = FALSE;
|
ec->dtd_onset = false;
|
||||||
ec->tap_set = 0;
|
ec->tap_set = 0;
|
||||||
ec->tap_rotate_counter = 1600;
|
ec->tap_rotate_counter = 1600;
|
||||||
ec->cng_level = 1000;
|
ec->cng_level = 1000;
|
||||||
@ -338,7 +337,7 @@ SPAN_DECLARE(void) echo_can_flush(echo_can_state_t *ec)
|
|||||||
|
|
||||||
ec->geigel_max = 0;
|
ec->geigel_max = 0;
|
||||||
ec->geigel_lag = 0;
|
ec->geigel_lag = 0;
|
||||||
ec->dtd_onset = FALSE;
|
ec->dtd_onset = false;
|
||||||
ec->tap_set = 0;
|
ec->tap_set = 0;
|
||||||
ec->tap_rotate_counter = 1600;
|
ec->tap_rotate_counter = 1600;
|
||||||
|
|
||||||
@ -486,7 +485,7 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
|
|||||||
ec->narrowband_score = 0;
|
ec->narrowband_score = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ec->dtd_onset = FALSE;
|
ec->dtd_onset = false;
|
||||||
if (--ec->tap_rotate_counter <= 0)
|
if (--ec->tap_rotate_counter <= 0)
|
||||||
{
|
{
|
||||||
printf("Rotate to %d at %d\n", ec->tap_set, sample_no);
|
printf("Rotate to %d at %d\n", ec->tap_set, sample_no);
|
||||||
@ -533,7 +532,7 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
|
|||||||
for (i = 0; i < ec->taps; i++)
|
for (i = 0; i < ec->taps; i++)
|
||||||
ec->fir_taps32[i] = ec->fir_taps16[(ec->tap_set + 1)%3][i] << 15;
|
ec->fir_taps32[i] = ec->fir_taps16[(ec->tap_set + 1)%3][i] << 15;
|
||||||
ec->tap_rotate_counter = 1600;
|
ec->tap_rotate_counter = 1600;
|
||||||
ec->dtd_onset = TRUE;
|
ec->dtd_onset = true;
|
||||||
}
|
}
|
||||||
ec->nonupdate_dwell = NONUPDATE_DWELL_TIME;
|
ec->nonupdate_dwell = NONUPDATE_DWELL_TIME;
|
||||||
}
|
}
|
||||||
@ -576,7 +575,7 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
|
|||||||
if (!ec->cng)
|
if (!ec->cng)
|
||||||
{
|
{
|
||||||
ec->cng_level = ec->clean_rx_power;
|
ec->cng_level = ec->clean_rx_power;
|
||||||
ec->cng = TRUE;
|
ec->cng = true;
|
||||||
}
|
}
|
||||||
if ((ec->adaption_mode & ECHO_CAN_USE_CNG))
|
if ((ec->adaption_mode & ECHO_CAN_USE_CNG))
|
||||||
{
|
{
|
||||||
@ -595,12 +594,12 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ec->cng = FALSE;
|
ec->cng = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ec->cng = FALSE;
|
ec->cng = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Narrowband score %4d %5d at %d\n", ec->narrowband_score, score, sample_no);
|
printf("Narrowband score %4d %5d at %d\n", ec->narrowband_score, score, sample_no);
|
||||||
|
@ -40,6 +40,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -96,6 +101,7 @@
|
|||||||
|
|
||||||
#include "spandsp/private/logging.h"
|
#include "spandsp/private/logging.h"
|
||||||
#include "spandsp/private/silence_gen.h"
|
#include "spandsp/private/silence_gen.h"
|
||||||
|
#include "spandsp/private/power_meter.h"
|
||||||
#include "spandsp/private/fsk.h"
|
#include "spandsp/private/fsk.h"
|
||||||
#include "spandsp/private/modem_connect_tones.h"
|
#include "spandsp/private/modem_connect_tones.h"
|
||||||
#include "spandsp/private/v8.h"
|
#include "spandsp/private/v8.h"
|
||||||
@ -210,7 +216,7 @@ static int set_next_tx_type(fax_state_t *s)
|
|||||||
silence_gen_alter(&t->silence_gen, 0);
|
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_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);
|
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
|
||||||
t->transmit = FALSE;
|
t->transmit = false;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
@ -277,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->current_rx_type = type;
|
||||||
t->rx_bit_rate = bit_rate;
|
t->rx_bit_rate = bit_rate;
|
||||||
if (use_hdlc)
|
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)
|
switch (type)
|
||||||
{
|
{
|
||||||
@ -320,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));
|
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_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);
|
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
|
||||||
t->transmit = TRUE;
|
t->transmit = true;
|
||||||
break;
|
break;
|
||||||
case T30_MODEM_CED:
|
case T30_MODEM_CED:
|
||||||
case T30_MODEM_CNG:
|
case T30_MODEM_CNG:
|
||||||
tone = (type == T30_MODEM_CED) ? FAX_MODEM_CED_TONE_TX : FAX_MODEM_CNG_TONE_TX;
|
tone = (type == T30_MODEM_CED) ? FAX_MODEM_CED_TONE_TX : FAX_MODEM_CNG_TONE_TX;
|
||||||
fax_modems_start_slow_modem(t, tone);
|
fax_modems_start_slow_modem(t, tone);
|
||||||
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
|
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
|
||||||
t->transmit = TRUE;
|
t->transmit = true;
|
||||||
break;
|
break;
|
||||||
case T30_MODEM_V21:
|
case T30_MODEM_V21:
|
||||||
fax_modems_start_slow_modem(t, FAX_MODEM_V21_TX);
|
fax_modems_start_slow_modem(t, FAX_MODEM_V21_TX);
|
||||||
@ -340,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));
|
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_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);
|
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &fsk_tx, &t->v21_tx);
|
||||||
t->transmit = TRUE;
|
t->transmit = true;
|
||||||
break;
|
break;
|
||||||
case T30_MODEM_V17:
|
case T30_MODEM_V17:
|
||||||
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
|
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
|
||||||
@ -349,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_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_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);
|
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;
|
break;
|
||||||
case T30_MODEM_V27TER:
|
case T30_MODEM_V27TER:
|
||||||
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
|
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
|
||||||
@ -358,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_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_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);
|
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;
|
break;
|
||||||
case T30_MODEM_V29:
|
case T30_MODEM_V29:
|
||||||
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
|
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
|
||||||
@ -367,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_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_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);
|
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;
|
break;
|
||||||
case T30_MODEM_DONE:
|
case T30_MODEM_DONE:
|
||||||
span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n");
|
span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n");
|
||||||
@ -376,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);
|
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_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);
|
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
|
||||||
t->transmit = FALSE;
|
t->transmit = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
t->tx_bit_rate = bit_rate;
|
t->tx_bit_rate = bit_rate;
|
||||||
@ -478,7 +484,7 @@ SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party)
|
|||||||
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
|
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
|
||||||
span_log_set_protocol(&s->logging, "FAX");
|
span_log_set_protocol(&s->logging, "FAX");
|
||||||
fax_modems_init(&s->modems,
|
fax_modems_init(&s->modems,
|
||||||
FALSE,
|
false,
|
||||||
t30_hdlc_accept,
|
t30_hdlc_accept,
|
||||||
hdlc_underflow_handler,
|
hdlc_underflow_handler,
|
||||||
t30_non_ecm_put_bit,
|
t30_non_ecm_put_bit,
|
||||||
|
@ -39,6 +39,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -74,6 +79,7 @@
|
|||||||
|
|
||||||
#include "spandsp/private/logging.h"
|
#include "spandsp/private/logging.h"
|
||||||
#include "spandsp/private/silence_gen.h"
|
#include "spandsp/private/silence_gen.h"
|
||||||
|
#include "spandsp/private/power_meter.h"
|
||||||
#include "spandsp/private/fsk.h"
|
#include "spandsp/private/fsk.h"
|
||||||
#include "spandsp/private/v17tx.h"
|
#include "spandsp/private/v17tx.h"
|
||||||
#include "spandsp/private/v17rx.h"
|
#include "spandsp/private/v17rx.h"
|
||||||
@ -93,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;
|
s = (fax_modems_state_t *) user_data;
|
||||||
if (ok)
|
if (ok)
|
||||||
s->rx_frame_received = TRUE;
|
s->rx_frame_received = false;
|
||||||
if (s->hdlc_accept)
|
if (s->hdlc_accept)
|
||||||
s->hdlc_accept(s->hdlc_accept_user_data, msg, len, ok);
|
s->hdlc_accept(s->hdlc_accept_user_data, msg, len, ok);
|
||||||
}
|
}
|
||||||
@ -264,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);
|
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);
|
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);
|
fsk_rx_signal_cutoff(&s->v21_rx, -39.09f);
|
||||||
s->rx_frame_received = FALSE;
|
s->rx_frame_received = false;
|
||||||
break;
|
break;
|
||||||
case FAX_MODEM_CED_TONE_RX:
|
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);
|
modem_connect_tones_rx_init(&s->connect_rx, MODEM_CONNECT_TONES_FAX_CED, s->tone_callback, s->tone_callback_user_data);
|
||||||
@ -322,10 +328,10 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
|
|||||||
if (s->fast_modem != which)
|
if (s->fast_modem != which)
|
||||||
{
|
{
|
||||||
s->current_rx_type = which;
|
s->current_rx_type = which;
|
||||||
s->short_train = FALSE;
|
s->short_train = false;
|
||||||
s->fast_modem = which;
|
s->fast_modem = which;
|
||||||
if (hdlc_mode)
|
if (hdlc_mode)
|
||||||
s->rx_frame_received = FALSE;
|
s->rx_frame_received = false;
|
||||||
switch (s->fast_modem)
|
switch (s->fast_modem)
|
||||||
{
|
{
|
||||||
case FAX_MODEM_V27TER_RX:
|
case FAX_MODEM_V27TER_RX:
|
||||||
@ -368,13 +374,13 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
|
|||||||
switch (s->fast_modem)
|
switch (s->fast_modem)
|
||||||
{
|
{
|
||||||
case FAX_MODEM_V27TER_RX:
|
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_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);
|
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);
|
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;
|
break;
|
||||||
case FAX_MODEM_V29_RX:
|
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_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);
|
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);
|
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);
|
||||||
@ -535,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 = hdlc_accept;
|
||||||
s->hdlc_accept_user_data = user_data;
|
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_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_tx_init(&s->hdlc_tx, false, 2, false, hdlc_tx_underflow, user_data);
|
||||||
|
|
||||||
fax_modems_start_slow_modem(s, FAX_MODEM_V21_RX);
|
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);
|
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);
|
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_handler = (span_rx_handler_t) &span_dummy_rx;
|
||||||
s->rx_fillin_handler = (span_rx_fillin_handler_t) &span_dummy_rx;
|
s->rx_fillin_handler = (span_rx_fillin_handler_t) &span_dummy_rx;
|
||||||
s->rx_user_data = NULL;
|
s->rx_user_data = NULL;
|
||||||
|
@ -32,29 +32,27 @@
|
|||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#if defined(HAVE_TGMATH_H)
|
#if defined(HAVE_TGMATH_H)
|
||||||
#include <tgmath.h>
|
#include <tgmath.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
#include "spandsp/complex.h"
|
#include "spandsp/complex.h"
|
||||||
#include "filter_tools.h"
|
#include "filter_tools.h"
|
||||||
|
|
||||||
#if !defined(FALSE)
|
|
||||||
#define FALSE 0
|
|
||||||
#endif
|
|
||||||
#if !defined(TRUE)
|
|
||||||
#define TRUE (!FALSE)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAXPZ 8192
|
#define MAXPZ 8192
|
||||||
#define SEQ_LEN 8192
|
#define SEQ_LEN 8192
|
||||||
#define MAX_FFT_LEN SEQ_LEN
|
#define MAX_FFT_LEN SEQ_LEN
|
||||||
|
@ -38,6 +38,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@ -49,6 +54,7 @@
|
|||||||
#include "spandsp/async.h"
|
#include "spandsp/async.h"
|
||||||
#include "spandsp/fsk.h"
|
#include "spandsp/fsk.h"
|
||||||
|
|
||||||
|
#include "spandsp/private/power_meter.h"
|
||||||
#include "spandsp/private/fsk.h"
|
#include "spandsp/private/fsk.h"
|
||||||
|
|
||||||
const fsk_spec_t preset_fsk_specs[] =
|
const fsk_spec_t preset_fsk_specs[] =
|
||||||
@ -155,7 +161,7 @@ SPAN_DECLARE(int) fsk_tx_restart(fsk_tx_state_t *s, const fsk_spec_t *spec)
|
|||||||
s->baud_frac = 0;
|
s->baud_frac = 0;
|
||||||
s->current_phase_rate = s->phase_rates[1];
|
s->current_phase_rate = s->phase_rates[1];
|
||||||
|
|
||||||
s->shutdown = FALSE;
|
s->shutdown = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
@ -214,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);
|
s->status_handler(s->status_user_data, SIG_STATUS_END_OF_DATA);
|
||||||
if (s->status_handler)
|
if (s->status_handler)
|
||||||
s->status_handler(s->status_user_data, SIG_STATUS_SHUTDOWN_COMPLETE);
|
s->status_handler(s->status_user_data, SIG_STATUS_SHUTDOWN_COMPLETE);
|
||||||
s->shutdown = TRUE;
|
s->shutdown = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s->current_phase_rate = s->phase_rates[bit & 1];
|
s->current_phase_rate = s->phase_rates[bit & 1];
|
||||||
|
@ -38,6 +38,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
@ -263,11 +268,11 @@ SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int
|
|||||||
else
|
else
|
||||||
s->bits_per_sample = 8;
|
s->bits_per_sample = 8;
|
||||||
if ((options & G722_SAMPLE_RATE_8000))
|
if ((options & G722_SAMPLE_RATE_8000))
|
||||||
s->eight_k = TRUE;
|
s->eight_k = true;
|
||||||
if ((options & G722_PACKED) && s->bits_per_sample != 8)
|
if ((options & G722_PACKED) && s->bits_per_sample != 8)
|
||||||
s->packed = TRUE;
|
s->packed = true;
|
||||||
else
|
else
|
||||||
s->packed = FALSE;
|
s->packed = false;
|
||||||
s->band[0].det = 32;
|
s->band[0].det = 32;
|
||||||
s->band[1].det = 8;
|
s->band[1].det = 8;
|
||||||
return s;
|
return s;
|
||||||
@ -444,11 +449,11 @@ SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int
|
|||||||
else
|
else
|
||||||
s->bits_per_sample = 8;
|
s->bits_per_sample = 8;
|
||||||
if ((options & G722_SAMPLE_RATE_8000))
|
if ((options & G722_SAMPLE_RATE_8000))
|
||||||
s->eight_k = TRUE;
|
s->eight_k = true;
|
||||||
if ((options & G722_PACKED) && s->bits_per_sample != 8)
|
if ((options & G722_PACKED) && s->bits_per_sample != 8)
|
||||||
s->packed = TRUE;
|
s->packed = true;
|
||||||
else
|
else
|
||||||
s->packed = FALSE;
|
s->packed = false;
|
||||||
s->band[0].det = 32;
|
s->band[0].det = 32;
|
||||||
s->band[1].det = 8;
|
s->band[1].det = 8;
|
||||||
return s;
|
return s;
|
||||||
|
@ -64,6 +64,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
@ -394,7 +399,7 @@ static void update(g726_state_t *s,
|
|||||||
int16_t thr;
|
int16_t thr;
|
||||||
int16_t pk0;
|
int16_t pk0;
|
||||||
int i;
|
int i;
|
||||||
int tr;
|
bool tr;
|
||||||
|
|
||||||
a2p = 0;
|
a2p = 0;
|
||||||
/* Needed in updating predictor poles */
|
/* Needed in updating predictor poles */
|
||||||
@ -409,11 +414,11 @@ static void update(g726_state_t *s,
|
|||||||
thr = (ylint > 9) ? (31 << 10) : ((32 + ylfrac) << ylint);
|
thr = (ylint > 9) ? (31 << 10) : ((32 + ylfrac) << ylint);
|
||||||
dqthr = (thr + (thr >> 1)) >> 1; /* dqthr = 0.75 * thr */
|
dqthr = (thr + (thr >> 1)) >> 1; /* dqthr = 0.75 * thr */
|
||||||
if (!s->td) /* signal supposed voice */
|
if (!s->td) /* signal supposed voice */
|
||||||
tr = FALSE;
|
tr = false;
|
||||||
else if (mag <= dqthr) /* supposed data, but small mag */
|
else if (mag <= dqthr) /* supposed data, but small mag */
|
||||||
tr = FALSE; /* treated as voice */
|
tr = false; /* treated as voice */
|
||||||
else /* signal is data (modem) */
|
else /* signal is data (modem) */
|
||||||
tr = TRUE;
|
tr = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Quantizer scale factor adaptation.
|
* Quantizer scale factor adaptation.
|
||||||
@ -564,11 +569,11 @@ static void update(g726_state_t *s,
|
|||||||
|
|
||||||
/* TONE */
|
/* TONE */
|
||||||
if (tr) /* this sample has been treated as data */
|
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 */
|
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 */
|
else /* signal is voice */
|
||||||
s->td = FALSE;
|
s->td = false;
|
||||||
|
|
||||||
/* Adaptation speed control. */
|
/* Adaptation speed control. */
|
||||||
/* FILTA */
|
/* FILTA */
|
||||||
@ -1025,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->b[i] = 0;
|
||||||
s->dq[i] = 32;
|
s->dq[i] = 32;
|
||||||
}
|
}
|
||||||
s->td = FALSE;
|
s->td = false;
|
||||||
switch (bit_rate)
|
switch (bit_rate)
|
||||||
{
|
{
|
||||||
case 16000:
|
case 16000:
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
static void weighting_filter(int16_t x[40],
|
static void weighting_filter(int16_t x[40],
|
||||||
const int16_t *e) // signal [-5..0.39.44] IN)
|
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 */
|
/* Table 4.4 Coefficients of the weighting filter */
|
||||||
/* This must be padded to a multiple of 4 for MMX to work */
|
/* This must be padded to a multiple of 4 for MMX to work */
|
||||||
static const union
|
static const union
|
||||||
|
@ -33,6 +33,11 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
#include "spandsp/alloc.h"
|
#include "spandsp/alloc.h"
|
||||||
@ -47,7 +52,7 @@ static void report_status_change(hdlc_rx_state_t *s, int status)
|
|||||||
if (s->status_handler)
|
if (s->status_handler)
|
||||||
s->status_handler(s->status_user_data, status);
|
s->status_handler(s->status_user_data, status);
|
||||||
else if (s->frame_handler)
|
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 --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
@ -63,7 +68,7 @@ static void rx_special_condition(hdlc_rx_state_t *s, int status)
|
|||||||
s->len = 0;
|
s->len = 0;
|
||||||
s->num_bits = 0;
|
s->num_bits = 0;
|
||||||
s->flags_seen = 0;
|
s->flags_seen = 0;
|
||||||
s->framing_ok_announced = FALSE;
|
s->framing_ok_announced = false;
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
case SIG_STATUS_TRAINING_IN_PROGRESS:
|
case SIG_STATUS_TRAINING_IN_PROGRESS:
|
||||||
case SIG_STATUS_TRAINING_FAILED:
|
case SIG_STATUS_TRAINING_FAILED:
|
||||||
@ -95,7 +100,7 @@ static __inline__ void octet_set_and_count(hdlc_rx_state_t *s)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s->octet_counting_mode = TRUE;
|
s->octet_counting_mode = true;
|
||||||
s->octet_count = s->octet_count_report_interval;
|
s->octet_count = s->octet_count_report_interval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,7 +145,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
|
|||||||
{
|
{
|
||||||
/* Hit HDLC flag */
|
/* Hit HDLC flag */
|
||||||
/* A flag clears octet counting */
|
/* A flag clears octet counting */
|
||||||
s->octet_counting_mode = FALSE;
|
s->octet_counting_mode = false;
|
||||||
if (s->flags_seen >= s->framing_ok_threshold)
|
if (s->flags_seen >= s->framing_ok_threshold)
|
||||||
{
|
{
|
||||||
/* We may have a frame, or we may have back to back flags */
|
/* We may have a frame, or we may have back to back flags */
|
||||||
@ -156,7 +161,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
|
|||||||
s->rx_bytes += s->len - s->crc_bytes;
|
s->rx_bytes += s->len - s->crc_bytes;
|
||||||
s->len -= s->crc_bytes;
|
s->len -= s->crc_bytes;
|
||||||
if (s->frame_handler)
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -165,7 +170,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
|
|||||||
{
|
{
|
||||||
s->len -= s->crc_bytes;
|
s->len -= s->crc_bytes;
|
||||||
if (s->frame_handler)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,7 +186,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
|
|||||||
else
|
else
|
||||||
s->len = 0;
|
s->len = 0;
|
||||||
if (s->frame_handler)
|
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++;
|
s->rx_length_errors++;
|
||||||
}
|
}
|
||||||
@ -206,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)
|
if (++s->flags_seen >= s->framing_ok_threshold && !s->framing_ok_announced)
|
||||||
{
|
{
|
||||||
report_status_change(s, SIG_STATUS_FRAMING_OK);
|
report_status_change(s, SIG_STATUS_FRAMING_OK);
|
||||||
s->framing_ok_announced = TRUE;
|
s->framing_ok_announced = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -307,8 +312,8 @@ SPAN_DECLARE(void) hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s
|
|||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s,
|
SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s,
|
||||||
int crc32,
|
bool crc32,
|
||||||
int report_bad_frames,
|
bool report_bad_frames,
|
||||||
int framing_ok_threshold,
|
int framing_ok_threshold,
|
||||||
hdlc_frame_handler_t handler,
|
hdlc_frame_handler_t handler,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
@ -372,7 +377,7 @@ SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t
|
|||||||
{
|
{
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
{
|
{
|
||||||
s->tx_end = TRUE;
|
s->tx_end = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (s->len + len > s->max_frame_len)
|
if (s->len + len > s->max_frame_len)
|
||||||
@ -398,7 +403,7 @@ SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t
|
|||||||
s->len += len;
|
s->len += len;
|
||||||
else
|
else
|
||||||
s->len = len;
|
s->len = len;
|
||||||
s->tx_end = FALSE;
|
s->tx_end = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
@ -413,8 +418,8 @@ SPAN_DECLARE(int) hdlc_tx_flags(hdlc_tx_state_t *s, int len)
|
|||||||
s->flag_octets += -len;
|
s->flag_octets += -len;
|
||||||
else
|
else
|
||||||
s->flag_octets = len;
|
s->flag_octets = len;
|
||||||
s->report_flag_underflow = TRUE;
|
s->report_flag_underflow = true;
|
||||||
s->tx_end = FALSE;
|
s->tx_end = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
@ -453,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.) */
|
/* We are in a timed flag section (preamble, inter frame gap, etc.) */
|
||||||
if (--s->flag_octets <= 0 && s->report_flag_underflow)
|
if (--s->flag_octets <= 0 && s->report_flag_underflow)
|
||||||
{
|
{
|
||||||
s->report_flag_underflow = FALSE;
|
s->report_flag_underflow = false;
|
||||||
if (s->len == 0)
|
if (s->len == 0)
|
||||||
{
|
{
|
||||||
/* The timed flags have finished, there is nothing else queued to go,
|
/* The timed flags have finished, there is nothing else queued to go,
|
||||||
@ -509,7 +514,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
|
|||||||
s->crc = 0xFFFFFFFF;
|
s->crc = 0xFFFFFFFF;
|
||||||
/* Report the underflow now. If there are timed flags still in progress, loading the
|
/* Report the underflow now. If there are timed flags still in progress, loading the
|
||||||
next frame right now will be harmless. */
|
next frame right now will be harmless. */
|
||||||
s->report_flag_underflow = FALSE;
|
s->report_flag_underflow = false;
|
||||||
if (s->underflow_handler)
|
if (s->underflow_handler)
|
||||||
s->underflow_handler(s->user_data);
|
s->underflow_handler(s->user_data);
|
||||||
/* Make sure we finish off with at least one flag octet, if the underflow report did not result
|
/* Make sure we finish off with at least one flag octet, if the underflow report did not result
|
||||||
@ -540,7 +545,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
|
|||||||
/* Untimed idling on flags */
|
/* Untimed idling on flags */
|
||||||
if (s->tx_end)
|
if (s->tx_end)
|
||||||
{
|
{
|
||||||
s->tx_end = FALSE;
|
s->tx_end = false;
|
||||||
return SIG_STATUS_END_OF_DATA;
|
return SIG_STATUS_END_OF_DATA;
|
||||||
}
|
}
|
||||||
return s->idle_octet;
|
return s->idle_octet;
|
||||||
@ -585,9 +590,9 @@ SPAN_DECLARE(void) hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len)
|
|||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s,
|
SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s,
|
||||||
int crc32,
|
bool crc32,
|
||||||
int inter_frame_flags,
|
int inter_frame_flags,
|
||||||
int progressive,
|
bool progressive,
|
||||||
hdlc_underflow_handler_t handler,
|
hdlc_underflow_handler_t handler,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
@ -47,6 +47,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <tiffio.h>
|
#include <tiffio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -40,6 +40,11 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <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/telephony.h"
|
||||||
#include "spandsp/alloc.h"
|
#include "spandsp/alloc.h"
|
||||||
@ -74,11 +79,11 @@ static void default_message_handler(void *user_data, int level, const char *text
|
|||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- 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))
|
if (s && (s->level & SPAN_LOG_SEVERITY_MASK) >= (level & SPAN_LOG_SEVERITY_MASK))
|
||||||
return TRUE;
|
return true;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -41,6 +41,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
@ -349,7 +354,7 @@ static void onset(lpc10_encode_state_t *s,
|
|||||||
osbuf[*osptr - 1] = i - 9;
|
osbuf[*osptr - 1] = i - 9;
|
||||||
(*osptr)++;
|
(*osptr)++;
|
||||||
}
|
}
|
||||||
s->hyst = TRUE;
|
s->hyst = true;
|
||||||
}
|
}
|
||||||
s->lasti = i;
|
s->lasti = i;
|
||||||
/* After one onset detection, at least OSHYST sample times must go */
|
/* 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)
|
else if (s->hyst && i - s->lasti >= 10)
|
||||||
{
|
{
|
||||||
s->hyst = FALSE;
|
s->hyst = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,14 +34,19 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <memory.h>
|
||||||
#if defined(HAVE_TGMATH_H)
|
#if defined(HAVE_TGMATH_H)
|
||||||
#include <tgmath.h>
|
#include <tgmath.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <memory.h>
|
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
#include "spandsp/alloc.h"
|
#include "spandsp/alloc.h"
|
||||||
@ -280,7 +285,7 @@ static int pitsyn(lpc10_decode_state_t *s,
|
|||||||
ipiti[i] = *pitch;
|
ipiti[i] = *pitch;
|
||||||
rmsi[i] = *rms;
|
rmsi[i] = *rms;
|
||||||
}
|
}
|
||||||
s->first_pitsyn = FALSE;
|
s->first_pitsyn = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -407,7 +412,7 @@ static int pitsyn(lpc10_decode_state_t *s,
|
|||||||
/* NOUT | -- -- -- -- ?? ?? */
|
/* NOUT | -- -- -- -- ?? ?? */
|
||||||
/* IVOICE | -- -- -- -- 0 0 */
|
/* 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. */
|
loop below. */
|
||||||
|
|
||||||
/* The only possible non-0 value of SLOPE (in column 111) is
|
/* The only possible non-0 value of SLOPE (in column 111) is
|
||||||
@ -858,7 +863,7 @@ static void decode(lpc10_decode_state_t *s,
|
|||||||
/* Skip decoding on first frame because present data not yet available */
|
/* Skip decoding on first frame because present data not yet available */
|
||||||
if (s->first)
|
if (s->first)
|
||||||
{
|
{
|
||||||
s->first = FALSE;
|
s->first = false;
|
||||||
/* Assign PITCH a "default" value on the first call, since */
|
/* Assign PITCH a "default" value on the first call, since */
|
||||||
/* otherwise it would be left uninitialized. The two lines */
|
/* otherwise it would be left uninitialized. The two lines */
|
||||||
/* below were copied from above, since it seemed like a */
|
/* below were copied from above, since it seemed like a */
|
||||||
@ -1025,7 +1030,7 @@ SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s,
|
|||||||
|
|
||||||
/* State used by function decode */
|
/* State used by function decode */
|
||||||
s->iptold = 60;
|
s->iptold = 60;
|
||||||
s->first = TRUE;
|
s->first = true;
|
||||||
s->ivp2h = 0;
|
s->ivp2h = 0;
|
||||||
s->iovoic = 0;
|
s->iovoic = 0;
|
||||||
s->iavgp = 60;
|
s->iavgp = 60;
|
||||||
@ -1045,7 +1050,7 @@ SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s,
|
|||||||
|
|
||||||
/* State used by function pitsyn */
|
/* State used by function pitsyn */
|
||||||
s->rmso = 1.0f;
|
s->rmso = 1.0f;
|
||||||
s->first_pitsyn = TRUE;
|
s->first_pitsyn = true;
|
||||||
|
|
||||||
/* State used by function bsynz */
|
/* State used by function bsynz */
|
||||||
s->ipo = 0;
|
s->ipo = 0;
|
||||||
|
@ -41,6 +41,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
@ -322,7 +327,7 @@ SPAN_DECLARE(lpc10_encode_state_t *) lpc10_encode_init(lpc10_encode_state_t *s,
|
|||||||
s->l2sum1 = 0.0f;
|
s->l2sum1 = 0.0f;
|
||||||
s->l2ptr1 = 1;
|
s->l2ptr1 = 1;
|
||||||
s->l2ptr2 = 9;
|
s->l2ptr2 = 9;
|
||||||
s->hyst = FALSE;
|
s->hyst = false;
|
||||||
|
|
||||||
/* State used by function lpc10_voicing */
|
/* State used by function lpc10_voicing */
|
||||||
s->dither = 20.0f;
|
s->dither = 20.0f;
|
||||||
|
@ -41,6 +41,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
@ -67,7 +72,7 @@ void lpc10_placea(int32_t *ipitch,
|
|||||||
int32_t k;
|
int32_t k;
|
||||||
int32_t l;
|
int32_t l;
|
||||||
int32_t hrange;
|
int32_t hrange;
|
||||||
int ephase;
|
bool ephase;
|
||||||
int32_t lrange;
|
int32_t lrange;
|
||||||
|
|
||||||
lrange = (af - 2)*lframe + 1;
|
lrange = (af - 2)*lframe + 1;
|
||||||
@ -148,14 +153,14 @@ void lpc10_placea(int32_t *ipitch,
|
|||||||
awin[af - 1][1] += *ipitch;
|
awin[af - 1][1] += *ipitch;
|
||||||
}
|
}
|
||||||
/* Make energy window be phase-synchronous. */
|
/* Make energy window be phase-synchronous. */
|
||||||
ephase = TRUE;
|
ephase = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Case 3 */
|
/* Case 3 */
|
||||||
awin[af - 1][0] = vwin[af - 1][0];
|
awin[af - 1][0] = vwin[af - 1][0];
|
||||||
awin[af - 1][1] = vwin[af - 1][1];
|
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
|
/* 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
|
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 i1;
|
||||||
int32_t i2;
|
int32_t i2;
|
||||||
int crit;
|
bool crit;
|
||||||
int32_t q;
|
int32_t q;
|
||||||
int32_t osptr1;
|
int32_t osptr1;
|
||||||
int32_t hrange;
|
int32_t hrange;
|
||||||
@ -286,12 +291,12 @@ void lpc10_placev(int32_t *osbuf,
|
|||||||
q++;
|
q++;
|
||||||
/* Check for case 2 (placement before onset): */
|
/* Check for case 2 (placement before onset): */
|
||||||
/* Check for critical region exception: */
|
/* Check for critical region exception: */
|
||||||
crit = FALSE;
|
crit = false;
|
||||||
for (i = q + 1; i < osptr1; i++)
|
for (i = q + 1; i < osptr1; i++)
|
||||||
{
|
{
|
||||||
if (osbuf[i - 1] - osbuf[q - 1] >= minwin)
|
if (osbuf[i - 1] - osbuf[q - 1] >= minwin)
|
||||||
{
|
{
|
||||||
crit = TRUE;
|
crit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
|
@ -31,17 +31,22 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#if defined(HAVE_TGMATH_H)
|
#if defined(HAVE_TGMATH_H)
|
||||||
#include <tgmath.h>
|
#include <tgmath.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#if defined(__sunos) || defined(__solaris) || defined(__sun)
|
#if defined(__sunos) || defined(__solaris) || defined(__sun)
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#endif
|
#endif
|
||||||
@ -50,13 +55,6 @@
|
|||||||
#include "spandsp/complex.h"
|
#include "spandsp/complex.h"
|
||||||
#include "filter_tools.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 SAMPLE_RATE 8000.0
|
||||||
#define MAX_COEFFS_PER_FILTER 128
|
#define MAX_COEFFS_PER_FILTER 128
|
||||||
#define MAX_COEFF_SETS 384
|
#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));
|
alpha = baud_rate/(2.0*(double) (coeff_sets*baud_rate));
|
||||||
beta = excess_bandwidth;
|
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. */
|
/* Find the DC gain of the filter, and adjust the filter to unity gain. */
|
||||||
floating_gain = 0.0;
|
floating_gain = 0.0;
|
||||||
@ -180,7 +178,7 @@ static void make_rx_filter(int coeff_sets,
|
|||||||
beta = excess_bandwidth;
|
beta = excess_bandwidth;
|
||||||
carrier *= 2.0*3.1415926535/SAMPLE_RATE;
|
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. */
|
/* Find the DC gain of the filter, and adjust the filter to unity gain. */
|
||||||
floating_gain = 0.0;
|
floating_gain = 0.0;
|
||||||
@ -284,7 +282,7 @@ int main(int argc, char **argv)
|
|||||||
const char *tx_tag;
|
const char *tx_tag;
|
||||||
const char *modem;
|
const char *modem;
|
||||||
|
|
||||||
transmit_modem = FALSE;
|
transmit_modem = false;
|
||||||
modem = "";
|
modem = "";
|
||||||
while ((opt = getopt(argc, argv, "m:rt")) != -1)
|
while ((opt = getopt(argc, argv, "m:rt")) != -1)
|
||||||
{
|
{
|
||||||
@ -294,10 +292,10 @@ int main(int argc, char **argv)
|
|||||||
modem = optarg;
|
modem = optarg;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
transmit_modem = FALSE;
|
transmit_modem = false;
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
transmit_modem = TRUE;
|
transmit_modem = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
|
@ -53,6 +53,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -70,6 +75,7 @@
|
|||||||
#include "spandsp/fsk.h"
|
#include "spandsp/fsk.h"
|
||||||
#include "spandsp/modem_connect_tones.h"
|
#include "spandsp/modem_connect_tones.h"
|
||||||
|
|
||||||
|
#include "spandsp/private/power_meter.h"
|
||||||
#include "spandsp/private/fsk.h"
|
#include "spandsp/private/fsk.h"
|
||||||
#include "spandsp/private/modem_connect_tones.h"
|
#include "spandsp/private/modem_connect_tones.h"
|
||||||
|
|
||||||
@ -256,12 +262,12 @@ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem
|
|||||||
{
|
{
|
||||||
int alloced;
|
int alloced;
|
||||||
|
|
||||||
alloced = FALSE;
|
alloced = false;
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
{
|
{
|
||||||
if ((s = (modem_connect_tones_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
|
if ((s = (modem_connect_tones_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
alloced = TRUE;
|
alloced = true;
|
||||||
}
|
}
|
||||||
s->tone_type = tone_type;
|
s->tone_type = tone_type;
|
||||||
switch (s->tone_type)
|
switch (s->tone_type)
|
||||||
@ -399,7 +405,7 @@ static void v21_put_bit(void *user_data, int bit)
|
|||||||
s->raw_bit_stream = 0;
|
s->raw_bit_stream = 0;
|
||||||
s->num_bits = 0;
|
s->num_bits = 0;
|
||||||
s->flags_seen = 0;
|
s->flags_seen = 0;
|
||||||
s->framing_ok_announced = FALSE;
|
s->framing_ok_announced = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -430,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)
|
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))));
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -442,7 +448,7 @@ static void v21_put_bit(void *user_data, int bit)
|
|||||||
{
|
{
|
||||||
if (s->num_bits == 8)
|
if (s->num_bits == 8)
|
||||||
{
|
{
|
||||||
s->framing_ok_announced = FALSE;
|
s->framing_ok_announced = false;
|
||||||
s->flags_seen = 0;
|
s->flags_seen = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -548,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);
|
report_tone_state(s, MODEM_CONNECT_TONES_NONE, -99);
|
||||||
s->tone_cycle_duration = 0;
|
s->tone_cycle_duration = 0;
|
||||||
s->good_cycles = 0;
|
s->good_cycles = 0;
|
||||||
s->tone_on = FALSE;
|
s->tone_on = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* There is adequate energy in the channel. Is it mostly at 2100Hz? */
|
/* There is adequate energy in the channel. Is it mostly at 2100Hz? */
|
||||||
@ -590,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_cycle_duration = ms_to_samples(450 + 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->tone_on = TRUE;
|
s->tone_on = true;
|
||||||
}
|
}
|
||||||
else if (s->notch_level*5 > s->channel_level)
|
else if (s->notch_level*5 > s->channel_level)
|
||||||
{
|
{
|
||||||
@ -609,7 +615,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
|
|||||||
s->good_cycles = 0;
|
s->good_cycles = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->tone_on = FALSE;
|
s->tone_on = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -743,7 +749,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
|
|||||||
s->tone_cycle_duration = 0;
|
s->tone_cycle_duration = 0;
|
||||||
s->good_cycles = 0;
|
s->good_cycles = 0;
|
||||||
s->hit = MODEM_CONNECT_TONES_NONE;
|
s->hit = MODEM_CONNECT_TONES_NONE;
|
||||||
s->tone_on = FALSE;
|
s->tone_on = false;
|
||||||
s->tone_callback = tone_callback;
|
s->tone_callback = tone_callback;
|
||||||
s->callback_data = user_data;
|
s->callback_data = user_data;
|
||||||
s->znotch_1 = 0.0f;
|
s->znotch_1 = 0.0f;
|
||||||
@ -752,7 +758,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
|
|||||||
s->z15hz_2 = 0.0f;
|
s->z15hz_2 = 0.0f;
|
||||||
s->num_bits = 0;
|
s->num_bits = 0;
|
||||||
s->flags_seen = 0;
|
s->flags_seen = 0;
|
||||||
s->framing_ok_announced = FALSE;
|
s->framing_ok_announced = false;
|
||||||
s->raw_bit_stream = 0;
|
s->raw_bit_stream = 0;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -39,11 +39,18 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
#include "spandsp/alloc.h"
|
#include "spandsp/alloc.h"
|
||||||
#include "spandsp/playout.h"
|
#include "spandsp/playout.h"
|
||||||
|
|
||||||
|
#include "spandsp/private/playout.h"
|
||||||
|
|
||||||
static playout_frame_t *queue_get(playout_state_t *s, timestamp_t sender_stamp)
|
static playout_frame_t *queue_get(playout_state_t *s, timestamp_t sender_stamp)
|
||||||
{
|
{
|
||||||
playout_frame_t *frame;
|
playout_frame_t *frame;
|
||||||
@ -121,7 +128,7 @@ SPAN_DECLARE(int) playout_get(playout_state_t *s, playout_frame_t *frameout, tim
|
|||||||
if (!s->not_first)
|
if (!s->not_first)
|
||||||
{
|
{
|
||||||
/* Prime things the first time through */
|
/* Prime things the first time through */
|
||||||
s->not_first = TRUE;
|
s->not_first = true;
|
||||||
s->latest_expected = frame->receiver_stamp + s->min_length;
|
s->latest_expected = frame->receiver_stamp + s->min_length;
|
||||||
}
|
}
|
||||||
/* Leaky integrate the rate of occurance of frames received just in time and late */
|
/* Leaky integrate the rate of occurance of frames received just in time and late */
|
||||||
@ -297,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_stamp = sender_stamp - sender_len - s->min_length;
|
||||||
s->last_speech_sender_len = sender_len;
|
s->last_speech_sender_len = sender_len;
|
||||||
s->start = FALSE;
|
s->start = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLAYOUT_OK;
|
return PLAYOUT_OK;
|
||||||
@ -321,7 +328,7 @@ SPAN_DECLARE(void) playout_restart(playout_state_t *s, int min_length, int max_l
|
|||||||
s->min_length = min_length;
|
s->min_length = min_length;
|
||||||
s->max_length = (max_length > min_length) ? max_length : min_length;
|
s->max_length = (max_length > min_length) ? max_length : min_length;
|
||||||
s->dropable_threshold = 1*0x10000000/100;
|
s->dropable_threshold = 1*0x10000000/100;
|
||||||
s->start = TRUE;
|
s->start = true;
|
||||||
s->since_last_step = 0x7FFFFFFF;
|
s->since_last_step = 0x7FFFFFFF;
|
||||||
/* Start with the minimum buffer length allowed, and work from there */
|
/* Start with the minimum buffer length allowed, and work from there */
|
||||||
s->actual_buffer_length =
|
s->actual_buffer_length =
|
||||||
|
@ -48,6 +48,8 @@
|
|||||||
#include "spandsp/saturated.h"
|
#include "spandsp/saturated.h"
|
||||||
#include "spandsp/plc.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. */
|
/* 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 */
|
#define ATTENUATION_INCREMENT 0.0025f /* Attenuation per sample */
|
||||||
|
|
||||||
|
@ -41,6 +41,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@ -48,6 +53,8 @@
|
|||||||
#include "spandsp/alloc.h"
|
#include "spandsp/alloc.h"
|
||||||
#include "spandsp/power_meter.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)
|
SPAN_DECLARE(power_meter_t *) power_meter_init(power_meter_t *s, int shift)
|
||||||
{
|
{
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
@ -148,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))
|
if (pow_short <= s->surge*(pow_medium >> 10))
|
||||||
return 0;
|
return 0;
|
||||||
s->signal_present = TRUE;
|
s->signal_present = true;
|
||||||
s->medium_term.reading = s->short_term.reading;
|
s->medium_term.reading = s->short_term.reading;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pow_short < s->sag*(pow_medium >> 10))
|
if (pow_short < s->sag*(pow_medium >> 10))
|
||||||
{
|
{
|
||||||
s->signal_present = FALSE;
|
s->signal_present = false;
|
||||||
s->medium_term.reading = s->short_term.reading;
|
s->medium_term.reading = s->short_term.reading;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,14 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <inttypes.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>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#define SPANDSP_FULLY_DEFINE_QUEUE_STATE_T
|
#define SPANDSP_FULLY_DEFINE_QUEUE_STATE_T
|
||||||
@ -44,7 +52,7 @@
|
|||||||
|
|
||||||
#include "spandsp/private/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);
|
return (s->iptr == s->optr);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,11 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "spandsp/telephony.h"
|
#include "spandsp/telephony.h"
|
||||||
#include "spandsp/alloc.h"
|
#include "spandsp/alloc.h"
|
||||||
|
@ -38,6 +38,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -54,6 +59,7 @@
|
|||||||
#include "spandsp/super_tone_rx.h"
|
#include "spandsp/super_tone_rx.h"
|
||||||
#include "spandsp/sig_tone.h"
|
#include "spandsp/sig_tone.h"
|
||||||
|
|
||||||
|
#include "spandsp/private/power_meter.h"
|
||||||
#include "spandsp/private/sig_tone.h"
|
#include "spandsp/private/sig_tone.h"
|
||||||
|
|
||||||
/*! PI */
|
/*! PI */
|
||||||
@ -226,7 +232,7 @@ SPAN_DECLARE(int) sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len)
|
|||||||
int k;
|
int k;
|
||||||
int n;
|
int n;
|
||||||
int16_t tone;
|
int16_t tone;
|
||||||
int need_update;
|
bool need_update;
|
||||||
int high_low;
|
int high_low;
|
||||||
|
|
||||||
for (i = 0; i < len; i += n)
|
for (i = 0; i < len; i += n)
|
||||||
@ -236,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)
|
if (s->current_tx_timeout <= len - i)
|
||||||
{
|
{
|
||||||
n = s->current_tx_timeout;
|
n = s->current_tx_timeout;
|
||||||
need_update = TRUE;
|
need_update = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n = len - i;
|
n = len - i;
|
||||||
need_update = FALSE;
|
need_update = false;
|
||||||
}
|
}
|
||||||
s->current_tx_timeout -= n;
|
s->current_tx_timeout -= n;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n = len - i;
|
n = len - i;
|
||||||
need_update = FALSE;
|
need_update = false;
|
||||||
}
|
}
|
||||||
if (!(s->current_tx_tone & SIG_TONE_TX_PASSTHROUGH))
|
if (!(s->current_tx_tone & SIG_TONE_TX_PASSTHROUGH))
|
||||||
vec_zeroi16(&[i], n);
|
vec_zeroi16(&[i], n);
|
||||||
@ -449,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->signalling_state & (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT)))
|
||||||
{
|
{
|
||||||
if (s->flat_mode_timeout && --s->flat_mode_timeout == 0)
|
if (s->flat_mode_timeout && --s->flat_mode_timeout == 0)
|
||||||
s->flat_mode = TRUE;
|
s->flat_mode = true;
|
||||||
/*endif*/
|
/*endif*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s->flat_mode_timeout = s->desc->sharp_flat_timeout;
|
s->flat_mode_timeout = s->desc->sharp_flat_timeout;
|
||||||
s->flat_mode = FALSE;
|
s->flat_mode = false;
|
||||||
}
|
}
|
||||||
/*endif*/
|
/*endif*/
|
||||||
|
|
||||||
|
@ -40,6 +40,11 @@
|
|||||||
#if defined(HAVE_MATH_H)
|
#if defined(HAVE_MATH_H)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_STDBOOL_H)
|
||||||
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
#include "spandsp/stdbool.h"
|
||||||
|
#endif
|
||||||
#include "floating_fudge.h"
|
#include "floating_fudge.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@INSERT_MATH_HEADER@
|
@INSERT_MATH_HEADER@
|
||||||
|
@INSERT_STDBOOL_HEADER@
|
||||||
#include <tiffio.h>
|
#include <tiffio.h>
|
||||||
|
|
||||||
#include <spandsp/telephony.h>
|
#include <spandsp/telephony.h>
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
#if !defined(_SPANDSP_ALLOC_H_)
|
#if !defined(_SPANDSP_ALLOC_H_)
|
||||||
#define _SPANDSP_ALLOC_H_
|
#define _SPANDSP_ALLOC_H_
|
||||||
|
|
||||||
typedef void *(*span_alloc_t)(size_t size);
|
|
||||||
typedef void *(*span_aligned_alloc_t)(size_t alignment, size_t size);
|
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_realloc_t)(void *ptr, size_t size);
|
||||||
typedef void (*span_free_t)(void *ptr);
|
typedef void (*span_free_t)(void *ptr);
|
||||||
|
|
||||||
@ -38,20 +38,20 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Allocate size bytes of memory. */
|
|
||||||
SPAN_DECLARE(void *) span_alloc(size_t size);
|
|
||||||
|
|
||||||
/* Allocate size bytes allocated to ALIGNMENT bytes. */
|
/* Allocate size bytes allocated to ALIGNMENT bytes. */
|
||||||
SPAN_DECLARE(void *) span_aligned_alloc(size_t alignment, size_t size);
|
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. */
|
/* 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);
|
SPAN_DECLARE(void *) span_realloc(void *ptr, size_t size);
|
||||||
|
|
||||||
/* Free a block allocated by span_alloc, span_aligned_alloc, or span_realloc. */
|
/* Free a block allocated by span_alloc, span_aligned_alloc, or span_realloc. */
|
||||||
SPAN_DECLARE(void) span_free(void *ptr);
|
SPAN_DECLARE(void) span_free(void *ptr);
|
||||||
|
|
||||||
SPAN_DECLARE(int) span_mem_allocators(span_alloc_t custom_alloc,
|
SPAN_DECLARE(int) span_mem_allocators(span_aligned_alloc_t custom_aligned_alloc,
|
||||||
span_aligned_alloc_t custom_aligned_alloc,
|
span_alloc_t custom_alloc,
|
||||||
span_realloc_t custom_realloc,
|
span_realloc_t custom_realloc,
|
||||||
span_free_t custom_free);
|
span_free_t custom_free);
|
||||||
|
|
||||||
|
@ -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 data_bits The number of data bits.
|
||||||
\param parity_bits The type of parity.
|
\param parity_bits The type of parity.
|
||||||
\param stop_bits The number of stop bits.
|
\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 put_byte The callback routine used to put the received data.
|
||||||
\param user_data An opaque pointer.
|
\param user_data An opaque pointer.
|
||||||
\return A pointer to the initialised context, or NULL if there was a problem. */
|
\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 data_bits,
|
||||||
int parity_bits,
|
int parity_bits,
|
||||||
int stop_bits,
|
int stop_bits,
|
||||||
int use_v14,
|
bool use_v14,
|
||||||
put_byte_func_t put_byte,
|
put_byte_func_t put_byte,
|
||||||
void *user_data);
|
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 data_bits The number of data bit.
|
||||||
\param parity_bits The type of parity.
|
\param parity_bits The type of parity.
|
||||||
\param stop_bits The number of stop bits.
|
\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 get_byte The callback routine used to get the data to be transmitted.
|
||||||
\param user_data An opaque pointer.
|
\param user_data An opaque pointer.
|
||||||
\return A pointer to the initialised context, or NULL if there was a problem. */
|
\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 data_bits,
|
||||||
int parity_bits,
|
int parity_bits,
|
||||||
int stop_bits,
|
int stop_bits,
|
||||||
int use_v14,
|
bool use_v14,
|
||||||
get_byte_func_t get_byte,
|
get_byte_func_t get_byte,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
|
@ -115,14 +115,14 @@ enum
|
|||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
/*! TRUE if character echo is enabled */
|
/*! True if character echo is enabled */
|
||||||
int echo;
|
bool echo;
|
||||||
/*! TRUE if verbose reporting is enabled */
|
/*! True if verbose reporting is enabled */
|
||||||
int verbose;
|
bool verbose;
|
||||||
/*! TRUE if result codes are verbose */
|
/*! Result code format code - numeic or verbose */
|
||||||
int result_code_format;
|
int result_code_format;
|
||||||
/*! TRUE if pulse dialling is the default */
|
/*! True if pulse dialling is the default */
|
||||||
int pulse_dial;
|
bool pulse_dial;
|
||||||
/*! ??? */
|
/*! ??? */
|
||||||
int double_escape;
|
int double_escape;
|
||||||
/*! ??? */
|
/*! ??? */
|
||||||
|
@ -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.
|
/*! \brief Initialise an R2 MF tone generator context.
|
||||||
\param s The R2 MF 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.
|
context is for backward signals.
|
||||||
\return A pointer to the MFC/R2 generator context.*/
|
\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.
|
/*! \brief Release an R2 MF tone generator context.
|
||||||
\param s The 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.
|
/*! \brief Initialise an R2 MF receiver context.
|
||||||
\param s The 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.
|
context is for backward signals.
|
||||||
\param callback An optional callback routine, used to report received digits. If
|
\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()
|
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.
|
and supplied in callbacks.
|
||||||
\return A pointer to the R2 MF receiver context. */
|
\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,
|
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,
|
tone_report_func_t callback,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c);
|
|||||||
|
|
||||||
/*! \brief Initialise a bitstream context.
|
/*! \brief Initialise a bitstream context.
|
||||||
\param s A pointer to the 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. */
|
\return A pointer to the bitstream context. */
|
||||||
SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int direction);
|
SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int direction);
|
||||||
|
|
||||||
|
@ -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.
|
/*! \brief Check the ITU/CCITT CRC-32 value in a frame.
|
||||||
\param buf The buffer containing the frame.
|
\param buf The buffer containing the frame.
|
||||||
\param len The length of 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.
|
/*! \brief Calculate the ITU/CCITT CRC-16 value in buffer by whole bytes.
|
||||||
\param buf The buffer containing the data.
|
\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.
|
/*! \brief Check the ITU/CCITT CRC-16 value in a frame.
|
||||||
\param buf The buffer containing the frame.
|
\param buf The buffer containing the frame.
|
||||||
\param len The length of 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)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ SPAN_DECLARE(void) dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s,
|
|||||||
|
|
||||||
/*! \brief Adjust a DTMF receiver context.
|
/*! \brief Adjust a DTMF receiver context.
|
||||||
\param s The 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.
|
to disable, < 0 to leave unchanged.
|
||||||
\param twist Acceptable twist, in dB. < 0.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.
|
\param reverse_twist Acceptable reverse twist, in dB. < 0.0 to leave unchanged.
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <spandsp/private/awgn.h>
|
#include <spandsp/private/awgn.h>
|
||||||
#include <spandsp/private/noise.h>
|
#include <spandsp/private/noise.h>
|
||||||
#include <spandsp/private/bert.h>
|
#include <spandsp/private/bert.h>
|
||||||
|
#include <spandsp/private/power_meter.h>
|
||||||
#include <spandsp/private/tone_generate.h>
|
#include <spandsp/private/tone_generate.h>
|
||||||
#include <spandsp/private/bell_r2_mf.h>
|
#include <spandsp/private/bell_r2_mf.h>
|
||||||
#include <spandsp/private/sig_tone.h>
|
#include <spandsp/private/sig_tone.h>
|
||||||
@ -49,6 +50,8 @@
|
|||||||
#include <spandsp/private/g726.h>
|
#include <spandsp/private/g726.h>
|
||||||
#include <spandsp/private/lpc10.h>
|
#include <spandsp/private/lpc10.h>
|
||||||
#include <spandsp/private/gsm0610.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/oki_adpcm.h>
|
||||||
#include <spandsp/private/ima_adpcm.h>
|
#include <spandsp/private/ima_adpcm.h>
|
||||||
#include <spandsp/private/hdlc.h>
|
#include <spandsp/private/hdlc.h>
|
||||||
@ -70,11 +73,10 @@
|
|||||||
#include <spandsp/private/v27ter_tx.h>
|
#include <spandsp/private/v27ter_tx.h>
|
||||||
#include <spandsp/private/v29rx.h>
|
#include <spandsp/private/v29rx.h>
|
||||||
#include <spandsp/private/v29tx.h>
|
#include <spandsp/private/v29tx.h>
|
||||||
/*#include <spandsp/private/v32bis.h>*/
|
|
||||||
/*#include <spandsp/private/v34.h>*/
|
|
||||||
#include <spandsp/private/v42.h>
|
#include <spandsp/private/v42.h>
|
||||||
#include <spandsp/private/v42bis.h>
|
#include <spandsp/private/v42bis.h>
|
||||||
#include <spandsp/private/at_interpreter.h>
|
#include <spandsp/private/at_interpreter.h>
|
||||||
|
#include <spandsp/private/data_modems.h>
|
||||||
#include <spandsp/private/fax_modems.h>
|
#include <spandsp/private/fax_modems.h>
|
||||||
#include <spandsp/private/timezone.h>
|
#include <spandsp/private/timezone.h>
|
||||||
#include <spandsp/private/image_translate.h>
|
#include <spandsp/private/image_translate.h>
|
||||||
|
@ -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.
|
/*! 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.
|
\brief Select whether silent audio will be sent when FAX transmit is idle.
|
||||||
\param s The FAX context.
|
\param s The FAX context.
|
||||||
\param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is
|
\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
|
idle. False to transmit zero length audio when the FAX transmitter is idle. The default
|
||||||
behaviour is FALSE.
|
behaviour is false.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle);
|
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.
|
/*! Select whether talker echo protection tone will be sent for the image modems.
|
||||||
\brief Select whether TEP will be sent for the image modems.
|
\brief Select whether TEP will be sent for the image modems.
|
||||||
\param s The FAX context.
|
\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);
|
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.
|
/*! Restart a FAX context.
|
||||||
\brief Restart a FAX context.
|
\brief Restart a FAX context.
|
||||||
\param s The 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.
|
context is for an answering party.
|
||||||
\return 0 for OK, else -1. */
|
\return 0 for OK, else -1. */
|
||||||
SPAN_DECLARE(int) fax_restart(fax_state_t *s, int calling_party);
|
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.
|
/*! Initialise a FAX context.
|
||||||
\brief Initialise a FAX context.
|
\brief Initialise a FAX context.
|
||||||
\param s The 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.
|
context is for an answering party.
|
||||||
\return A pointer to the FAX context, or NULL if there was a problem.
|
\return A pointer to the FAX context, or NULL if there was a problem.
|
||||||
*/
|
*/
|
||||||
|
@ -83,8 +83,8 @@ extern "C"
|
|||||||
|
|
||||||
/*! \brief Initialise an HDLC receiver context.
|
/*! \brief Initialise an HDLC receiver context.
|
||||||
\param s A pointer to 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 crc32 True to use ITU CRC32. False to use ITU CRC16.
|
||||||
\param report_bad_frames TRUE to request the reporting of bad frames.
|
\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
|
\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
|
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.
|
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.
|
\return A pointer to the HDLC receiver context.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s,
|
SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s,
|
||||||
int crc32,
|
bool crc32,
|
||||||
int report_bad_frames,
|
bool report_bad_frames,
|
||||||
int framing_ok_threshold,
|
int framing_ok_threshold,
|
||||||
hdlc_frame_handler_t handler,
|
hdlc_frame_handler_t handler,
|
||||||
void *user_data);
|
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.
|
/*! \brief Initialise an HDLC transmitter context.
|
||||||
\param s A pointer to 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 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 handler The callback function called when the HDLC transmitter underflows.
|
||||||
\param user_data An opaque parameter for the callback routine.
|
\param user_data An opaque parameter for the callback routine.
|
||||||
\return A pointer to the HDLC transmitter context.
|
\return A pointer to the HDLC transmitter context.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s,
|
SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s,
|
||||||
int crc32,
|
bool crc32,
|
||||||
int inter_frame_flags,
|
int inter_frame_flags,
|
||||||
int progressive,
|
bool progressive,
|
||||||
hdlc_underflow_handler_t handler,
|
hdlc_underflow_handler_t handler,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
|
@ -80,9 +80,9 @@ extern "C"
|
|||||||
\brief Test if logging of a specified severity level is enabled.
|
\brief Test if logging of a specified severity level is enabled.
|
||||||
\param s The logging context.
|
\param s The logging context.
|
||||||
\param level The severity level to be tested.
|
\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.
|
/*! Generate a log entry.
|
||||||
\brief 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.
|
/*! \brief Test if a modem_connect tone has been detected.
|
||||||
\param s The context.
|
\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);
|
SPAN_DECLARE(int) modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s);
|
||||||
|
|
||||||
|
@ -56,80 +56,13 @@ enum
|
|||||||
|
|
||||||
typedef int timestamp_t;
|
typedef int timestamp_t;
|
||||||
|
|
||||||
typedef struct playout_frame_s
|
typedef struct playout_frame_s playout_frame_t;
|
||||||
{
|
|
||||||
/*! 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;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Playout (jitter buffer) descriptor. This defines the working state
|
Playout (jitter buffer) descriptor. This defines the working state
|
||||||
for a single instance of playout buffering.
|
for a single instance of playout buffering.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct playout_state_s playout_state_t;
|
||||||
{
|
|
||||||
/*! 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;
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@ -109,21 +109,7 @@ That's it!
|
|||||||
/*!
|
/*!
|
||||||
The generic packet loss concealer context.
|
The generic packet loss concealer context.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct plc_state_s plc_state_t;
|
||||||
{
|
|
||||||
/*! 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;
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(_POWER_METER_H_)
|
#if !defined(_SPANDSP_POWER_METER_H_)
|
||||||
#define _POWER_METER_H_
|
#define _SPANDSP_POWER_METER_H_
|
||||||
|
|
||||||
/*! \page power_meter_page Power metering
|
/*! \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
|
Power meter descriptor. This defines the working state for a
|
||||||
single instance of a power measurement device.
|
single instance of a power measurement device.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct power_meter_s power_meter_t;
|
||||||
{
|
|
||||||
/*! The shift factor, which controls the damping of the power meter. */
|
|
||||||
int shift;
|
|
||||||
|
|
||||||
/*! The current power reading. */
|
typedef struct power_surge_detector_state_s power_surge_detector_state_t;
|
||||||
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;
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@ -69,8 +69,8 @@ struct async_rx_state_s
|
|||||||
int parity;
|
int parity;
|
||||||
/*! \brief The number of stop bits per character. */
|
/*! \brief The number of stop bits per character. */
|
||||||
int stop_bits;
|
int stop_bits;
|
||||||
/*! \brief TRUE if V.14 rate adaption processing should be performed. */
|
/*! \brief True if V.14 rate adaption processing should be performed. */
|
||||||
int use_v14;
|
bool use_v14;
|
||||||
/*! \brief A pointer to the callback routine used to handle received characters. */
|
/*! \brief A pointer to the callback routine used to handle received characters. */
|
||||||
put_byte_func_t put_byte;
|
put_byte_func_t put_byte;
|
||||||
/*! \brief An opaque pointer passed when calling put_byte. */
|
/*! \brief An opaque pointer passed when calling put_byte. */
|
||||||
|
@ -106,10 +106,10 @@ struct at_state_s
|
|||||||
int command_dial;
|
int command_dial;
|
||||||
int ok_is_pending;
|
int ok_is_pending;
|
||||||
int dte_is_waiting;
|
int dte_is_waiting;
|
||||||
/*! \brief TRUE if a carrier is presnt. Otherwise FALSE. */
|
/*! \brief True if a carrier is presnt. Otherwise false. */
|
||||||
int rx_signal_present;
|
bool rx_signal_present;
|
||||||
/*! \brief TRUE if a modem has trained, Otherwise FALSE. */
|
/*! \brief True if a modem has trained, Otherwise false. */
|
||||||
int rx_trained;
|
bool rx_trained;
|
||||||
int transmit;
|
int transmit;
|
||||||
|
|
||||||
char line[256];
|
char line[256];
|
||||||
|
@ -73,8 +73,8 @@ struct r2_mf_tx_state_s
|
|||||||
{
|
{
|
||||||
/*! The tone generator. */
|
/*! The tone generator. */
|
||||||
tone_gen_state_t tone;
|
tone_gen_state_t tone;
|
||||||
/*! TRUE if generating forward tones, otherwise generating reverse tones. */
|
/*! True if generating forward tones, otherwise generating reverse tones. */
|
||||||
int fwd;
|
bool fwd;
|
||||||
/*! The current digit being generated. */
|
/*! The current digit being generated. */
|
||||||
int digit;
|
int digit;
|
||||||
};
|
};
|
||||||
@ -88,8 +88,8 @@ struct r2_mf_rx_state_s
|
|||||||
tone_report_func_t callback;
|
tone_report_func_t callback;
|
||||||
/*! An opaque pointer passed to the callback function. */
|
/*! An opaque pointer passed to the callback function. */
|
||||||
void *callback_data;
|
void *callback_data;
|
||||||
/*! TRUE is we are detecting forward tones. FALSE if we are detecting backward tones */
|
/*! Tue is we are detecting forward tones. False if we are detecting backward tones */
|
||||||
int fwd;
|
bool fwd;
|
||||||
/*! Tone detector working states */
|
/*! Tone detector working states */
|
||||||
goertzel_state_t out[6];
|
goertzel_state_t out[6];
|
||||||
/*! The current sample number within a processing block. */
|
/*! The current sample number within a processing block. */
|
||||||
|
@ -33,8 +33,8 @@ struct bitstream_state_s
|
|||||||
uint32_t bitstream;
|
uint32_t bitstream;
|
||||||
/*! The residual bits in bitstream. */
|
/*! The residual bits in bitstream. */
|
||||||
int residue;
|
int residue;
|
||||||
/*! TRUE if the stream is LSB first, else MSB first */
|
/*! True if the stream is LSB first, else MSB first */
|
||||||
int lsb_first;
|
bool lsb_first;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ struct dtmf_rx_state_s
|
|||||||
tone_report_func_t realtime_callback;
|
tone_report_func_t realtime_callback;
|
||||||
/*! An opaque pointer passed to the real time callback function. */
|
/*! An opaque pointer passed to the real time callback function. */
|
||||||
void *realtime_callback_data;
|
void *realtime_callback_data;
|
||||||
/*! TRUE if dialtone should be filtered before processing */
|
/*! True if dialtone should be filtered before processing */
|
||||||
int filter_dialtone;
|
bool filter_dialtone;
|
||||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||||
/*! 350Hz filter state for the optional dialtone filter. */
|
/*! 350Hz filter state for the optional dialtone filter. */
|
||||||
float z350[2];
|
float z350[2];
|
||||||
|
@ -33,14 +33,14 @@
|
|||||||
*/
|
*/
|
||||||
struct fax_modems_state_s
|
struct fax_modems_state_s
|
||||||
{
|
{
|
||||||
/*! TRUE is talker echo protection should be sent for the image modems */
|
/*! True is talker echo protection should be sent for the image modems */
|
||||||
int use_tep;
|
bool use_tep;
|
||||||
/*! \brief The callback function used to report detected tones. */
|
/*! \brief The callback function used to report detected tones. */
|
||||||
tone_report_func_t tone_callback;
|
tone_report_func_t tone_callback;
|
||||||
/*! \brief A user specified opaque pointer passed to the tone_callback function. */
|
/*! \brief A user specified opaque pointer passed to the tone_callback function. */
|
||||||
void *tone_callback_user_data;
|
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
|
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
|
(e.g. the 75ms silence between V.21 and a high speed modem) will alway be transmitted as
|
||||||
silent audio. */
|
silent audio. */
|
||||||
@ -110,12 +110,12 @@ struct fax_modems_state_s
|
|||||||
hdlc_frame_handler_t hdlc_accept;
|
hdlc_frame_handler_t hdlc_accept;
|
||||||
void *hdlc_accept_user_data;
|
void *hdlc_accept_user_data;
|
||||||
|
|
||||||
/*! \brief TRUE if a carrier is present. Otherwise FALSE. */
|
/*! \brief True if a carrier is present. Otherwise false. */
|
||||||
int rx_signal_present;
|
bool rx_signal_present;
|
||||||
/*! \brief TRUE if a modem has trained correctly. */
|
/*! \brief True if a modem has trained correctly. */
|
||||||
int rx_trained;
|
bool rx_trained;
|
||||||
/*! \brief TRUE if an HDLC frame has been received correctly. */
|
/*! \brief True if an HDLC frame has been received correctly. */
|
||||||
int rx_frame_received;
|
bool rx_frame_received;
|
||||||
|
|
||||||
int deferred_rx_handler_updates;
|
int deferred_rx_handler_updates;
|
||||||
/*! \brief The current receive signal handler */
|
/*! \brief The current receive signal handler */
|
||||||
@ -145,8 +145,8 @@ struct fax_modems_state_s
|
|||||||
/*! \brief The current bit rate of the receiver. */
|
/*! \brief The current bit rate of the receiver. */
|
||||||
int rx_bit_rate;
|
int rx_bit_rate;
|
||||||
|
|
||||||
/*! \brief If TRUE, transmission is in progress */
|
/*! \brief If True, transmission is in progress */
|
||||||
int transmit;
|
bool transmit;
|
||||||
/*! \brief Audio logging file handle for received audio. */
|
/*! \brief Audio logging file handle for received audio. */
|
||||||
int audio_rx_log;
|
int audio_rx_log;
|
||||||
/*! \brief Audio logging file handle for transmitted audio. */
|
/*! \brief Audio logging file handle for transmitted audio. */
|
||||||
|
@ -47,13 +47,13 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
struct g722_encode_state_s
|
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. */
|
disabled. */
|
||||||
int itu_test_mode;
|
bool itu_test_mode;
|
||||||
/*! TRUE if the G.722 data is packed */
|
/*! True if the G.722 data is packed */
|
||||||
int packed;
|
bool packed;
|
||||||
/*! TRUE if encode from 8k samples/second */
|
/*! True if encode from 8k samples/second */
|
||||||
int eight_k;
|
bool eight_k;
|
||||||
/*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
|
/*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
|
||||||
int bits_per_sample;
|
int bits_per_sample;
|
||||||
|
|
||||||
@ -75,13 +75,13 @@ struct g722_encode_state_s
|
|||||||
*/
|
*/
|
||||||
struct g722_decode_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. */
|
disabled. */
|
||||||
int itu_test_mode;
|
bool itu_test_mode;
|
||||||
/*! TRUE if the G.722 data is packed */
|
/*! True if the G.722 data is packed */
|
||||||
int packed;
|
bool packed;
|
||||||
/*! TRUE if decode to 8k samples/second */
|
/*! True if decode to 8k samples/second */
|
||||||
int eight_k;
|
bool eight_k;
|
||||||
/*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
|
/*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
|
||||||
int bits_per_sample;
|
int bits_per_sample;
|
||||||
|
|
||||||
|
@ -43,24 +43,24 @@ struct hdlc_rx_state_s
|
|||||||
modem_status_func_t status_handler;
|
modem_status_func_t status_handler;
|
||||||
/*! \brief An opaque parameter passed to the status callback routine. */
|
/*! \brief An opaque parameter passed to the status callback routine. */
|
||||||
void *status_user_data;
|
void *status_user_data;
|
||||||
/*! \brief TRUE if bad frames are to be reported. */
|
/*! \brief True if bad frames are to be reported. */
|
||||||
int report_bad_frames;
|
bool report_bad_frames;
|
||||||
/*! \brief The number of consecutive flags which must be seen before framing is
|
/*! \brief The number of consecutive flags which must be seen before framing is
|
||||||
declared OK. */
|
declared OK. */
|
||||||
int framing_ok_threshold;
|
int framing_ok_threshold;
|
||||||
/*! \brief TRUE if framing OK has been announced. */
|
/*! \brief True if framing OK has been announced. */
|
||||||
int framing_ok_announced;
|
bool framing_ok_announced;
|
||||||
/*! \brief Number of consecutive flags seen so far. */
|
/*! \brief Number of consecutive flags seen so far. */
|
||||||
int flags_seen;
|
int flags_seen;
|
||||||
|
|
||||||
/*! \brief The raw (stuffed) bit stream buffer. */
|
/*! \brief The raw (stuffed) bit stream buffer. */
|
||||||
unsigned int raw_bit_stream;
|
uint32_t raw_bit_stream;
|
||||||
/*! \brief The destuffed bit stream buffer. */
|
/*! \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. */
|
/*! \brief The current number of bits in byte_in_progress. */
|
||||||
int num_bits;
|
int num_bits;
|
||||||
/*! \brief TRUE if in octet counting mode (e.g. for MTP). */
|
/*! \brief True if in octet counting mode (e.g. for MTP). */
|
||||||
int octet_counting_mode;
|
bool octet_counting_mode;
|
||||||
/*! \brief Octet count, to achieve the functionality needed for things
|
/*! \brief Octet count, to achieve the functionality needed for things
|
||||||
like MTP. */
|
like MTP. */
|
||||||
int octet_count;
|
int octet_count;
|
||||||
@ -98,8 +98,8 @@ struct hdlc_tx_state_s
|
|||||||
void *user_data;
|
void *user_data;
|
||||||
/*! \brief The minimum flag octets to insert between frames. */
|
/*! \brief The minimum flag octets to insert between frames. */
|
||||||
int inter_frame_flags;
|
int inter_frame_flags;
|
||||||
/*! \brief TRUE if frame creation works in progressive mode. */
|
/*! \brief True if frame creation works in progressive mode. */
|
||||||
int progressive;
|
bool progressive;
|
||||||
/*! \brief Maximum permitted frame length. */
|
/*! \brief Maximum permitted frame length. */
|
||||||
size_t max_frame_len;
|
size_t max_frame_len;
|
||||||
|
|
||||||
@ -113,8 +113,8 @@ struct hdlc_tx_state_s
|
|||||||
int flag_octets;
|
int flag_octets;
|
||||||
/*! \brief The number of abort octets to send for a timed burst of aborts. */
|
/*! \brief The number of abort octets to send for a timed burst of aborts. */
|
||||||
int abort_octets;
|
int abort_octets;
|
||||||
/*! \brief TRUE if the next underflow of timed flag octets should be reported */
|
/*! \brief True if the next underflow of timed flag octets should be reported */
|
||||||
int report_flag_underflow;
|
bool report_flag_underflow;
|
||||||
|
|
||||||
/*! \brief The current message being transmitted, with its CRC attached. */
|
/*! \brief The current message being transmitted, with its CRC attached. */
|
||||||
uint8_t buffer[HDLC_MAXFRAME_LEN + 4];
|
uint8_t buffer[HDLC_MAXFRAME_LEN + 4];
|
||||||
@ -130,8 +130,8 @@ struct hdlc_tx_state_s
|
|||||||
/*! \brief The number of bits remaining in byte. */
|
/*! \brief The number of bits remaining in byte. */
|
||||||
int bits;
|
int bits;
|
||||||
|
|
||||||
/*! \brief TRUE if transmission should end on buffer underflow .*/
|
/*! \brief True if transmission should end on buffer underflow .*/
|
||||||
int tx_end;
|
bool tx_end;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -92,8 +92,8 @@ struct lpc10_encode_state_s
|
|||||||
int32_t l2ptr2;
|
int32_t l2ptr2;
|
||||||
/*! \brief No initial value necessary */
|
/*! \brief No initial value necessary */
|
||||||
int32_t lasti;
|
int32_t lasti;
|
||||||
/*! \brief Initial value FALSE */
|
/*! \brief Initial value false */
|
||||||
int hyst;
|
bool hyst;
|
||||||
|
|
||||||
/* State used by function lpc10_voicing */
|
/* State used by function lpc10_voicing */
|
||||||
/*! \brief Initial value 20.0f */
|
/*! \brief Initial value 20.0f */
|
||||||
@ -148,8 +148,8 @@ struct lpc10_decode_state_s
|
|||||||
/* State used by function decode */
|
/* State used by function decode */
|
||||||
/*! \brief Initial value 60 */
|
/*! \brief Initial value 60 */
|
||||||
int32_t iptold;
|
int32_t iptold;
|
||||||
/*! \brief Initial value TRUE */
|
/*! \brief Initial value true */
|
||||||
int first;
|
bool first;
|
||||||
/*! \brief ??? */
|
/*! \brief ??? */
|
||||||
int32_t ivp2h;
|
int32_t ivp2h;
|
||||||
/*! \brief ??? */
|
/*! \brief ??? */
|
||||||
@ -172,18 +172,18 @@ struct lpc10_decode_state_s
|
|||||||
int32_t buflen;
|
int32_t buflen;
|
||||||
|
|
||||||
/* State used by function pitsyn */
|
/* 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;
|
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;
|
int32_t ipito;
|
||||||
/*! \brief Initial value 1.0f */
|
/*! \brief Initial value 1.0f */
|
||||||
float rmso;
|
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];
|
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;
|
int32_t jsamp;
|
||||||
/*! \brief Initial value TRUE */
|
/*! \brief Initial value true */
|
||||||
int first_pitsyn;
|
bool first_pitsyn;
|
||||||
|
|
||||||
/* State used by function bsynz */
|
/* State used by function bsynz */
|
||||||
/*! \brief ??? */
|
/*! \brief ??? */
|
||||||
|
@ -77,7 +77,7 @@ struct modem_connect_tones_rx_state_s
|
|||||||
int32_t am_level;
|
int32_t am_level;
|
||||||
/*! \brief Sample counter for the small chunks of samples, after which a test is conducted. */
|
/*! \brief Sample counter for the small chunks of samples, after which a test is conducted. */
|
||||||
int chunk_remainder;
|
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;
|
int tone_present;
|
||||||
/*! \brief */
|
/*! \brief */
|
||||||
int tone_on;
|
int tone_on;
|
||||||
@ -85,7 +85,7 @@ struct modem_connect_tones_rx_state_s
|
|||||||
int tone_cycle_duration;
|
int tone_cycle_duration;
|
||||||
/*! \brief A count of the number of good cycles of tone reversal seen. */
|
/*! \brief A count of the number of good cycles of tone reversal seen. */
|
||||||
int good_cycles;
|
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;
|
int hit;
|
||||||
/*! \brief A V.21 FSK modem context used when searching for FAX preamble. */
|
/*! \brief A V.21 FSK modem context used when searching for FAX preamble. */
|
||||||
fsk_rx_state_t v21rx;
|
fsk_rx_state_t v21rx;
|
||||||
@ -95,8 +95,8 @@ struct modem_connect_tones_rx_state_s
|
|||||||
int num_bits;
|
int num_bits;
|
||||||
/*! \brief Number of consecutive flags seen so far. */
|
/*! \brief Number of consecutive flags seen so far. */
|
||||||
int flags_seen;
|
int flags_seen;
|
||||||
/*! \brief TRUE if framing OK has been announced. */
|
/*! \brief True if framing OK has been announced. */
|
||||||
int framing_ok_announced;
|
bool framing_ok_announced;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
105
libs/spandsp/src/spandsp/private/playout.h
Normal file
105
libs/spandsp/src/spandsp/private/playout.h
Normal 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
libs/spandsp/src/spandsp/private/plc.h
Normal file
64
libs/spandsp/src/spandsp/private/plc.h
Normal 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 ------------------------------------------------------------*/
|
53
libs/spandsp/src/spandsp/private/power_meter.h
Normal file
53
libs/spandsp/src/spandsp/private/power_meter.h
Normal 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 ------------------------------------------------------------*/
|
@ -210,10 +210,10 @@ struct sig_tone_rx_state_s
|
|||||||
/*! \brief The minimum ratio between notched power and total power for detection */
|
/*! \brief The minimum ratio between notched power and total power for detection */
|
||||||
int32_t detection_ratio;
|
int32_t detection_ratio;
|
||||||
|
|
||||||
/*! \brief TRUE if in flat mode. FALSE if in sharp mode. */
|
/*! \brief True if in flat mode. False if in sharp mode. */
|
||||||
int flat_mode;
|
bool flat_mode;
|
||||||
/*! \brief TRUE if the notch filter is enabled in the media path */
|
/*! \brief True if the notch filter is enabled in the media path */
|
||||||
int notch_enabled;
|
bool notch_enabled;
|
||||||
/*! \brief ??? */
|
/*! \brief ??? */
|
||||||
int flat_mode_timeout;
|
int flat_mode_timeout;
|
||||||
/*! \brief ??? */
|
/*! \brief ??? */
|
||||||
|
@ -43,8 +43,8 @@ struct t30_state_s
|
|||||||
/*! \brief The type of FAX operation currently in progress */
|
/*! \brief The type of FAX operation currently in progress */
|
||||||
int operation_in_progress;
|
int operation_in_progress;
|
||||||
|
|
||||||
/*! \brief TRUE if behaving as the calling party */
|
/*! \brief True if behaving as the calling party */
|
||||||
int calling_party;
|
bool calling_party;
|
||||||
|
|
||||||
/*! \brief Internet aware FAX mode bit mask. */
|
/*! \brief Internet aware FAX mode bit mask. */
|
||||||
int iaf;
|
int iaf;
|
||||||
@ -64,10 +64,10 @@ struct t30_state_s
|
|||||||
int supported_image_sizes;
|
int supported_image_sizes;
|
||||||
/*! \brief A bit mask of the currently supported T.30 special features. */
|
/*! \brief A bit mask of the currently supported T.30 special features. */
|
||||||
int supported_t30_features;
|
int supported_t30_features;
|
||||||
/*! \brief TRUE is ECM mode handling is enabled. */
|
/*! \brief True is ECM mode handling is enabled. */
|
||||||
int ecm_allowed;
|
bool ecm_allowed;
|
||||||
/*! \brief TRUE if we are capable of retransmitting pages */
|
/*! \brief True if we are capable of retransmitting pages */
|
||||||
int retransmit_capable;
|
bool retransmit_capable;
|
||||||
|
|
||||||
/*! \brief The received DCS, formatted as an ASCII string, for inclusion
|
/*! \brief The received DCS, formatted as an ASCII string, for inclusion
|
||||||
in the TIFF file. */
|
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
|
/*! \brief The text which will be used in FAX page header. No text results
|
||||||
in no header line. */
|
in no header line. */
|
||||||
char header_info[T30_MAX_PAGE_HEADER_INFO + 1];
|
char header_info[T30_MAX_PAGE_HEADER_INFO + 1];
|
||||||
/*! \brief TRUE for FAX page headers to overlay (i.e. replace) the beginning of the
|
/*! \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
|
page image. False for FAX page headers to add to the overall length of
|
||||||
the page. */
|
the page. */
|
||||||
int header_overlays_image;
|
bool header_overlays_image;
|
||||||
/*! \brief Use private timezone if TRUE */
|
/*! \brief Use private timezone if true */
|
||||||
int use_own_tz;
|
bool use_own_tz;
|
||||||
/*! \brief Optional per instance time zone for the FAX page header timestamp. */
|
/*! \brief Optional per instance time zone for the FAX page header timestamp. */
|
||||||
tz_t tz;
|
tz_t tz;
|
||||||
|
|
||||||
/*! \brief TRUE if remote T.30 procedural interrupts are allowed. */
|
/*! \brief True if remote T.30 procedural interrupts are allowed. */
|
||||||
int remote_interrupts_allowed;
|
bool remote_interrupts_allowed;
|
||||||
|
|
||||||
/*! \brief The information fields received. */
|
/*! \brief The information fields received. */
|
||||||
t30_exchanged_info_t rx_info;
|
t30_exchanged_info_t rx_info;
|
||||||
@ -163,11 +163,11 @@ struct t30_state_s
|
|||||||
int local_dis_dtc_len;
|
int local_dis_dtc_len;
|
||||||
/*! \brief The last DIS or DTC message received form the far end. */
|
/*! \brief The last DIS or DTC message received form the far end. */
|
||||||
uint8_t far_dis_dtc_frame[T30_MAX_DIS_DTC_DCS_LEN];
|
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. */
|
/*! \brief True if a valid DIS has been received from the far end. */
|
||||||
int dis_received;
|
bool dis_received;
|
||||||
|
|
||||||
/*! \brief TRUE if the short training sequence should be used. */
|
/*! \brief True if the short training sequence should be used. */
|
||||||
int short_train;
|
bool short_train;
|
||||||
|
|
||||||
/*! \brief A count of the number of bits in the trainability test. This counts down to zero when
|
/*! \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. */
|
sending TCF, and counts up when receiving it. */
|
||||||
@ -181,12 +181,12 @@ struct t30_state_s
|
|||||||
int current_fallback;
|
int current_fallback;
|
||||||
/*! \brief The subset of supported modems allowed at the current time, allowing for negotiation. */
|
/*! \brief The subset of supported modems allowed at the current time, allowing for negotiation. */
|
||||||
int current_permitted_modems;
|
int current_permitted_modems;
|
||||||
/*! \brief TRUE if a carrier is present. Otherwise FALSE. */
|
/*! \brief True if a carrier is present. Otherwise false. */
|
||||||
int rx_signal_present;
|
bool rx_signal_present;
|
||||||
/*! \brief TRUE if a modem has trained correctly. */
|
/*! \brief True if a modem has trained correctly. */
|
||||||
int rx_trained;
|
bool rx_trained;
|
||||||
/*! \brief TRUE if a valid HDLC frame has been received in the current reception period. */
|
/*! \brief True if a valid HDLC frame has been received in the current reception period. */
|
||||||
int rx_frame_received;
|
bool rx_frame_received;
|
||||||
|
|
||||||
/*! \brief Current reception mode. */
|
/*! \brief Current reception mode. */
|
||||||
int current_rx_type;
|
int current_rx_type;
|
||||||
@ -214,14 +214,14 @@ struct t30_state_s
|
|||||||
/*! \brief This is only used in full duplex (e.g. ISDN) modes. */
|
/*! \brief This is only used in full duplex (e.g. ISDN) modes. */
|
||||||
int timer_t8;
|
int timer_t8;
|
||||||
|
|
||||||
/*! \brief TRUE once the far end FAX entity has been detected. */
|
/*! \brief True once the far end FAX entity has been detected. */
|
||||||
int far_end_detected;
|
bool far_end_detected;
|
||||||
|
|
||||||
/*! \brief TRUE once the end of procedure condition has been detected. */
|
/*! \brief True once the end of procedure condition has been detected. */
|
||||||
int end_of_procedure_detected;
|
bool end_of_procedure_detected;
|
||||||
|
|
||||||
/*! \brief TRUE if a local T.30 interrupt is pending. */
|
/*! \brief True if a local T.30 interrupt is pending. */
|
||||||
int local_interrupt_pending;
|
bool local_interrupt_pending;
|
||||||
/*! \brief The common ground in compression schemes between the local and far ends. */
|
/*! \brief The common ground in compression schemes between the local and far ends. */
|
||||||
int mutual_compressions;
|
int mutual_compressions;
|
||||||
/*! \brief The common group of supported bi-level image resolutions. */
|
/*! \brief The common group of supported bi-level image resolutions. */
|
||||||
@ -248,8 +248,8 @@ struct t30_state_s
|
|||||||
t4_image_width_t image_width;
|
t4_image_width_t image_width;
|
||||||
/*! \brief Current number of retries of the action in progress. */
|
/*! \brief Current number of retries of the action in progress. */
|
||||||
int retries;
|
int retries;
|
||||||
/*! \brief TRUE if error correcting mode is used. */
|
/*! \brief True if error correcting mode is used. */
|
||||||
int error_correcting_mode;
|
bool error_correcting_mode;
|
||||||
/*! \brief The number of HDLC frame retries, if error correcting mode is used. */
|
/*! \brief The number of HDLC frame retries, if error correcting mode is used. */
|
||||||
int error_correcting_mode_retries;
|
int error_correcting_mode_retries;
|
||||||
/*! \brief The current count of consecutive T30_PPR messages. */
|
/*! \brief The current count of consecutive T30_PPR messages. */
|
||||||
@ -277,9 +277,9 @@ struct t30_state_s
|
|||||||
int ecm_frames_this_tx_burst;
|
int ecm_frames_this_tx_burst;
|
||||||
/*! \brief The current ECM frame, during ECM transmission. */
|
/*! \brief The current ECM frame, during ECM transmission. */
|
||||||
int ecm_current_tx_frame;
|
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. */
|
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. */
|
/*! \brief The transmission step queued to follow the one in progress. */
|
||||||
int next_tx_step;
|
int next_tx_step;
|
||||||
@ -305,8 +305,8 @@ struct t30_state_s
|
|||||||
|
|
||||||
/*! \brief the FCF2 field of the last PPS message we received. */
|
/*! \brief the FCF2 field of the last PPS message we received. */
|
||||||
uint8_t last_pps_fcf2;
|
uint8_t last_pps_fcf2;
|
||||||
/*! \brief TRUE if all frames of the current received ECM block are now OK */
|
/*! \brief True if all frames of the current received ECM block are now OK */
|
||||||
int rx_ecm_block_ok;
|
bool rx_ecm_block_ok;
|
||||||
/*! \brief A count of successfully received ECM frames, to assess progress as a basis for
|
/*! \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. */
|
deciding whether to continue error correction when PPRs keep repeating. */
|
||||||
int ecm_progress;
|
int ecm_progress;
|
||||||
|
@ -108,8 +108,8 @@ typedef struct
|
|||||||
/*! \brief The current transmit step being timed */
|
/*! \brief The current transmit step being timed */
|
||||||
int timed_step;
|
int timed_step;
|
||||||
|
|
||||||
/*! \brief TRUE is there has been some T.38 data missed */
|
/*! \brief True is there has been some T.38 data missed */
|
||||||
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
|
/*! \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. */
|
rate and the current specified packet interval. */
|
||||||
@ -138,9 +138,9 @@ typedef struct
|
|||||||
|
|
||||||
t31_hdlc_state_t hdlc_from_t31;
|
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. */
|
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. */
|
/*! \brief Counter for trailing non-ECM bytes, used to flush out the far end's modem. */
|
||||||
int non_ecm_trailer_bytes;
|
int non_ecm_trailer_bytes;
|
||||||
@ -179,8 +179,8 @@ struct t31_state_s
|
|||||||
|
|
||||||
t31_audio_front_end_state_t audio;
|
t31_audio_front_end_state_t audio;
|
||||||
t31_t38_front_end_state_t t38_fe;
|
t31_t38_front_end_state_t t38_fe;
|
||||||
/*! TRUE if working in T.38 mode. */
|
/*! True if working in T.38 mode. */
|
||||||
int t38_mode;
|
bool t38_mode;
|
||||||
|
|
||||||
/*! HDLC buffer, for composing an HDLC frame from the computer to the channel. */
|
/*! HDLC buffer, for composing an HDLC frame from the computer to the channel. */
|
||||||
struct
|
struct
|
||||||
@ -189,8 +189,8 @@ struct t31_state_s
|
|||||||
uint8_t buf[T31_MAX_HDLC_LEN];
|
uint8_t buf[T31_MAX_HDLC_LEN];
|
||||||
int len;
|
int len;
|
||||||
int ptr;
|
int ptr;
|
||||||
/*! \brief TRUE when the end of HDLC data from the computer has been detected. */
|
/*! \brief True when the end of HDLC data from the computer has been detected. */
|
||||||
int final;
|
bool final;
|
||||||
} hdlc_tx;
|
} hdlc_tx;
|
||||||
/*! Buffer for data from the computer to the channel. */
|
/*! Buffer for data from the computer to the channel. */
|
||||||
struct
|
struct
|
||||||
@ -201,24 +201,24 @@ struct t31_state_s
|
|||||||
int in_bytes;
|
int in_bytes;
|
||||||
/*! \brief The number of bytes sent from the transmit buffer. */
|
/*! \brief The number of bytes sent from the transmit buffer. */
|
||||||
int out_bytes;
|
int out_bytes;
|
||||||
/*! \brief TRUE if the flow of real data has started. */
|
/*! \brief True if the flow of real data has started. */
|
||||||
int data_started;
|
bool data_started;
|
||||||
/*! \brief TRUE if holding up further data into the buffer, for flow control. */
|
/*! \brief True if holding up further data into the buffer, for flow control. */
|
||||||
int holding;
|
bool holding;
|
||||||
/*! \brief TRUE when the end of non-ECM data from the computer has been detected. */
|
/*! \brief True when the end of non-ECM data from the computer has been detected. */
|
||||||
int final;
|
bool final;
|
||||||
} non_ecm_tx;
|
} non_ecm_tx;
|
||||||
|
|
||||||
/*! TRUE if DLE prefix just used */
|
/*! True if DLE prefix just used */
|
||||||
int dled;
|
bool dled;
|
||||||
|
|
||||||
/*! \brief Samples of silence awaited, as specified in a "wait for silence" command */
|
/*! \brief Samples of silence awaited, as specified in a "wait for silence" command */
|
||||||
int silence_awaited;
|
int silence_awaited;
|
||||||
|
|
||||||
/*! \brief The current bit rate for the FAX fast message transfer modem. */
|
/*! \brief The current bit rate for the FAX fast message transfer modem. */
|
||||||
int bit_rate;
|
int bit_rate;
|
||||||
/*! \brief TRUE if a valid HDLC frame has been received in the current reception period. */
|
/*! \brief True if a valid HDLC frame has been received in the current reception period. */
|
||||||
int rx_frame_received;
|
bool rx_frame_received;
|
||||||
|
|
||||||
/*! \brief Samples elapsed in the current call */
|
/*! \brief Samples elapsed in the current call */
|
||||||
int64_t call_samples;
|
int64_t call_samples;
|
||||||
@ -226,8 +226,8 @@ struct t31_state_s
|
|||||||
|
|
||||||
/*! \brief The currently queued modem type. */
|
/*! \brief The currently queued modem type. */
|
||||||
int modem;
|
int modem;
|
||||||
/*! \brief TRUE when short training mode has been selected by the computer. */
|
/*! \brief True when short training mode has been selected by the computer. */
|
||||||
int short_train;
|
bool short_train;
|
||||||
queue_state_t *rx_queue;
|
queue_state_t *rx_queue;
|
||||||
|
|
||||||
/*! \brief Error and flow logging control */
|
/*! \brief Error and flow logging control */
|
||||||
|
@ -98,9 +98,9 @@ struct t38_core_state_s
|
|||||||
/*! \brief Pace transmission */
|
/*! \brief Pace transmission */
|
||||||
int 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. */
|
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
|
/*! \brief The number of times each packet type will be sent (low byte). The
|
||||||
depth of redundancy (2nd byte). Higher numbers may increase reliability
|
depth of redundancy (2nd byte). Higher numbers may increase reliability
|
||||||
|
@ -43,12 +43,12 @@ typedef struct
|
|||||||
/*! \brief Core T.38 IFP support */
|
/*! \brief Core T.38 IFP support */
|
||||||
t38_core_state_t t38;
|
t38_core_state_t t38;
|
||||||
|
|
||||||
/*! \brief TRUE if the NSF, NSC, and NSS are to be suppressed by altering
|
/*! \brief If NSF, NSC, and NSS are to be suppressed by altering their contents to
|
||||||
their contents to something the far end will not recognise. */
|
something the far end will not recognise, this is the amount to overwrite. */
|
||||||
int suppress_nsx_len[2];
|
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. */
|
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 */
|
/*! \brief the current class of field being received - i.e. none, non-ECM or HDLC */
|
||||||
int current_rx_field_class;
|
int current_rx_field_class;
|
||||||
@ -87,8 +87,8 @@ typedef struct
|
|||||||
int bit_no;
|
int bit_no;
|
||||||
/*! \brief Progressively calculated CRC for HDLC messages received from a modem. */
|
/*! \brief Progressively calculated CRC for HDLC messages received from a modem. */
|
||||||
uint16_t crc;
|
uint16_t crc;
|
||||||
/*! \brief TRUE if non-ECM fill bits are to be stripped when sending image data. */
|
/*! \brief True if non-ECM fill bits are to be stripped when sending image data. */
|
||||||
int fill_bit_removal;
|
bool fill_bit_removal;
|
||||||
/*! \brief The number of octets to send in each image packet (non-ECM or ECM) at
|
/*! \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. */
|
the current rate and the current specified packet interval. */
|
||||||
int octets_per_data_packet;
|
int octets_per_data_packet;
|
||||||
@ -134,27 +134,27 @@ typedef struct
|
|||||||
{
|
{
|
||||||
/*! \brief A bit mask of the currently supported modem types. */
|
/*! \brief A bit mask of the currently supported modem types. */
|
||||||
int supported_modems;
|
int supported_modems;
|
||||||
/*! \brief TRUE if ECM FAX mode is allowed through the gateway. */
|
/*! \brief True if ECM FAX mode is allowed through the gateway. */
|
||||||
int ecm_allowed;
|
bool ecm_allowed;
|
||||||
/*! \brief Required time between T.38 transmissions, in ms. */
|
/*! \brief Required time between T.38 transmissions, in ms. */
|
||||||
int ms_per_tx_chunk;
|
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
|
follows image_data_mode, but in ECM mode T.30 defines recovery
|
||||||
conditions in which long training is used for image data. */
|
conditions in which long training is used for image data. */
|
||||||
int short_train;
|
bool short_train;
|
||||||
/*! \brief TRUE if in image data mode, as opposed to TCF mode. */
|
/*! \brief True if in image data mode, as opposed to TCF mode. */
|
||||||
int image_data_mode;
|
bool image_data_mode;
|
||||||
/*! \brief The minimum permitted bits per FAX scan line row. */
|
/*! \brief The minimum permitted bits per FAX scan line row. */
|
||||||
int min_row_bits;
|
int min_row_bits;
|
||||||
|
|
||||||
/*! \brief TRUE if we should count the next MCF as a page end, else FALSE */
|
/*! \brief True if we should count the next MCF as a page end, else false */
|
||||||
int count_page_on_mcf;
|
bool count_page_on_mcf;
|
||||||
/*! \brief The number of pages for which a confirm (MCF) message was returned. */
|
/*! \brief The number of pages for which a confirm (MCF) message was returned. */
|
||||||
int pages_confirmed;
|
int pages_confirmed;
|
||||||
|
|
||||||
/*! \brief TRUE if we are in error correcting (ECM) mode */
|
/*! \brief True if we are in error correcting (ECM) mode */
|
||||||
int ecm_mode;
|
bool ecm_mode;
|
||||||
/*! \brief The current bit rate for the fast modem. */
|
/*! \brief The current bit rate for the fast modem. */
|
||||||
int fast_bit_rate;
|
int fast_bit_rate;
|
||||||
/*! \brief The current fast receive modem type. */
|
/*! \brief The current fast receive modem type. */
|
||||||
|
@ -55,14 +55,14 @@ struct t38_non_ecm_buffer_state_s
|
|||||||
uint8_t flow_control_fill_octet;
|
uint8_t flow_control_fill_octet;
|
||||||
/*! \brief A code for the phase of input buffering, from initial all ones to completion. */
|
/*! \brief A code for the phase of input buffering, from initial all ones to completion. */
|
||||||
int input_phase;
|
int input_phase;
|
||||||
/*! \brief TRUE is the end of non-ECM data indication has been received. */
|
/*! \brief True is the end of non-ECM data indication has been received. */
|
||||||
int data_finished;
|
bool data_finished;
|
||||||
/*! \brief The current octet being transmitted from the buffer. */
|
/*! \brief The current octet being transmitted from the buffer. */
|
||||||
unsigned int octet;
|
unsigned int octet;
|
||||||
/*! \brief The current bit number in the current non-ECM octet. */
|
/*! \brief The current bit number in the current non-ECM octet. */
|
||||||
int bit_no;
|
int bit_no;
|
||||||
/*! \brief TRUE if in image data mode, as opposed to TCF mode. */
|
/*! \brief True if in image data mode, as opposed to TCF mode. */
|
||||||
int image_data_mode;
|
bool image_data_mode;
|
||||||
|
|
||||||
/*! \brief The number of octets input to the buffer. */
|
/*! \brief The number of octets input to the buffer. */
|
||||||
int in_octets;
|
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 */
|
/*! \brief The timed step to go to when we reach idle from the current timed step */
|
||||||
int queued_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. */
|
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
|
/*! \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. */
|
rate and the current specified packet interval. */
|
||||||
@ -84,8 +84,8 @@ typedef struct
|
|||||||
/*! \brief The current T.38 data type being transmitted. */
|
/*! \brief The current T.38 data type being transmitted. */
|
||||||
int current_tx_data_type;
|
int current_tx_data_type;
|
||||||
|
|
||||||
/*! \brief TRUE if a carrier is present. Otherwise FALSE. */
|
/*! \brief True if a carrier is present. Otherwise false. */
|
||||||
int rx_signal_present;
|
bool rx_signal_present;
|
||||||
|
|
||||||
/*! \brief The current operating mode of the receiver. */
|
/*! \brief The current operating mode of the receiver. */
|
||||||
int current_rx_type;
|
int current_rx_type;
|
||||||
|
@ -81,8 +81,8 @@ struct t4_t6_decode_state_s
|
|||||||
int run_length;
|
int run_length;
|
||||||
/*! \brief 2D horizontal mode control. */
|
/*! \brief 2D horizontal mode control. */
|
||||||
int black_white;
|
int black_white;
|
||||||
/*! \brief TRUE if the current run is black */
|
/*! \brief True if the current run is black */
|
||||||
int in_black;
|
bool in_black;
|
||||||
|
|
||||||
/*! \brief The current step into the current row run-lengths buffer. */
|
/*! \brief The current step into the current row run-lengths buffer. */
|
||||||
int a_cursor;
|
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
|
/*! \brief This variable is set if we are treating the current row as a 2D encoded
|
||||||
one. */
|
one. */
|
||||||
int row_is_2d;
|
bool row_is_2d;
|
||||||
|
|
||||||
/*! \brief Encoded data bits buffer. */
|
/*! \brief Encoded data bits buffer. */
|
||||||
uint32_t tx_bitstream;
|
uint32_t tx_bitstream;
|
||||||
|
@ -124,10 +124,10 @@ struct t4_tx_state_s
|
|||||||
/*! \brief The last page to transfer. -1 to continue to the end of the file. */
|
/*! \brief The last page to transfer. -1 to continue to the end of the file. */
|
||||||
int stop_page;
|
int stop_page;
|
||||||
|
|
||||||
/*! \brief TRUE for FAX page headers to overlay (i.e. replace) the beginning of the
|
/*! \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
|
page image. False for FAX page headers to add to the overall length of
|
||||||
the page. */
|
the page. */
|
||||||
int header_overlays_image;
|
bool header_overlays_image;
|
||||||
/*! \brief The text which will be used in FAX page header. No text results
|
/*! \brief The text which will be used in FAX page header. No text results
|
||||||
in no header line. */
|
in no header line. */
|
||||||
const char *header_info;
|
const char *header_info;
|
||||||
|
@ -89,8 +89,8 @@ struct t85_encode_state_s
|
|||||||
uint32_t c[128];
|
uint32_t c[128];
|
||||||
/*! New TX value, or <0 for analysis in progress */
|
/*! New TX value, or <0 for analysis in progress */
|
||||||
int32_t new_tx;
|
int32_t new_tx;
|
||||||
/*! TRUE if previous row was typical */
|
/*! True if previous row was typical */
|
||||||
int prev_ltp;
|
bool prev_ltp;
|
||||||
/*! Pointers to the 3 row buffers */
|
/*! Pointers to the 3 row buffers */
|
||||||
uint8_t *prev_row[3];
|
uint8_t *prev_row[3];
|
||||||
/*! Pointer to a block of allocated memory 3 rows long, which
|
/*! Pointer to a block of allocated memory 3 rows long, which
|
||||||
|
@ -54,8 +54,8 @@ struct tz_ttinfo_s
|
|||||||
int32_t gmtoff; /* UTC offset in seconds */
|
int32_t gmtoff; /* UTC offset in seconds */
|
||||||
int isdst; /* Used to set tm_isdst */
|
int isdst; /* Used to set tm_isdst */
|
||||||
int abbrind; /* Abbreviation list index */
|
int abbrind; /* Abbreviation list index */
|
||||||
int ttisstd; /* TRUE if transition is std time */
|
bool ttisstd; /* True if transition is std time */
|
||||||
int ttisgmt; /* TRUE if transition is UTC */
|
bool ttisgmt; /* True if transition is UTC */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Leap second information */
|
/* Leap second information */
|
||||||
|
@ -156,8 +156,8 @@ struct v17_rx_state_s
|
|||||||
/*! \brief Scrambler tap */
|
/*! \brief Scrambler tap */
|
||||||
int scrambler_tap;
|
int scrambler_tap;
|
||||||
|
|
||||||
/*! \brief TRUE if the short training sequence is to be used. */
|
/*! \brief True if the short training sequence is to be used. */
|
||||||
int short_train;
|
bool short_train;
|
||||||
/*! \brief The section of the training data we are currently in. */
|
/*! \brief The section of the training data we are currently in. */
|
||||||
int training_stage;
|
int training_stage;
|
||||||
/*! \brief A count of how far through the current training step we are. */
|
/*! \brief A count of how far through the current training step we are. */
|
||||||
|
@ -81,10 +81,10 @@ struct v17_tx_state_s
|
|||||||
uint32_t scramble_reg;
|
uint32_t scramble_reg;
|
||||||
/*! \brief Scrambler tap */
|
/*! \brief Scrambler tap */
|
||||||
int scrambler_tap;
|
int scrambler_tap;
|
||||||
/*! \brief TRUE if transmitting the training sequence. FALSE if transmitting user data. */
|
/*! \brief True if transmitting the training sequence. False if transmitting user data. */
|
||||||
int in_training;
|
bool in_training;
|
||||||
/*! \brief TRUE if the short training sequence is to be used. */
|
/*! \brief True if the short training sequence is to be used. */
|
||||||
int short_train;
|
bool short_train;
|
||||||
/*! \brief A counter used to track progress through sending the training sequence. */
|
/*! \brief A counter used to track progress through sending the training sequence. */
|
||||||
int training_step;
|
int training_step;
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
struct v18_state_s
|
struct v18_state_s
|
||||||
{
|
{
|
||||||
/*! \brief TRUE if we are the calling modem */
|
/*! \brief True if we are the calling modem */
|
||||||
int calling_party;
|
bool calling_party;
|
||||||
int mode;
|
int mode;
|
||||||
int nation;
|
int nation;
|
||||||
put_msg_func_t put_msg;
|
put_msg_func_t put_msg;
|
||||||
|
@ -79,8 +79,8 @@ struct v22bis_state_s
|
|||||||
{
|
{
|
||||||
/*! \brief The maximum permitted bit rate of the modem. Valid values are 1200 and 2400. */
|
/*! \brief The maximum permitted bit rate of the modem. Valid values are 1200 and 2400. */
|
||||||
int bit_rate;
|
int bit_rate;
|
||||||
/*! \brief TRUE is this is the calling side modem. */
|
/*! \brief True is this is the calling side modem. */
|
||||||
int calling_party;
|
bool calling_party;
|
||||||
/*! \brief The callback function used to get the next bit to be transmitted. */
|
/*! \brief The callback function used to get the next bit to be transmitted. */
|
||||||
get_bit_func_t get_bit;
|
get_bit_func_t get_bit;
|
||||||
/*! \brief A user specified opaque pointer passed to the get_bit callback routine. */
|
/*! \brief A user specified opaque pointer passed to the get_bit callback routine. */
|
||||||
|
@ -130,8 +130,8 @@ struct v27ter_rx_state_s
|
|||||||
int scrambler_pattern_count;
|
int scrambler_pattern_count;
|
||||||
/*! \brief The current step in the table of BC constellation positions. */
|
/*! \brief The current step in the table of BC constellation positions. */
|
||||||
int training_bc;
|
int training_bc;
|
||||||
/*! \brief TRUE if the previous trained values are to be reused. */
|
/*! \brief True if the previous trained values are to be reused. */
|
||||||
int old_train;
|
bool old_train;
|
||||||
/*! \brief The section of the training data we are currently in. */
|
/*! \brief The section of the training data we are currently in. */
|
||||||
int training_stage;
|
int training_stage;
|
||||||
/*! \brief A count of how far through the current training step we are. */
|
/*! \brief A count of how far through the current training step we are. */
|
||||||
|
@ -73,9 +73,9 @@ struct v27ter_tx_state_s
|
|||||||
/*! \brief A counter for the number of consecutive bits of repeating pattern through
|
/*! \brief A counter for the number of consecutive bits of repeating pattern through
|
||||||
the scrambler. */
|
the scrambler. */
|
||||||
int scrambler_pattern_count;
|
int scrambler_pattern_count;
|
||||||
/*! \brief TRUE if transmitting the training sequence, or shutting down transmission.
|
/*! \brief True if transmitting the training sequence, or shutting down transmission.
|
||||||
FALSE if transmitting user data. */
|
False if transmitting user data. */
|
||||||
int in_training;
|
bool in_training;
|
||||||
/*! \brief A counter used to track progress through sending the training sequence. */
|
/*! \brief A counter used to track progress through sending the training sequence. */
|
||||||
int training_step;
|
int training_step;
|
||||||
|
|
||||||
|
@ -139,8 +139,8 @@ struct v29_rx_state_s
|
|||||||
uint8_t training_scramble_reg;
|
uint8_t training_scramble_reg;
|
||||||
/*! \brief The current step in the table of CD constellation positions. */
|
/*! \brief The current step in the table of CD constellation positions. */
|
||||||
int training_cd;
|
int training_cd;
|
||||||
/*! \brief TRUE if the previous trained values are to be reused. */
|
/*! \brief True if the previous trained values are to be reused. */
|
||||||
int old_train;
|
bool old_train;
|
||||||
/*! \brief The section of the training data we are currently in. */
|
/*! \brief The section of the training data we are currently in. */
|
||||||
int training_stage;
|
int training_stage;
|
||||||
/*! \brief A count of how far through the current training step we are. */
|
/*! \brief A count of how far through the current training step we are. */
|
||||||
|
@ -76,9 +76,9 @@ struct v29_tx_state_s
|
|||||||
uint32_t scramble_reg;
|
uint32_t scramble_reg;
|
||||||
/*! \brief The register for the training scrambler. */
|
/*! \brief The register for the training scrambler. */
|
||||||
uint8_t training_scramble_reg;
|
uint8_t training_scramble_reg;
|
||||||
/*! \brief TRUE if transmitting the training sequence, or shutting down transmission.
|
/*! \brief True if transmitting the training sequence, or shutting down transmission.
|
||||||
FALSE if transmitting user data. */
|
False if transmitting user data. */
|
||||||
int in_training;
|
bool in_training;
|
||||||
/*! \brief A counter used to track progress through sending the training sequence. */
|
/*! \brief A counter used to track progress through sending the training sequence. */
|
||||||
int training_step;
|
int training_step;
|
||||||
/*! \brief An offset value into the table of training parameters, used to match the
|
/*! \brief An offset value into the table of training parameters, used to match the
|
||||||
|
@ -92,9 +92,9 @@ typedef struct
|
|||||||
uint8_t vr;
|
uint8_t vr;
|
||||||
int state;
|
int state;
|
||||||
int configuring;
|
int configuring;
|
||||||
int local_busy;
|
bool local_busy;
|
||||||
int far_busy;
|
bool far_busy;
|
||||||
int rejected;
|
bool rejected;
|
||||||
int retry_count;
|
int retry_count;
|
||||||
|
|
||||||
/* The control frame buffer, and its pointers */
|
/* The control frame buffer, and its pointers */
|
||||||
@ -131,11 +131,11 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
struct v42_state_s
|
struct v42_state_s
|
||||||
{
|
{
|
||||||
/*! TRUE if we are the calling party, otherwise FALSE. */
|
/*! True if we are the calling party, otherwise false. */
|
||||||
int calling_party;
|
bool calling_party;
|
||||||
/*! TRUE if we should detect whether the far end is V.42 capable. FALSE if we go
|
/*! True if we should detect whether the far end is V.42 capable. false if we go
|
||||||
directly to protocol establishment. */
|
directly to protocol establishment. */
|
||||||
int detect;
|
bool detect;
|
||||||
|
|
||||||
/*! The bit rate, used to time events */
|
/*! The bit rate, used to time events */
|
||||||
int tx_bit_rate;
|
int tx_bit_rate;
|
||||||
|
@ -60,8 +60,8 @@ typedef struct
|
|||||||
/*! \brief The maximum amount to be passed to the data handler. */
|
/*! \brief The maximum amount to be passed to the data handler. */
|
||||||
int max_output_len;
|
int max_output_len;
|
||||||
|
|
||||||
/*! \brief TRUE if we are in transparent (i.e. uncompressable) mode */
|
/*! \brief True if we are in transparent (i.e. uncompressable) mode */
|
||||||
int transparent;
|
bool transparent;
|
||||||
/*! \brief Next empty dictionary entry */
|
/*! \brief Next empty dictionary entry */
|
||||||
uint16_t v42bis_parm_c1;
|
uint16_t v42bis_parm_c1;
|
||||||
/*! \brief Current codeword size */
|
/*! \brief Current codeword size */
|
||||||
@ -104,8 +104,8 @@ typedef struct
|
|||||||
|
|
||||||
/*! \brief The current value of the escape code */
|
/*! \brief The current value of the escape code */
|
||||||
uint8_t escape_code;
|
uint8_t escape_code;
|
||||||
/*! \brief TRUE if we just hit an escape code, and are waiting for the following octet */
|
/*! \brief True if we just hit an escape code, and are waiting for the following octet */
|
||||||
int escaped;
|
bool escaped;
|
||||||
} v42bis_comp_state_t;
|
} v42bis_comp_state_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
struct v8_state_s
|
struct v8_state_s
|
||||||
{
|
{
|
||||||
/*! \brief TRUE if we are the calling party */
|
/*! \brief True if we are the calling party */
|
||||||
int calling_party;
|
bool calling_party;
|
||||||
|
|
||||||
/*! \brief A handler to process the V.8 signals */
|
/*! \brief A handler to process the V.8 signals */
|
||||||
v8_result_handler_t result_handler;
|
v8_result_handler_t result_handler;
|
||||||
@ -38,7 +38,7 @@ struct v8_state_s
|
|||||||
|
|
||||||
/*! \brief The current state of the V.8 protocol */
|
/*! \brief The current state of the V.8 protocol */
|
||||||
int state;
|
int state;
|
||||||
int fsk_tx_on;
|
bool fsk_tx_on;
|
||||||
int modem_connect_tone_tx_on;
|
int modem_connect_tone_tx_on;
|
||||||
int negotiation_timer;
|
int negotiation_timer;
|
||||||
int ci_timer;
|
int ci_timer;
|
||||||
@ -67,8 +67,8 @@ struct v8_state_s
|
|||||||
testing for matches. */
|
testing for matches. */
|
||||||
uint8_t cm_jm_data[64];
|
uint8_t cm_jm_data[64];
|
||||||
int cm_jm_len;
|
int cm_jm_len;
|
||||||
int got_cm_jm;
|
bool got_cm_jm;
|
||||||
int got_cj;
|
bool got_cj;
|
||||||
int zero_byte_count;
|
int zero_byte_count;
|
||||||
/*! \brief Error and flow logging control */
|
/*! \brief Error and flow logging control */
|
||||||
logging_state_t logging;
|
logging_state_t logging;
|
||||||
|
@ -63,8 +63,8 @@ extern "C"
|
|||||||
/*! Check if a queue is empty.
|
/*! Check if a queue is empty.
|
||||||
\brief Check if a queue is empty.
|
\brief Check if a queue is empty.
|
||||||
\param s The queue context.
|
\param s The queue context.
|
||||||
\return TRUE if empty, else FALSE. */
|
\return True if empty, else false. */
|
||||||
SPAN_DECLARE(int) queue_empty(queue_state_t *s);
|
SPAN_DECLARE(bool) queue_empty(queue_state_t *s);
|
||||||
|
|
||||||
/*! Check the available free space in a queue's buffer.
|
/*! Check the available free space in a queue's buffer.
|
||||||
\brief Check available free space.
|
\brief Check available free space.
|
||||||
|
55
libs/spandsp/src/spandsp/stdbool.h
Normal file
55
libs/spandsp/src/spandsp/stdbool.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* SpanDSP - a series of DSP components for telephony
|
||||||
|
*
|
||||||
|
* stdbool.h - A version for systems which lack their own stdbool.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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ISO C Standard: 7.16 Boolean type and values <stdbool.h>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(_STDBOOL_H)
|
||||||
|
#define _STDBOOL_H
|
||||||
|
|
||||||
|
#if !defined(__cplusplus)
|
||||||
|
|
||||||
|
#define _Bool int
|
||||||
|
#define bool int
|
||||||
|
#define false 0
|
||||||
|
#define true (!false)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define _Bool bool
|
||||||
|
#define bool bool
|
||||||
|
#define false false
|
||||||
|
#define true true
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Signal that all the definitions are present. */
|
||||||
|
#define __bool_true_false_are_defined 1
|
||||||
|
|
||||||
|
#endif
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
\section t30_page_sec_1 What does it do?
|
\section t30_page_sec_1 What does it do?
|
||||||
The T.30 protocol is the core protocol used for FAX transmission. This module
|
The T.30 protocol is the core protocol used for FAX transmission. This module
|
||||||
implements most of its key featrues. It does not interface to the outside work.
|
implements most of its key features. It does not interface to the outside work.
|
||||||
Seperate modules do that for T.38, analogue line, and other forms of FAX
|
Seperate modules do that for T.38, analogue line, and other forms of FAX
|
||||||
communication.
|
communication.
|
||||||
|
|
||||||
@ -184,13 +184,13 @@ typedef void (*t30_phase_e_handler_t)(t30_state_t *s, void *user_data, int compl
|
|||||||
\brief T.30 real time frame handler.
|
\brief T.30 real time frame handler.
|
||||||
\param s The T.30 context.
|
\param s The T.30 context.
|
||||||
\param user_data An opaque pointer.
|
\param user_data An opaque pointer.
|
||||||
\param direction TRUE for incoming, FALSE for outgoing.
|
\param incoming True for incoming, false for outgoing.
|
||||||
\param msg The HDLC message.
|
\param msg The HDLC message.
|
||||||
\param len The length of the message.
|
\param len The length of the message.
|
||||||
*/
|
*/
|
||||||
typedef void (*t30_real_time_frame_handler_t)(t30_state_t *s,
|
typedef void (*t30_real_time_frame_handler_t)(t30_state_t *s,
|
||||||
void *user_data,
|
void *user_data,
|
||||||
int direction,
|
bool direction,
|
||||||
const uint8_t msg[],
|
const uint8_t msg[],
|
||||||
int len);
|
int len);
|
||||||
|
|
||||||
@ -209,8 +209,8 @@ typedef int (*t30_document_handler_t)(t30_state_t *s, void *user_data, int statu
|
|||||||
\param user_data An opaque pointer.
|
\param user_data An opaque pointer.
|
||||||
\param type The modem, tone or silence to be sent or received.
|
\param type The modem, tone or silence to be sent or received.
|
||||||
\param bit_rate The bit rate of the modem to be sent or received.
|
\param bit_rate The bit rate of the modem to be sent or received.
|
||||||
\param short_train TRUE if the short training sequence should be used (where one exists).
|
\param short_train True if the short training sequence should be used (where one exists).
|
||||||
\param use_hdlc FALSE for bit stream, TRUE for HDLC framing.
|
\param use_hdlc False for bit stream, true for HDLC framing.
|
||||||
*/
|
*/
|
||||||
typedef void (*t30_set_handler_t)(void *user_data, int type, int bit_rate, int short_train, int use_hdlc);
|
typedef void (*t30_set_handler_t)(void *user_data, int type, int bit_rate, int short_train, int use_hdlc);
|
||||||
|
|
||||||
@ -448,7 +448,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
/*! \brief The current bit rate for image transfer. */
|
/*! \brief The current bit rate for image transfer. */
|
||||||
int bit_rate;
|
int bit_rate;
|
||||||
/*! \brief TRUE if error correcting mode is used. */
|
/*! \brief True if error correcting mode is used. */
|
||||||
int error_correcting_mode;
|
int error_correcting_mode;
|
||||||
/*! \brief The number of pages sent so far. */
|
/*! \brief The number of pages sent so far. */
|
||||||
int pages_tx;
|
int pages_tx;
|
||||||
@ -502,7 +502,7 @@ extern "C"
|
|||||||
/*! Initialise a T.30 context.
|
/*! Initialise a T.30 context.
|
||||||
\brief Initialise a T.30 context.
|
\brief Initialise a T.30 context.
|
||||||
\param s The T.30 context.
|
\param s The T.30 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.
|
context is for an answering party.
|
||||||
\param set_rx_type_handler
|
\param set_rx_type_handler
|
||||||
\param set_rx_type_user_data
|
\param set_rx_type_user_data
|
||||||
@ -542,7 +542,7 @@ SPAN_DECLARE(int) t30_restart(t30_state_t *s);
|
|||||||
if the job has finished.
|
if the job has finished.
|
||||||
\brief Check if a T.30 call is still active.
|
\brief Check if a T.30 call is still active.
|
||||||
\param s The T.30 context.
|
\param s The T.30 context.
|
||||||
\return TRUE for call still active, or FALSE for call completed. */
|
\return True for call still active, or false for call completed. */
|
||||||
SPAN_DECLARE(int) t30_call_active(t30_state_t *s);
|
SPAN_DECLARE(int) t30_call_active(t30_state_t *s);
|
||||||
|
|
||||||
/*! Cleanup a T.30 context if the call terminates.
|
/*! Cleanup a T.30 context if the call terminates.
|
||||||
@ -588,7 +588,7 @@ SPAN_DECLARE(void) t30_non_ecm_put(void *user_data, const uint8_t buf[], int len
|
|||||||
\param user_data The T.30 context.
|
\param user_data The T.30 context.
|
||||||
\param msg The HDLC message.
|
\param msg The HDLC message.
|
||||||
\param len The length of the message, in octets.
|
\param len The length of the message, in octets.
|
||||||
\param ok TRUE if the frame was received without error. */
|
\param ok True if the frame was received without error. */
|
||||||
SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t msg[], int len, int ok);
|
SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t msg[], int len, int ok);
|
||||||
|
|
||||||
/*! Report the passage of time to the T.30 engine.
|
/*! Report the passage of time to the T.30 engine.
|
||||||
@ -606,13 +606,13 @@ SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t);
|
|||||||
/*! Request a local interrupt of FAX exchange.
|
/*! Request a local interrupt of FAX exchange.
|
||||||
\brief Request a local interrupt of FAX exchange.
|
\brief Request a local interrupt of FAX exchange.
|
||||||
\param s The T.30 context.
|
\param s The T.30 context.
|
||||||
\param state TRUE to enable interrupt request, else FALSE. */
|
\param state True to enable interrupt request, else false. */
|
||||||
SPAN_DECLARE(void) t30_local_interrupt_request(t30_state_t *s, int state);
|
SPAN_DECLARE(void) t30_local_interrupt_request(t30_state_t *s, int state);
|
||||||
|
|
||||||
/*! Allow remote interrupts of FAX exchange.
|
/*! Allow remote interrupts of FAX exchange.
|
||||||
\brief Allow remote interrupts of FAX exchange.
|
\brief Allow remote interrupts of FAX exchange.
|
||||||
\param s The T.30 context.
|
\param s The T.30 context.
|
||||||
\param state TRUE to allow interruptd, else FALSE. */
|
\param state True to allow interruptd, else false. */
|
||||||
SPAN_DECLARE(void) t30_remote_interrupts_allowed(t30_state_t *s, int state);
|
SPAN_DECLARE(void) t30_remote_interrupts_allowed(t30_state_t *s, int state);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
@ -363,8 +363,8 @@ SPAN_DECLARE(size_t) t30_get_rx_csa(t30_state_t *s, int *type, const char *addre
|
|||||||
/*! Set page header extends or overlays the image mode.
|
/*! Set page header extends or overlays the image mode.
|
||||||
\brief Set page header overlay mode.
|
\brief Set page header overlay mode.
|
||||||
\param s The T.30 context.
|
\param s The T.30 context.
|
||||||
\param header_overlays_image TRUE for overlay, or FALSE for extend the page. */
|
\param header_overlays_image True for overlay, or false for extend the page. */
|
||||||
SPAN_DECLARE(int) t30_set_tx_page_header_overlays_image(t30_state_t *s, int header_overlays_image);
|
SPAN_DECLARE(int) t30_set_tx_page_header_overlays_image(t30_state_t *s, bool header_overlays_image);
|
||||||
|
|
||||||
/*! Set the transmitted header information associated with a T.30 context.
|
/*! Set the transmitted header information associated with a T.30 context.
|
||||||
\brief Set the transmitted header information associated with a T.30 context.
|
\brief Set the transmitted header information associated with a T.30 context.
|
||||||
@ -426,15 +426,15 @@ SPAN_DECLARE(void) t30_set_tx_file(t30_state_t *s, const char *file, int start_p
|
|||||||
/*! Set Internet aware FAX (IAF) mode.
|
/*! Set Internet aware FAX (IAF) mode.
|
||||||
\brief Set Internet aware FAX (IAF) mode.
|
\brief Set Internet aware FAX (IAF) mode.
|
||||||
\param s The T.30 context.
|
\param s The T.30 context.
|
||||||
\param iaf TRUE for IAF, or FALSE for non-IAF. */
|
\param iaf True for IAF, or false for non-IAF. */
|
||||||
SPAN_DECLARE(void) t30_set_iaf_mode(t30_state_t *s, int iaf);
|
SPAN_DECLARE(void) t30_set_iaf_mode(t30_state_t *s, bool iaf);
|
||||||
|
|
||||||
/*! Specify if error correction mode (ECM) is allowed by a T.30 context.
|
/*! Specify if error correction mode (ECM) is allowed by a T.30 context.
|
||||||
\brief Select ECM capability.
|
\brief Select ECM capability.
|
||||||
\param s The T.30 context.
|
\param s The T.30 context.
|
||||||
\param enabled TRUE for ECM capable, FALSE for not ECM capable.
|
\param enabled True for ECM capable, or false for not ECM capable.
|
||||||
\return 0 if OK, else -1. */
|
\return 0 if OK, else -1. */
|
||||||
SPAN_DECLARE(int) t30_set_ecm_capability(t30_state_t *s, int enabled);
|
SPAN_DECLARE(int) t30_set_ecm_capability(t30_state_t *s, bool enabled);
|
||||||
|
|
||||||
/*! Specify the output encoding for TIFF files created during FAX reception.
|
/*! Specify the output encoding for TIFF files created during FAX reception.
|
||||||
\brief Specify the output encoding for TIFF files created during FAX reception.
|
\brief Specify the output encoding for TIFF files created during FAX reception.
|
||||||
|
@ -89,33 +89,33 @@ SPAN_DECLARE(int) t31_t38_send_timeout(t31_state_t *s, int samples);
|
|||||||
/*! Select whether silent audio will be sent when transmit is idle.
|
/*! Select whether silent audio will be sent when transmit is idle.
|
||||||
\brief Select whether silent audio will be sent when transmit is idle.
|
\brief Select whether silent audio will be sent when transmit is idle.
|
||||||
\param s The T.31 modem context.
|
\param s The T.31 modem context.
|
||||||
\param transmit_on_idle TRUE if silent audio should be output when the transmitter is
|
\param transmit_on_idle True if silent audio should be output when the transmitter is
|
||||||
idle. FALSE to transmit zero length audio when the transmitter is idle. The default
|
idle. False to transmit zero length audio when the transmitter is idle. The default
|
||||||
behaviour is FALSE.
|
behaviour is false.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t31_set_transmit_on_idle(t31_state_t *s, int transmit_on_idle);
|
SPAN_DECLARE(void) t31_set_transmit_on_idle(t31_state_t *s, bool transmit_on_idle);
|
||||||
|
|
||||||
/*! Select whether TEP mode will be used (or time allowed for it (when transmitting).
|
/*! Select whether TEP mode will be used (or time allowed for it (when transmitting).
|
||||||
\brief Select whether TEP mode will be used.
|
\brief Select whether TEP mode will be used.
|
||||||
\param s The T.31 modem context.
|
\param s The T.31 modem context.
|
||||||
\param use_tep TRUE if TEP is to be ised.
|
\param use_tep True if TEP is to be used.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t31_set_tep_mode(t31_state_t *s, int use_tep);
|
SPAN_DECLARE(void) t31_set_tep_mode(t31_state_t *s, bool use_tep);
|
||||||
|
|
||||||
/*! Select whether T.38 data will be paced as it is transmitted.
|
/*! Select whether T.38 data will be paced as it is transmitted.
|
||||||
\brief Select whether T.38 data will be paced.
|
\brief Select whether T.38 data will be paced.
|
||||||
\param s The T.31 modem context.
|
\param s The T.31 modem context.
|
||||||
\param without_pacing TRUE if data is to be sent as fast as possible. FALSE if it is
|
\param without_pacing True if data is to be sent as fast as possible. False if it is
|
||||||
to be paced.
|
to be paced.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, int without_pacing);
|
SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, bool without_pacing);
|
||||||
|
|
||||||
/*! Set audio or T.38 mode.
|
/*! Set audio or T.38 mode.
|
||||||
\brief Set audio or T.38 mode.
|
\brief Set audio or T.38 mode.
|
||||||
\param s The T.31 modem context.
|
\param s The T.31 modem context.
|
||||||
\param t38_mode TRUE for T.38 mode operation. FALSE for audio mode operation.
|
\param t38_mode True for T.38 mode operation. False for audio mode operation.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t31_set_mode(t31_state_t *s, int t38_mode);
|
SPAN_DECLARE(void) t31_set_mode(t31_state_t *s, bool t38_mode);
|
||||||
|
|
||||||
/*! Get a pointer to the logging context associated with a T.31 context.
|
/*! Get a pointer to the logging context associated with a T.31 context.
|
||||||
\brief Get a pointer to the logging context associated with a T.31 context.
|
\brief Get a pointer to the logging context associated with a T.31 context.
|
||||||
|
@ -83,9 +83,9 @@ SPAN_DECLARE(const char *) t35_vendor_to_str(const uint8_t *msg, int len);
|
|||||||
\param model A pointer which will be pointed to the identified model.
|
\param model A pointer which will be pointed to the identified model.
|
||||||
If a NULL pointer is given, the model will not be returned.
|
If a NULL pointer is given, the model will not be returned.
|
||||||
If the model is not identified, NULL will be returned.
|
If the model is not identified, NULL will be returned.
|
||||||
\return TRUE if the machine was identified, otherwise FALSE.
|
\return True if the machine was identified.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(int) t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model);
|
SPAN_DECLARE(bool) t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
@ -312,21 +312,21 @@ SPAN_DECLARE(void) t38_set_data_transport_protocol(t38_core_state_t *s, int data
|
|||||||
|
|
||||||
/*! Set the non-ECM fill bit removal mode.
|
/*! Set the non-ECM fill bit removal mode.
|
||||||
\param s The T.38 context.
|
\param s The T.38 context.
|
||||||
\param fill_bit_removal TRUE to remove fill bits across the T.38 link, else FALSE.
|
\param fill_bit_removal True to remove fill bits across the T.38 link.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t38_set_fill_bit_removal(t38_core_state_t *s, int fill_bit_removal);
|
SPAN_DECLARE(void) t38_set_fill_bit_removal(t38_core_state_t *s, bool fill_bit_removal);
|
||||||
|
|
||||||
/*! Set the MMR transcoding mode.
|
/*! Set the MMR transcoding mode.
|
||||||
\param s The T.38 context.
|
\param s The T.38 context.
|
||||||
\param mmr_transcoding TRUE to transcode to MMR across the T.38 link, else FALSE.
|
\param mmr_transcoding True to transcode to MMR across the T.38 link.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t38_set_mmr_transcoding(t38_core_state_t *s, int mmr_transcoding);
|
SPAN_DECLARE(void) t38_set_mmr_transcoding(t38_core_state_t *s, bool mmr_transcoding);
|
||||||
|
|
||||||
/*! Set the JBIG transcoding mode.
|
/*! Set the JBIG transcoding mode.
|
||||||
\param s The T.38 context.
|
\param s The T.38 context.
|
||||||
\param jbig_transcoding TRUE to transcode to JBIG across the T.38 link, else FALSE.
|
\param jbig_transcoding True to transcode to JBIG across the T.38 link.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t38_set_jbig_transcoding(t38_core_state_t *s, int jbig_transcoding);
|
SPAN_DECLARE(void) t38_set_jbig_transcoding(t38_core_state_t *s, bool jbig_transcoding);
|
||||||
|
|
||||||
/*! Set the maximum buffer size for received data at the far end.
|
/*! Set the maximum buffer size for received data at the far end.
|
||||||
\param s The T.38 context.
|
\param s The T.38 context.
|
||||||
@ -363,16 +363,16 @@ SPAN_DECLARE(void) t38_set_t38_version(t38_core_state_t *s, int t38_version);
|
|||||||
|
|
||||||
/*! Set the sequence number handling option.
|
/*! Set the sequence number handling option.
|
||||||
\param s The T.38 context.
|
\param s The T.38 context.
|
||||||
\param check TRUE to check sequence numbers, and handle gaps reasonably. FALSE
|
\param check True to check sequence numbers, and handle gaps reasonably. False
|
||||||
for no sequence number processing (e.g. for TPKT over TCP transport).
|
for no sequence number processing (e.g. for TPKT over TCP transport).
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t38_set_sequence_number_handling(t38_core_state_t *s, int check);
|
SPAN_DECLARE(void) t38_set_sequence_number_handling(t38_core_state_t *s, bool check);
|
||||||
|
|
||||||
/*! Set the TEP handling option.
|
/*! Set the TEP handling option.
|
||||||
\param s The T.38 context.
|
\param s The T.38 context.
|
||||||
\param allow_for_tep TRUE to allow for TEP playout, else FALSE.
|
\param allow_for_tep True to allow for TEP playout.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, int allow_for_tep);
|
SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, bool allow_for_tep);
|
||||||
|
|
||||||
/*! Get a pointer to the logging context associated with a T.38 context.
|
/*! Get a pointer to the logging context associated with a T.38 context.
|
||||||
\brief Get a pointer to the logging context associated with a T.38 context.
|
\brief Get a pointer to the logging context associated with a T.38 context.
|
||||||
|
@ -45,13 +45,13 @@ typedef struct t38_gateway_state_s t38_gateway_state_t;
|
|||||||
\brief T.30 real time frame handler.
|
\brief T.30 real time frame handler.
|
||||||
\param s The T.30 context.
|
\param s The T.30 context.
|
||||||
\param user_data An opaque pointer.
|
\param user_data An opaque pointer.
|
||||||
\param direction TRUE for incoming, FALSE for outgoing.
|
\param incoming True for incoming, false for outgoing.
|
||||||
\param msg The HDLC message.
|
\param msg The HDLC message.
|
||||||
\param len The length of the message.
|
\param len The length of the message.
|
||||||
*/
|
*/
|
||||||
typedef void (*t38_gateway_real_time_frame_handler_t)(t38_gateway_state_t *s,
|
typedef void (*t38_gateway_real_time_frame_handler_t)(t38_gateway_state_t *s,
|
||||||
void *user_data,
|
void *user_data,
|
||||||
int direction,
|
bool incoming,
|
||||||
const uint8_t *msg,
|
const uint8_t *msg,
|
||||||
int len);
|
int len);
|
||||||
|
|
||||||
@ -62,8 +62,8 @@ typedef struct
|
|||||||
{
|
{
|
||||||
/*! \brief The current bit rate for image transfer. */
|
/*! \brief The current bit rate for image transfer. */
|
||||||
int bit_rate;
|
int bit_rate;
|
||||||
/*! \brief TRUE if error correcting mode is used. */
|
/*! \brief True if error correcting mode is used. */
|
||||||
int error_correcting_mode;
|
bool error_correcting_mode;
|
||||||
/*! \brief The number of pages transferred so far. */
|
/*! \brief The number of pages transferred so far. */
|
||||||
int pages_transferred;
|
int pages_transferred;
|
||||||
} t38_stats_t;
|
} t38_stats_t;
|
||||||
@ -124,18 +124,18 @@ SPAN_DECLARE_NONSTD(int) t38_gateway_tx(t38_gateway_state_t *s, int16_t amp[], i
|
|||||||
/*! Control whether error correcting mode (ECM) is allowed.
|
/*! Control whether error correcting mode (ECM) is allowed.
|
||||||
\brief Control whether error correcting mode (ECM) is allowed.
|
\brief Control whether error correcting mode (ECM) is allowed.
|
||||||
\param s The T.38 context.
|
\param s The T.38 context.
|
||||||
\param ecm_allowed TRUE is ECM is to be allowed.
|
\param ecm_allowed True is ECM is to be allowed.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t38_gateway_set_ecm_capability(t38_gateway_state_t *s, int ecm_allowed);
|
SPAN_DECLARE(void) t38_gateway_set_ecm_capability(t38_gateway_state_t *s, bool ecm_allowed);
|
||||||
|
|
||||||
/*! Select whether silent audio will be sent when transmit is idle.
|
/*! Select whether silent audio will be sent when transmit is idle.
|
||||||
\brief Select whether silent audio will be sent when transmit is idle.
|
\brief Select whether silent audio will be sent when transmit is idle.
|
||||||
\param s The T.38 context.
|
\param s The T.38 context.
|
||||||
\param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is
|
\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
|
idle. False to transmit zero length audio when the FAX transmitter is idle. The default
|
||||||
behaviour is FALSE.
|
behaviour is false.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t38_gateway_set_transmit_on_idle(t38_gateway_state_t *s, int transmit_on_idle);
|
SPAN_DECLARE(void) t38_gateway_set_transmit_on_idle(t38_gateway_state_t *s, bool transmit_on_idle);
|
||||||
|
|
||||||
/*! Specify which modem types are supported by a T.30 context.
|
/*! Specify which modem types are supported by a T.30 context.
|
||||||
\brief Specify supported modems.
|
\brief Specify supported modems.
|
||||||
@ -165,16 +165,16 @@ SPAN_DECLARE(void) t38_gateway_set_nsx_suppression(t38_gateway_state_t *s,
|
|||||||
/*! Select whether talker echo protection tone will be sent for the image modems.
|
/*! Select whether talker echo protection tone will be sent for the image modems.
|
||||||
\brief Select whether TEP will be sent for the image modems.
|
\brief Select whether TEP will be sent for the image modems.
|
||||||
\param s The T.38 context.
|
\param s The T.38 context.
|
||||||
\param use_tep TRUE if TEP should be sent.
|
\param use_tep True if TEP should be sent.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t38_gateway_set_tep_mode(t38_gateway_state_t *s, int use_tep);
|
SPAN_DECLARE(void) t38_gateway_set_tep_mode(t38_gateway_state_t *s, bool use_tep);
|
||||||
|
|
||||||
/*! Select whether non-ECM fill bits are to be removed during transmission.
|
/*! Select whether non-ECM fill bits are to be removed during transmission.
|
||||||
\brief Select whether non-ECM fill bits are to be removed during transmission.
|
\brief Select whether non-ECM fill bits are to be removed during transmission.
|
||||||
\param s The T.38 context.
|
\param s The T.38 context.
|
||||||
\param remove TRUE if fill bits are to be removed.
|
\param remove True if fill bits are to be removed.
|
||||||
*/
|
*/
|
||||||
SPAN_DECLARE(void) t38_gateway_set_fill_bit_removal(t38_gateway_state_t *s, int remove);
|
SPAN_DECLARE(void) t38_gateway_set_fill_bit_removal(t38_gateway_state_t *s, bool remove);
|
||||||
|
|
||||||
/*! Get the current transfer statistics for the current T.38 session.
|
/*! Get the current transfer statistics for the current T.38 session.
|
||||||
\brief Get the current transfer statistics.
|
\brief Get the current transfer statistics.
|
||||||
|
@ -83,10 +83,10 @@ extern "C"
|
|||||||
|
|
||||||
/*! \brief Initialise a T.38 rate adapting non-ECM buffer context.
|
/*! \brief Initialise a T.38 rate adapting non-ECM buffer context.
|
||||||
\param s The buffer context.
|
\param s The buffer context.
|
||||||
\param mode TRUE for image data mode, or FALSE for TCF mode.
|
\param image_mode True for image data mode, or false for TCF mode.
|
||||||
\param bits The minimum number of bits per FAX image row.
|
\param bits The minimum number of bits per FAX image row.
|
||||||
\return A pointer to the buffer context, or NULL if there was a problem. */
|
\return A pointer to the buffer context, or NULL if there was a problem. */
|
||||||
SPAN_DECLARE(t38_non_ecm_buffer_state_t *) t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits);
|
SPAN_DECLARE(t38_non_ecm_buffer_state_t *) t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, bool image_mode, int min_row_bits);
|
||||||
|
|
||||||
SPAN_DECLARE(int) t38_non_ecm_buffer_release(t38_non_ecm_buffer_state_t *s);
|
SPAN_DECLARE(int) t38_non_ecm_buffer_release(t38_non_ecm_buffer_state_t *s);
|
||||||
|
|
||||||
@ -94,9 +94,9 @@ SPAN_DECLARE(int) t38_non_ecm_buffer_free(t38_non_ecm_buffer_state_t *s);
|
|||||||
|
|
||||||
/*! \brief Set the mode of a T.38 rate adapting non-ECM buffer context.
|
/*! \brief Set the mode of a T.38 rate adapting non-ECM buffer context.
|
||||||
\param s The buffer context.
|
\param s The buffer context.
|
||||||
\param mode TRUE for image data mode, or FALSE for TCF mode.
|
\param mode True for image data mode, or false for TCF mode.
|
||||||
\param bits The minimum number of bits per FAX image row. */
|
\param bits The minimum number of bits per FAX image row. */
|
||||||
SPAN_DECLARE(void) t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits);
|
SPAN_DECLARE(void) t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, bool image_mode, int min_row_bits);
|
||||||
|
|
||||||
/*! \brief Inject data to T.38 rate adapting non-ECM buffer context.
|
/*! \brief Inject data to T.38 rate adapting non-ECM buffer context.
|
||||||
\param s The buffer context.
|
\param s The buffer context.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user