Accept some spandsp versions older than 0.0.6, provide wrappers around incompatible member access methods.

git-svn-id: http://voip.null.ro/svn/yate@2861 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2009-10-02 13:13:45 +00:00
parent a675788ebd
commit b2a0f337d4
2 changed files with 41 additions and 5 deletions

View File

@ -695,12 +695,39 @@ t38_gateway_init(&t38_g_state,NULL,NULL);
],
HAVE_SPANDSP="yes"
)
CFLAGS="$SAVE_CFLAGS"
AC_LANG_RESTORE
if [[ "x$HAVE_SPANDSP" = "xyes" ]]; then
SPANDSP_INC="-I$ac_cv_use_spandsp"
else
AC_TRY_COMPILE([
#define __STDC_LIMIT_MACROS
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <spandsp.h>
],[
#define fax_get_t30_state(x) (&(x)->t30_state)
fax_state_t fax_state;
t38_terminal_state_t t38_t_state;
t38_gateway_state_t t38_g_state;
fax_init(&fax_state,TRUE);
t30_set_ecm_capability(fax_get_t30_state(&fax_state),1);
t30_set_supported_compressions(fax_get_t30_state(&fax_state),T30_SUPPORT_T6_COMPRESSION);
t30_set_tx_file(fax_get_t30_state(&fax_state),"abc",-1,-1);
fax_set_transmit_on_idle(&fax_state,1);
t38_terminal_init(&t38_t_state,TRUE,NULL,NULL);
t38_gateway_init(&t38_g_state,NULL,NULL);
],
HAVE_SPANDSP="yes"
)
if [[ "x$HAVE_SPANDSP" = "xyes" ]]; then
SPANDSP_INC="-I$ac_cv_use_spandsp -DSPANDSP_PRE006"
fi
fi
CFLAGS="$SAVE_CFLAGS"
AC_LANG_RESTORE
fi
AC_MSG_RESULT([$HAVE_SPANDSP])
fi
AC_SUBST(HAVE_SPANDSP)

View File

@ -47,6 +47,15 @@
#include <fcntl.h>
#include <errno.h>
#ifdef SPANDSP_PRE006
#define fax_get_t30_state(x) (&(x)->t30_state)
#define t38_get_t38_state(x) (&(x)->t38)
#define t38_get_t30_state(x) (&(x)->t30_state)
#else
#define t38_get_t38_state(x) (&(x)->t38_fe.t38)
#define t38_get_t30_state(x) (&(x)->t30)
#endif
using namespace TelEngine;
namespace { // anonymous
@ -473,8 +482,8 @@ T38Terminal::T38Terminal(const char *file, const char *ident, bool sender, bool
(sender ? "transmit" : "receive"),
file,ident,this);
t38_terminal_init(&m_t38,iscaller,txHandler,this);
t38_set_t38_version(&m_t38.t38_fe.t38,1);
init(&m_t38.t30,ident,file,sender);
t38_set_t38_version(t38_get_t38_state(&m_t38),1);
init(t38_get_t30_state(&m_t38),ident,file,sender);
}
T38Terminal::~T38Terminal()
@ -502,7 +511,7 @@ int T38Terminal::txHandler(t38_core_state_t* t38s, void* userData,
void T38Terminal::rxData(const DataBlock& data, unsigned long tStamp)
{
Debug(this,DebugStub,"Please implement T38Terminal::rxData()");
t38_core_rx_ifp_packet(&m_t38.t38_fe.t38,(uint8_t*)data.data(),data.length(),tStamp);
t38_core_rx_ifp_packet(t38_get_t38_state(&m_t38),(uint8_t*)data.data(),data.length(),tStamp);
}
int T38Terminal::txData(const void* buf, int len, int seq, int count)