TT#14008 support building against FreeSwitch version of SpanDSP

Change-Id: I472161e6368886240a4ba08e269542fd3f6e4d41
pull/1072/head
Richard Fuchs 5 years ago
parent 5001a02d44
commit 1147f856c0

1
daemon/.gitignore vendored

@ -19,3 +19,4 @@ dtmflib.c
*-test
dtmf_rx_fillin.h
*-test.c
spandsp_logging.h

@ -140,7 +140,7 @@ MANS= $(PODS:.pod=.8)
include ../lib/common.Makefile
ifeq ($(with_transcoding),yes)
.depend: dtmf_rx_fillin.h
.depend: dtmf_rx_fillin.h spandsp_logging.h
endif
include .depend

@ -8,6 +8,7 @@
#include <assert.h>
#include <spandsp/t30.h>
#include <spandsp/logging.h>
#include "spandsp_logging.h"
#include "codec.h"
#include "call.h"
#include "log.h"
@ -76,7 +77,7 @@ static void g_string_null_extend(GString *s, size_t len) {
memset(s->str + oldb, 0, newb);
}
static void spandsp_logging_func(int level, const char *text) {
static void spandsp_logging_func(SPAN_LOG_ARGS) {
if (level <= SPAN_LOG_PROTOCOL_ERROR)
level = LOG_ERR;
else if (level <= SPAN_LOG_PROTOCOL_WARNING)
@ -407,7 +408,7 @@ int t38_gateway_pair(struct call_media *t38_media, struct call_media *pcm_media,
t38_set_max_datagram_size(t38, opts.max_ifp);
logging_state_t *ls = t38_gateway_get_logging_state(tg->gw);
span_log_set_message_handler(ls, spandsp_logging_func);
my_span_set_log(ls, spandsp_logging_func);
span_log_set_level(ls, span_log_level_map(get_log_level()));
packet_sequencer_init(&tg->sequencer, (GDestroyNotify) __udptl_packet_free);
@ -769,7 +770,7 @@ void t38_gateway_stop(struct t38_gateway *tg) {
void t38_init(void) {
span_set_message_handler(NULL);
my_span_mh(NULL);
}

@ -33,6 +33,7 @@ struct t38_options {
#include <inttypes.h>
#include <sys/types.h>
#include <stdbool.h>
#include <spandsp/telephony.h>
#include <spandsp/logging.h>
#include <spandsp/t38_core.h>

@ -11,7 +11,7 @@ debug:
dep: .depend
BUILD_TEST_ALTS = fix_frame_channel_layout.h dtmf_rx_fillin.h
BUILD_TEST_ALTS = fix_frame_channel_layout.h dtmf_rx_fillin.h spandsp_logging.h
clean:
rm -f $(OBJS) $(TARGET) $(LIBSRCS) $(DAEMONSRCS) $(MANS) $(ADD_CLEAN) .depend core core.*

@ -1,5 +1,6 @@
#include <sys/types.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include <spandsp/telephony.h>
#include <spandsp/super_tone_rx.h>

@ -1,5 +1,6 @@
#include <sys/types.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include <spandsp/telephony.h>
#include <spandsp/super_tone_rx.h>

@ -0,0 +1,8 @@
#define SPAN_LOG_ARGS int level, const char *text
#define PHASE_E_HANDLER_ARGS t30_state_t *s, void *user_data, int result
INLINE void my_span_set_log(logging_state_t *ls, message_handler_func_t h) {
span_log_set_message_handler(ls, h);
}
INLINE void my_span_mh(message_handler_func_t h) {
span_set_message_handler(h);
}

@ -0,0 +1,8 @@
#define SPAN_LOG_ARGS void *user_data, int level, const char *text
#define PHASE_E_HANDLER_ARGS void *user_data, int result
INLINE void my_span_set_log(logging_state_t *ls, message_handler_func_t h) {
span_log_set_message_handler(ls, h, NULL);
}
INLINE void my_span_mh(message_handler_func_t h) {
span_set_message_handler(h, NULL);
}

@ -0,0 +1,20 @@
#include <inttypes.h>
#include <sys/types.h>
#include <stdbool.h>
#include <stddef.h>
#include <spandsp/telephony.h>
#include <spandsp/logging.h>
#include "compat.h"
#include "spandsp_logging.h"
void logfunc(SPAN_LOG_ARGS) {
return;
}
int main(void) {
return 0;
logging_state_t *ls = NULL;
my_span_set_log(ls, logfunc);
my_span_mh(NULL);
return 0;
}

1
t/.gitignore vendored

@ -59,3 +59,4 @@ spandsp_recv_fax_pcm
spandsp_recv_fax_t38
spandsp_send_fax_pcm
spandsp_send_fax_t38
spandsp_logging.h

@ -153,5 +153,5 @@ tests-preload.so: tests-preload.c
$(CC) -g -D_GNU_SOURCE -std=c99 -o $@ -Wall -shared -fPIC $< -ldl
ifeq ($(with_transcoding),yes)
.depend: dtmf_rx_fillin.h
.depend: dtmf_rx_fillin.h spandsp_logging.h
endif

@ -2,6 +2,7 @@
#include <stdio.h>
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
@ -11,11 +12,16 @@
#include <spandsp/t30.h>
#include <spandsp/t30_api.h>
#include <spandsp/fax.h>
#include "compat.h"
#include "spandsp_logging.h"
#define SAMPLES_PER_CHUNK 160
#define MICROSECONDS_PER_CHUNK 20000
#ifndef FALSE
# define FALSE false
#endif
// from ITU G.191
@ -72,7 +78,7 @@ void alaw_expand (size_t lseg, uint8_t *logbuf, int16_t *linbuf) {
int done = 0;
static void phase_e_handler(t30_state_t *s, void *user_data, int result) {
static void phase_e_handler(PHASE_E_HANDLER_ARGS) {
fprintf(stderr, "recv: phase E result %i\n", result);
assert(result == T30_ERR_OK);
done = 1;
@ -101,8 +107,8 @@ int main(int argc, char **argv) {
t30_set_rx_file(t30, output_file_name, -1);
t30_set_phase_e_handler(t30, phase_e_handler, NULL);
t30_set_ecm_capability(t30, use_ecm);
if (use_ecm)
t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
// if (use_ecm)
// t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
t30_set_minimum_scan_line_time(t30, 40);
struct timeval now, next;

@ -2,6 +2,7 @@
#include <stdio.h>
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
@ -14,10 +15,15 @@
#include <spandsp/t30_api.h>
#include <spandsp/t38_terminal.h>
#include <spandsp/fax.h>
#include "compat.h"
#include "spandsp_logging.h"
#define SAMPLES_PER_CHUNK 160
#ifndef FALSE
# define FALSE false
#endif
static int packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) {
@ -38,7 +44,7 @@ static int packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *b
return 0;
}
static void phase_e_handler(t30_state_t *s, void *user_data, int result) {
static void phase_e_handler(PHASE_E_HANDLER_ARGS) {
fprintf(stderr, "phase E result %i\n", result);
assert(result == T30_ERR_OK);
}

@ -2,6 +2,7 @@
#include <stdio.h>
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
@ -11,11 +12,16 @@
#include <spandsp/t30.h>
#include <spandsp/t30_api.h>
#include <spandsp/fax.h>
#include "compat.h"
#include "spandsp_logging.h"
#define SAMPLES_PER_CHUNK 160
#define MICROSECONDS_PER_CHUNK 20000
#ifndef TRUE
# define TRUE true
#endif
// from ITU G.191
@ -72,7 +78,7 @@ void alaw_expand (size_t lseg, uint8_t *logbuf, int16_t *linbuf) {
int done = 0;
static void phase_e_handler(t30_state_t *s, void *user_data, int result) {
static void phase_e_handler(PHASE_E_HANDLER_ARGS) {
fprintf(stderr, "send: phase E result %i\n", result);
assert(result == T30_ERR_OK);
done = 1;
@ -101,8 +107,8 @@ int main(int argc, char **argv) {
t30_set_tx_file(t30, input_file_name, -1, -1);
t30_set_phase_e_handler(t30, phase_e_handler, NULL);
t30_set_ecm_capability(t30, use_ecm);
if (use_ecm)
t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
// if (use_ecm)
// t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
t30_set_minimum_scan_line_time(t30, 40);
struct timeval now, next;

@ -2,6 +2,7 @@
#include <stdio.h>
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
@ -14,10 +15,15 @@
#include <spandsp/t30_api.h>
#include <spandsp/t38_terminal.h>
#include <spandsp/fax.h>
#include "compat.h"
#include "spandsp_logging.h"
#define SAMPLES_PER_CHUNK 160
#ifndef TRUE
# define TRUE true
#endif
static int packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) {
@ -40,7 +46,7 @@ static int packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *b
int g_done = 0;
static void phase_e_handler(t30_state_t *s, void *user_data, int result) {
static void phase_e_handler(PHASE_E_HANDLER_ARGS) {
fprintf(stderr, "phase E result %i\n", result);
assert(result == T30_ERR_OK);
g_done = 1;

@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdbool.h>
#include <endian.h>
#include <spandsp/telephony.h>
#include <spandsp/super_tone_rx.h>

Loading…
Cancel
Save