From cb4e31b6cf641407476a68b43e4fc9edf24c3bc1 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Mon, 22 Jul 2013 18:48:35 +0800 Subject: [PATCH] Tweaks to spandsp --- libs/spandsp/src/adsi.c | 4 ++-- libs/spandsp/src/spandsp/fsk.h | 7 ++++--- libs/spandsp/src/spandsp/t4_tx.h | 10 +++++++++- libs/spandsp/src/v18.c | 8 ++++---- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/libs/spandsp/src/adsi.c b/libs/spandsp/src/adsi.c index 44add41be0..df327bf3c5 100644 --- a/libs/spandsp/src/adsi.c +++ b/libs/spandsp/src/adsi.c @@ -384,7 +384,7 @@ static void start_tx(adsi_tx_state_t *s) dtmf_tx_init(&s->dtmftx, NULL, NULL); break; case ADSI_STANDARD_TDD: - fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_WEITBRECHT], 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); /* Schedule an explicit shift at the start of baudot transmission */ s->baudot_shift = 2; @@ -448,7 +448,7 @@ SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s, case ADSI_STANDARD_TDD: /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and ride over the fraction. */ - fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_WEITBRECHT], FSK_FRAME_MODE_5N1_FRAMES, adsi_tdd_put_async_byte, s); + fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_WEITBRECHT_4545], FSK_FRAME_MODE_5N1_FRAMES, adsi_tdd_put_async_byte, s); break; } s->standard = standard; diff --git a/libs/spandsp/src/spandsp/fsk.h b/libs/spandsp/src/spandsp/fsk.h index bcb8df1de7..b65cd7842f 100644 --- a/libs/spandsp/src/spandsp/fsk.h +++ b/libs/spandsp/src/spandsp/fsk.h @@ -109,9 +109,10 @@ enum FSK_BELL103CH1, FSK_BELL103CH2, FSK_BELL202, - FSK_WEITBRECHT, /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */ - FSK_WEITBRECHT50, /* 50 baud version, used for TDD (Telecom Device for the Deaf) */ - FSK_V21CH1_110 /* 110 bps version of V.21 channel 1, as used by V.18 */ + FSK_WEITBRECHT_4545, /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */ + FSK_WEITBRECHT_50, /* 50 baud version, used for TDD (Telecom Device for the Deaf) */ + FSK_WEITBRECHT_476, /* 47.6 baud version, used for V.18 probing */ + FSK_V21CH1_110 /* 110 bps version of V.21 channel 1, as used by V.18 */ }; enum diff --git a/libs/spandsp/src/spandsp/t4_tx.h b/libs/spandsp/src/spandsp/t4_tx.h index bcf75d6c02..c5e08265f4 100644 --- a/libs/spandsp/src/spandsp/t4_tx.h +++ b/libs/spandsp/src/spandsp/t4_tx.h @@ -212,6 +212,14 @@ ImageLayer(34732) LONG #define COMPRESSION_T43 10 #endif +typedef enum +{ + T4_IMAGE_FORMAT_OK = 0, + T4_IMAGE_FORMAT_INCOMPATIBLE = -1, + T4_IMAGE_FORMAT_NOSIZESUPPORT = -2, + T4_IMAGE_FORMAT_NORESSUPPORT = -3 +} t4_image_format_status_t; + #if defined(__cplusplus) extern "C" { #endif @@ -267,7 +275,7 @@ SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s); indicates that the end of the document has been reached. */ SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len); -/*! \brief Set the encoding for the encoded data. +/*! \brief Set the compression for the encoded data. \param s The T.4 context. \param encoding The encoding. \return 0 for success, otherwise -1. */ diff --git a/libs/spandsp/src/v18.c b/libs/spandsp/src/v18.c index e821aa3b39..70a9cacc91 100644 --- a/libs/spandsp/src/v18.c +++ b/libs/spandsp/src/v18.c @@ -973,25 +973,25 @@ SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s, { case V18_MODE_5BIT_45: s->repeat_shifts = mode & 0x100; - fsk_tx_init(&s->fsk_tx, &preset_fsk_specs[FSK_WEITBRECHT], async_tx_get_bit, &s->async_tx); + fsk_tx_init(&s->fsk_tx, &preset_fsk_specs[FSK_WEITBRECHT_4545], async_tx_get_bit, &s->async_tx); async_tx_init(&s->async_tx, 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); /* Schedule an explicit shift at the start of baudot transmission */ s->baudot_tx_shift = 2; /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and ride over the fraction. */ - fsk_rx_init(&s->fsk_rx, &preset_fsk_specs[FSK_WEITBRECHT], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); + fsk_rx_init(&s->fsk_rx, &preset_fsk_specs[FSK_WEITBRECHT_4545], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); s->baudot_rx_shift = 0; s->next_byte = (uint8_t) 0xFF; break; case V18_MODE_5BIT_50: s->repeat_shifts = mode & 0x100; - fsk_tx_init(&s->fsk_tx, &preset_fsk_specs[FSK_WEITBRECHT50], async_tx_get_bit, &s->async_tx); + fsk_tx_init(&s->fsk_tx, &preset_fsk_specs[FSK_WEITBRECHT_50], async_tx_get_bit, &s->async_tx); async_tx_init(&s->async_tx, 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); /* Schedule an explicit shift at the start of baudot transmission */ s->baudot_tx_shift = 2; /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and ride over the fraction. */ - fsk_rx_init(&s->fsk_rx, &preset_fsk_specs[FSK_WEITBRECHT50], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); + fsk_rx_init(&s->fsk_rx, &preset_fsk_specs[FSK_WEITBRECHT_50], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); s->baudot_rx_shift = 0; s->next_byte = (uint8_t) 0xFF; break;