mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
Improvements to T.4 end of image handling, and the related tests.
A lot of tiny tidy up edits
This commit is contained in:
@@ -700,6 +700,36 @@ static void t4_t6_decode_rx_status(t4_t6_decode_state_t *s, int status)
|
||||
break;
|
||||
case SIG_STATUS_CARRIER_DOWN:
|
||||
case SIG_STATUS_END_OF_DATA:
|
||||
t4_t6_decode_put(s, NULL, 0);
|
||||
break;
|
||||
default:
|
||||
span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected rx status - %d!\n", status);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) t4_t6_decode_put_bit(t4_t6_decode_state_t *s, int bit)
|
||||
{
|
||||
if (bit < 0)
|
||||
{
|
||||
t4_t6_decode_rx_status(s, bit);
|
||||
return TRUE;
|
||||
}
|
||||
s->compressed_image_size++;
|
||||
if (put_bits(s, bit & 1, 1))
|
||||
return T4_DECODE_OK;
|
||||
return T4_DECODE_MORE_DATA;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) t4_t6_decode_put(t4_t6_decode_state_t *s, const uint8_t buf[], size_t len)
|
||||
{
|
||||
int i;
|
||||
uint8_t byte;
|
||||
|
||||
if (len == 0)
|
||||
{
|
||||
/* Finalise the image */
|
||||
if (s->consecutive_eols != EOLS_TO_END_ANY_RX_PAGE)
|
||||
{
|
||||
@@ -720,42 +750,8 @@ static void t4_t6_decode_rx_status(t4_t6_decode_state_t *s, int status)
|
||||
s->rx_skip_bits = 0;
|
||||
s->rx_bitstream = 0;
|
||||
s->consecutive_eols = EOLS_TO_END_ANY_RX_PAGE;
|
||||
break;
|
||||
default:
|
||||
span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected rx status - %d!\n", status);
|
||||
break;
|
||||
return T4_DECODE_OK;
|
||||
}
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) t4_t6_decode_put_bit(t4_t6_decode_state_t *s, int bit)
|
||||
{
|
||||
if (bit < 0)
|
||||
{
|
||||
t4_t6_decode_rx_status(s, bit);
|
||||
return TRUE;
|
||||
}
|
||||
s->compressed_image_size++;
|
||||
return put_bits(s, bit & 1, 1);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) t4_t6_decode_put_byte(t4_t6_decode_state_t *s, int byte)
|
||||
{
|
||||
if (byte < 0)
|
||||
{
|
||||
t4_t6_decode_rx_status(s, byte);
|
||||
return TRUE;
|
||||
}
|
||||
s->compressed_image_size += 8;
|
||||
return put_bits(s, byte & 0xFF, 8);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) t4_t6_decode_put_chunk(t4_t6_decode_state_t *s, const uint8_t buf[], int len)
|
||||
{
|
||||
int i;
|
||||
uint8_t byte;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
|
Reference in New Issue
Block a user