added configurations "CONFIG+=opus_shared_lib" for using OPUS as a shared lib and "CONFIG+=nocelt" to disable legacy support for the old CELT library

This commit is contained in:
Volker Fischer 2014-07-26 05:58:01 +00:00
parent 42ffd7fbe5
commit afa2f0e812
7 changed files with 118 additions and 40 deletions

View file

@ -8,9 +8,11 @@ QT += widgets \
network \ network \
xml xml
INCLUDEPATH += src \ INCLUDEPATH += src
libs/celt \
libs/opus/include \ INCLUDEPATH_CELT = libs/celt
INCLUDEPATH_OPUS = libs/opus/include \
libs/opus/celt \ libs/opus/celt \
libs/opus/silk \ libs/opus/silk \
libs/opus/silk/float libs/opus/silk/float
@ -114,8 +116,9 @@ HEADERS += src/audiomixerboard.h \
src/soundbase.h \ src/soundbase.h \
src/testbench.h \ src/testbench.h \
src/util.h \ src/util.h \
src/analyzerconsole.h \ src/analyzerconsole.h
libs/celt/cc6_celt.h \
HEADERS_CELT = libs/celt/cc6_celt.h \
libs/celt/cc6_celt_types.h \ libs/celt/cc6_celt_types.h \
libs/celt/cc6_celt_header.h \ libs/celt/cc6_celt_header.h \
libs/celt/cc6__kiss_fft_guts.h \ libs/celt/cc6__kiss_fft_guts.h \
@ -145,8 +148,9 @@ HEADERS += src/audiomixerboard.h \
libs/celt/cc6_quant_bands.h \ libs/celt/cc6_quant_bands.h \
libs/celt/cc6_rate.h \ libs/celt/cc6_rate.h \
libs/celt/cc6_stack_alloc.h \ libs/celt/cc6_stack_alloc.h \
libs/celt/cc6_vq.h \ libs/celt/cc6_vq.h
libs/opus/include/opus.h \
HEADERS_OPUS = libs/opus/include/opus.h \
libs/opus/include/opus_multistream.h \ libs/opus/include/opus_multistream.h \
libs/opus/include/opus_custom.h \ libs/opus/include/opus_custom.h \
libs/opus/include/opus_types.h \ libs/opus/include/opus_types.h \
@ -238,8 +242,9 @@ SOURCES += src/audiomixerboard.cpp \
src/socket.cpp \ src/socket.cpp \
src/soundbase.cpp \ src/soundbase.cpp \
src/util.cpp \ src/util.cpp \
src/analyzerconsole.cpp \ src/analyzerconsole.cpp
libs/celt/cc6_bands.c \
SOURCES_CELT = libs/celt/cc6_bands.c \
libs/celt/cc6_celt.c \ libs/celt/cc6_celt.c \
libs/celt/cc6_cwrs.c \ libs/celt/cc6_cwrs.c \
libs/celt/cc6_entcode.c \ libs/celt/cc6_entcode.c \
@ -258,8 +263,9 @@ SOURCES += src/audiomixerboard.cpp \
libs/celt/cc6_rangedec.c \ libs/celt/cc6_rangedec.c \
libs/celt/cc6_rangeenc.c \ libs/celt/cc6_rangeenc.c \
libs/celt/cc6_rate.c \ libs/celt/cc6_rate.c \
libs/celt/cc6_vq.c \ libs/celt/cc6_vq.c
libs/opus/src/opus.c \
SOURCES_OPUS = libs/opus/src/opus.c \
libs/opus/src/opus_decoder.c \ libs/opus/src/opus_decoder.c \
libs/opus/src/opus_encoder.c \ libs/opus/src/opus_encoder.c \
libs/opus/src/opus_multistream.c \ libs/opus/src/opus_multistream.c \
@ -404,22 +410,6 @@ DISTFILES += AUTHORS \
NEWS \ NEWS \
README \ README \
TODO \ TODO \
libs/celt/AUTHORS \
libs/celt/ChangeLog \
libs/celt/COPYING \
libs/celt/INSTALL \
libs/celt/NEWS \
libs/celt/README \
libs/celt/README_LLCON \
libs/celt/TODO \
libs/opus/AUTHORS \
libs/opus/ChangeLog \
libs/opus/COPYING \
libs/opus/INSTALL \
libs/opus/NEWS \
libs/opus/README \
libs/opus/celt/arm/armopts.s.in \
libs/opus/celt/arm/celt_pitch_xcorr_arm.s \
src/res/CLEDBlack.png \ src/res/CLEDBlack.png \
src/res/CLEDBlackSmall.png \ src/res/CLEDBlackSmall.png \
src/res/CLEDDisabledSmall.png \ src/res/CLEDDisabledSmall.png \
@ -497,3 +487,47 @@ DISTFILES += AUTHORS \
src/res/instrtuba.png \ src/res/instrtuba.png \
src/res/instrviolin.png \ src/res/instrviolin.png \
src/res/instrvocal.png src/res/instrvocal.png
DISTFILES_CELT += libs/celt/AUTHORS \
libs/celt/ChangeLog \
libs/celt/COPYING \
libs/celt/INSTALL \
libs/celt/NEWS \
libs/celt/README \
libs/celt/README_LLCON \
libs/celt/TODO
DISTFILES_OPUS += libs/opus/AUTHORS \
libs/opus/ChangeLog \
libs/opus/COPYING \
libs/opus/INSTALL \
libs/opus/NEWS \
libs/opus/README \
libs/opus/celt/arm/armopts.s.in \
libs/opus/celt/arm/celt_pitch_xcorr_arm.s \
# exclude CELT support if requested
!contains(CONFIG, "nocelt") {
message(Legacy support for CELT enabled.)
INCLUDEPATH += $$INCLUDEPATH_CELT
HEADERS += $$HEADERS_CELT
SOURCES += $$SOURCES_CELT
DISTFILES += $$DISTFILES_CELT
DEFINES += USE_LEGACY_CELT
}
# use external OPUS library if requested
contains(CONFIG, "opus_shared_lib") {
message(OPUS codec is used from a shared library.)
unix {
LIBS += -llibopus
DEFINES += USE_OPUS_SHARED_LIB
}
} else {
INCLUDEPATH += $$INCLUDEPATH_OPUS
HEADERS += $$HEADERS_OPUS
SOURCES += $$SOURCES_OPUS
DISTFILES += $$DISTFILES_OPUS
}

