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 \
xml
INCLUDEPATH += src \
libs/celt \
libs/opus/include \
INCLUDEPATH += src
INCLUDEPATH_CELT = libs/celt
INCLUDEPATH_OPUS = libs/opus/include \
libs/opus/celt \
libs/opus/silk \
libs/opus/silk/float
@ -114,8 +116,9 @@ HEADERS += src/audiomixerboard.h \
src/soundbase.h \
src/testbench.h \
src/util.h \
src/analyzerconsole.h \
libs/celt/cc6_celt.h \
src/analyzerconsole.h
HEADERS_CELT = libs/celt/cc6_celt.h \
libs/celt/cc6_celt_types.h \
libs/celt/cc6_celt_header.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_rate.h \
libs/celt/cc6_stack_alloc.h \
libs/celt/cc6_vq.h \
libs/opus/include/opus.h \
libs/celt/cc6_vq.h
HEADERS_OPUS = libs/opus/include/opus.h \
libs/opus/include/opus_multistream.h \
libs/opus/include/opus_custom.h \
libs/opus/include/opus_types.h \
@ -238,8 +242,9 @@ SOURCES += src/audiomixerboard.cpp \
src/socket.cpp \
src/soundbase.cpp \
src/util.cpp \
src/analyzerconsole.cpp \
libs/celt/cc6_bands.c \
src/analyzerconsole.cpp
SOURCES_CELT = libs/celt/cc6_bands.c \
libs/celt/cc6_celt.c \
libs/celt/cc6_cwrs.c \
libs/celt/cc6_entcode.c \
@ -258,8 +263,9 @@ SOURCES += src/audiomixerboard.cpp \
libs/celt/cc6_rangedec.c \
libs/celt/cc6_rangeenc.c \
libs/celt/cc6_rate.c \
libs/celt/cc6_vq.c \
libs/opus/src/opus.c \
libs/celt/cc6_vq.c
SOURCES_OPUS = libs/opus/src/opus.c \
libs/opus/src/opus_decoder.c \
libs/opus/src/opus_encoder.c \
libs/opus/src/opus_multistream.c \
@ -404,22 +410,6 @@ DISTFILES += AUTHORS \
NEWS \
README \
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/CLEDBlackSmall.png \
src/res/CLEDDisabledSmall.png \
@ -497,3 +487,47 @@ DISTFILES += AUTHORS \
src/res/instrtuba.png \
src/res/instrviolin.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 ) ) );
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
#ifdef USE_LEGACY_CELT
QObject::connect ( &Protocol,
SIGNAL ( OpusSupported() ),
SIGNAL ( OpusSupported() ) );
#endif
QObject::connect ( &Protocol,
SIGNAL ( NetTranspPropsReceived ( CNetworkTransportProps ) ),
@ -380,6 +382,24 @@ void CChannel::OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTranspor
// only the server shall act on network transport properties message
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();
{
// store received parameters
@ -405,13 +425,6 @@ void CChannel::OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTranspor
MutexConvBuf.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 <QDateTime>
#include <QMessageBox>
#ifdef USE_LEGACY_CELT
# 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 "socket.h"
#include "channel.h"
@ -304,19 +310,23 @@ protected:
void CreateServerJitterBufferMessage();
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
#ifdef USE_LEGACY_CELT
void SetAudoCompressiontype ( const EAudComprType eNAudCompressionType );
#endif
// only one channel is needed for client application
CChannel Channel;
CProtocol ConnLessProtocol;
// audio encoder/decoder
#ifdef USE_LEGACY_CELT
cc6_CELTMode* CeltModeMono;
cc6_CELTEncoder* CeltEncoderMono;
cc6_CELTDecoder* CeltDecoderMono;
cc6_CELTMode* CeltModeStereo;
cc6_CELTEncoder* CeltEncoderStereo;
cc6_CELTDecoder* CeltDecoderStereo;
#endif
OpusCustomMode* OpusMode;
OpusCustomEncoder* OpusEncoderMono;
OpusCustomDecoder* OpusDecoderMono;
@ -397,7 +407,9 @@ public slots:
void OnSndCrdReinitRequest ( int iSndCrdResetType );
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
#ifdef USE_LEGACY_CELT
void OnOpusSupported();
#endif
signals:
void ConClientListNameMesReceived ( CVector<CChannelInfo> vecChanInfo );
@ -421,7 +433,9 @@ signals:
void Disconnected();
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
#ifdef USE_LEGACY_CELT
void UpstreamRateChanged();
#endif
};
#endif /* !defined ( CLIENT_HOIHGE76GEKJH98_3_43445KJIUHF1912__INCLUDED_ ) */

View file

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

View file

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

View file

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

View file

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