View file

@ -98,9 +98,11 @@ qRegisterMetaType<CHostAddress> ( "CHostAddress" );
SIGNAL ( ChatTextReceived ( QString ) ) ); SIGNAL ( ChatTextReceived ( QString ) ) );
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### // #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
#ifdef USE_LEGACY_CELT
QObject::connect ( &Protocol, QObject::connect ( &Protocol,
SIGNAL ( OpusSupported() ), SIGNAL ( OpusSupported() ),
SIGNAL ( OpusSupported() ) ); SIGNAL ( OpusSupported() ) );
#endif
QObject::connect ( &Protocol, QObject::connect ( &Protocol,
SIGNAL ( NetTranspPropsReceived ( CNetworkTransportProps ) ), SIGNAL ( NetTranspPropsReceived ( CNetworkTransportProps ) ),
@ -380,6 +382,24 @@ void CChannel::OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTranspor
// only the server shall act on network transport properties message // only the server shall act on network transport properties message
if ( bIsServer ) if ( bIsServer )
{ {
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
// if old CELT codec is used, inform the client that the new OPUS codec
// is supported
if ( NetworkTransportProps.eAudioCodingType != CT_OPUS )
{
Protocol.CreateOpusSupportedMes();
}
#ifndef USE_LEGACY_CELT
// in case legacy support for CELT is not enabled, we refuse the
// complete network transport properties if the audio coding type
// is set to CELT
if ( NetworkTransportProps.eAudioCodingType == CT_CELT )
{
return;
}
#endif
Mutex.lock(); Mutex.lock();
{ {
// store received parameters // store received parameters
@ -405,13 +425,6 @@ void CChannel::OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTranspor
MutexConvBuf.unlock(); MutexConvBuf.unlock();
} }
Mutex.unlock(); Mutex.unlock();
// if old CELT codec is used, inform the client that the new OPUS codec
// is supported
if ( NetworkTransportProps.eAudioCodingType != CT_OPUS )
{
Protocol.CreateOpusSupportedMes();
}
} }
} }

View file

@ -30,8 +30,14 @@
#include <QString> #include <QString>
#include <QDateTime> #include <QDateTime>
#include <QMessageBox> #include <QMessageBox>
#include "cc6_celt.h" #ifdef USE_LEGACY_CELT
#include "opus_custom.h" # include "cc6_celt.h"
#endif
#ifdef USE_OPUS_SHARED_LIB
# include "opus/opus_custom.h"
#else
# include "opus_custom.h"
#endif
#include "global.h" #include "global.h"
#include "socket.h" #include "socket.h"
#include "channel.h" #include "channel.h"
@ -304,19 +310,23 @@ protected:
void CreateServerJitterBufferMessage(); void CreateServerJitterBufferMessage();
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### // #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
#ifdef USE_LEGACY_CELT
void SetAudoCompressiontype ( const EAudComprType eNAudCompressionType ); void SetAudoCompressiontype ( const EAudComprType eNAudCompressionType );
#endif
// only one channel is needed for client application // only one channel is needed for client application
CChannel Channel; CChannel Channel;
CProtocol ConnLessProtocol; CProtocol ConnLessProtocol;
// audio encoder/decoder // audio encoder/decoder
#ifdef USE_LEGACY_CELT
cc6_CELTMode* CeltModeMono; cc6_CELTMode* CeltModeMono;
cc6_CELTEncoder* CeltEncoderMono; cc6_CELTEncoder* CeltEncoderMono;
cc6_CELTDecoder* CeltDecoderMono; cc6_CELTDecoder* CeltDecoderMono;
cc6_CELTMode* CeltModeStereo; cc6_CELTMode* CeltModeStereo;
cc6_CELTEncoder* CeltEncoderStereo; cc6_CELTEncoder* CeltEncoderStereo;
cc6_CELTDecoder* CeltDecoderStereo; cc6_CELTDecoder* CeltDecoderStereo;
#endif
OpusCustomMode* OpusMode; OpusCustomMode* OpusMode;
OpusCustomEncoder* OpusEncoderMono; OpusCustomEncoder* OpusEncoderMono;
OpusCustomDecoder* OpusDecoderMono; OpusCustomDecoder* OpusDecoderMono;
@ -397,7 +407,9 @@ public slots:
void OnSndCrdReinitRequest ( int iSndCrdResetType ); void OnSndCrdReinitRequest ( int iSndCrdResetType );
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### // #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
#ifdef USE_LEGACY_CELT
void OnOpusSupported(); void OnOpusSupported();
#endif
signals: signals:
void ConClientListNameMesReceived ( CVector<CChannelInfo> vecChanInfo ); void ConClientListNameMesReceived ( CVector<CChannelInfo> vecChanInfo );
@ -421,7 +433,9 @@ signals:
void Disconnected(); void Disconnected();
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### // #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
#ifdef USE_LEGACY_CELT
void UpstreamRateChanged(); void UpstreamRateChanged();
#endif
}; };
#endif /* !defined ( CLIENT_HOIHGE76GEKJH98_3_43445KJIUHF1912__INCLUDED_ ) */ #endif /* !defined ( CLIENT_HOIHGE76GEKJH98_3_43445KJIUHF1912__INCLUDED_ ) */

View file

@ -458,9 +458,11 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
this, SLOT ( OnCLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString ) ) ); this, SLOT ( OnCLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString ) ) );
#endif #endif
#ifdef USE_LEGACY_CELT
QObject::connect ( pClient, QObject::connect ( pClient,
SIGNAL ( UpstreamRateChanged() ), SIGNAL ( UpstreamRateChanged() ),
this, SLOT ( OnUpstreamRateChanged() ) ); this, SLOT ( OnUpstreamRateChanged() ) );
#endif
QObject::connect ( QCoreApplication::instance(), SIGNAL ( aboutToQuit() ), QObject::connect ( QCoreApplication::instance(), SIGNAL ( aboutToQuit() ),
this, SLOT ( OnAboutToQuit() ) ); this, SLOT ( OnAboutToQuit() ) );

View file

@ -554,9 +554,11 @@ case PROTMESSID_CHANNEL_NAME:
break; break;
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### // #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
#ifdef USE_LEGACY_CELT
case PROTMESSID_OPUS_SUPPORTED: case PROTMESSID_OPUS_SUPPORTED:
bRet = EvaluateOpusSupportedMes(); bRet = EvaluateOpusSupportedMes();
break; break;
#endif
} }
// immediately send acknowledge message // immediately send acknowledge message
@ -1282,8 +1284,9 @@ bool CProtocol::EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData )
const int iRecCodingType = const int iRecCodingType =
static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) ); static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) );
if ( ( iRecCodingType != CT_NONE ) && // note that CT_NONE is not a valid setting but only used for server
( iRecCodingType != CT_CELT ) && // initialization
if ( ( iRecCodingType != CT_CELT ) &&
( iRecCodingType != CT_OPUS ) ) ( iRecCodingType != CT_OPUS ) )
{ {
return true; return true;
@ -1326,6 +1329,7 @@ void CProtocol::CreateOpusSupportedMes()
CVector<uint8_t> ( 0 ) ); CVector<uint8_t> ( 0 ) );
} }
#ifdef USE_LEGACY_CELT
bool CProtocol::EvaluateOpusSupportedMes() bool CProtocol::EvaluateOpusSupportedMes()
{ {
// invoke message action // invoke message action
@ -1333,6 +1337,7 @@ bool CProtocol::EvaluateOpusSupportedMes()
return false; // no error return false; // no error
} }
#endif
// Connection less messages ---------------------------------------------------- // Connection less messages ----------------------------------------------------

View file

@ -213,7 +213,9 @@ protected:
bool EvaluateChatTextMes ( const CVector<uint8_t>& vecData ); bool EvaluateChatTextMes ( const CVector<uint8_t>& vecData );
bool EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData ); bool EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData );
bool EvaluateReqNetwTranspPropsMes(); bool EvaluateReqNetwTranspPropsMes();
#ifdef USE_LEGACY_CELT
bool EvaluateOpusSupportedMes(); bool EvaluateOpusSupportedMes();
#endif
bool EvaluateCLPingMes ( const CHostAddress& InetAddr, bool EvaluateCLPingMes ( const CHostAddress& InetAddr,
const CVector<uint8_t>& vecData ); const CVector<uint8_t>& vecData );

View file

@ -29,8 +29,14 @@
#include <QTimer> #include <QTimer>
#include <QDateTime> #include <QDateTime>
#include <QHostAddress> #include <QHostAddress>
#include "cc6_celt.h" #ifdef USE_LEGACY_CELT
#include "opus_custom.h" # include "cc6_celt.h"
#endif
#ifdef USE_OPUS_SHARED_LIB
# include "opus/opus_custom.h"
#else
# include "opus_custom.h"
#endif
#include "global.h" #include "global.h"
#include "socket.h" #include "socket.h"
#include "channel.h" #include "channel.h"
@ -221,12 +227,14 @@ protected:
QMutex Mutex; QMutex Mutex;
// audio encoder/decoder // audio encoder/decoder
#ifdef USE_LEGACY_CELT
cc6_CELTMode* CeltModeMono[MAX_NUM_CHANNELS]; cc6_CELTMode* CeltModeMono[MAX_NUM_CHANNELS];
cc6_CELTEncoder* CeltEncoderMono[MAX_NUM_CHANNELS]; cc6_CELTEncoder* CeltEncoderMono[MAX_NUM_CHANNELS];
cc6_CELTDecoder* CeltDecoderMono[MAX_NUM_CHANNELS]; cc6_CELTDecoder* CeltDecoderMono[MAX_NUM_CHANNELS];
cc6_CELTMode* CeltModeStereo[MAX_NUM_CHANNELS]; cc6_CELTMode* CeltModeStereo[MAX_NUM_CHANNELS];
cc6_CELTEncoder* CeltEncoderStereo[MAX_NUM_CHANNELS]; cc6_CELTEncoder* CeltEncoderStereo[MAX_NUM_CHANNELS];
cc6_CELTDecoder* CeltDecoderStereo[MAX_NUM_CHANNELS]; cc6_CELTDecoder* CeltDecoderStereo[MAX_NUM_CHANNELS];
#endif
OpusCustomMode* OpusMode[MAX_NUM_CHANNELS]; OpusCustomMode* OpusMode[MAX_NUM_CHANNELS];
OpusCustomEncoder* OpusEncoderMono[MAX_NUM_CHANNELS]; OpusCustomEncoder* OpusEncoderMono[MAX_NUM_CHANNELS];
OpusCustomDecoder* OpusDecoderMono[MAX_NUM_CHANNELS]; OpusCustomDecoder* OpusDecoderMono[MAX_NUM_CHANNELS];