Commit c970cedf authored by Tristan Matthews's avatar Tristan Matthews

* #9750: refactored global.h

parent f0e0e2cc
......@@ -22,7 +22,6 @@ libaudio_la_SOURCES = \
noinst_HEADERS = \
audioloop.h \
common.h \
ringbuffer.h \
mainbuffer.h \
audiorecord.h \
......
......@@ -33,6 +33,7 @@
#include "audio/dcblocker.h"
#include "eventthread.h"
#include "audio/samplerateconverter.h"
#include "logger.h"
#include "manager.h"
#include "noncopyable.h"
#include "dbus/configurationmanager.h"
......
......@@ -31,12 +31,12 @@
* as that of the covered work.
*/
#ifndef __AUDIO_LAYER_H__
#define __AUDIO_LAYER_H__
#ifndef AUDIO_LAYER_H_
#define AUDIO_LAYER_H_
#include "cc_thread.h" // for ost::Mutex
#include <sys/time.h>
#include <vector>
#include "ringbuffer.h"
#include "dcblocker.h"
#include "samplerateconverter.h"
......
......@@ -37,6 +37,7 @@
#include <numeric>
#include <cstring>
#include <cassert>
#include "logger.h"
AudioLoop::AudioLoop() : buffer_(0), size_(0), pos_(0), sampleRate_(0)
{}
......
......@@ -33,7 +33,8 @@
#ifndef __AUDIOLOOP_H__
#define __AUDIOLOOP_H__
#include "global.h" // for SFLDataFormat
#include "sfl_data_format.h"
#include <cstring>
#include "noncopyable.h"
/**
......
......@@ -31,6 +31,8 @@
#include "audiorecord.h"
#include <unistd.h>
#include <sstream> // for stringstream
#include <cstdio>
#include "logger.h"
// structure for the wave header
......
......@@ -35,7 +35,7 @@
#include <cstdlib>
#include <memory>
#include "global.h"
#include "sfl_data_format.h"
#include "noncopyable.h"
class AudioRecord {
......
......@@ -30,6 +30,7 @@
#include "audio_rtp_record_handler.h"
#include <fstream>
#include "logger.h"
#include "sip/sipcall.h"
#include "audio/audiolayer.h"
#include "manager.h"
......
......@@ -34,7 +34,7 @@
#include "audio_rtp_session.h"
#include "audio_symmetric_rtp_session.h"
#include "logger.h"
#include "sip/sdp.h"
#include "sip/sipcall.h"
#include "audio/audiolayer.h"
......
......@@ -28,6 +28,7 @@
* as that of the covered work.
*/
#include "audio_srtp_session.h"
#include "logger.h"
#include <openssl/sha.h>
#include <openssl/hmac.h>
......
......@@ -35,6 +35,7 @@
#include "audio_rtp_session.h"
#include "audio_symmetric_rtp_session.h"
#include "audio_rtp_record_handler.h"
#include "logger.h"
#include "sip/sdp.h"
#include "sip/sipcall.h"
#include "audio/audiolayer.h"
......
......@@ -28,13 +28,17 @@
* as that of the covered work.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "audio_zrtp_session.h"
#include "zrtp_session_callback.h"
#include "fileutils.h"
#include "sip/sipcall.h"
#include "sip/sdp.h"
#include "audio/audiolayer.h"
#include "logger.h"
#include "manager.h"
#include <libzrtpcpp/zrtpccrtp.h>
......
......@@ -28,7 +28,7 @@
* as that of the covered work.
*/
#include "zrtp_session_callback.h"
#include "global.h"
#include "logger.h"
#include "sip/sipcall.h"
#include "dbus/dbusmanager.h"
#include "dbus/callmanager.h"
......
......@@ -29,8 +29,7 @@
* as that of the covered work.
*/
#include "global.h"
#include "../common.h"
#include "sfl_data_format.h"
#include "audiocodec.h"
#include <cassert>
......
......@@ -31,11 +31,15 @@
* as that of the covered work.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "audiocodecfactory.h"
#include <cstdlib>
#include <algorithm> // for std::find
#include "fileutils.h"
#include "logger.h"
AudioCodecFactory::AudioCodecFactory() :
codecsMap_(), defaultCodecOrder_(), libCache_(), codecInMemory_()
......
......@@ -30,11 +30,8 @@
* as that of the covered work.
*/
#include "global.h"
#include "../common.h"
#include "audiocodec.h"
#include "sfl_data_format.h"
#include "g722.h"
#include "noncopyable.h"
......
......@@ -29,10 +29,8 @@
* as that of the covered work.
*/
#include "global.h"
#include "../common.h"
#include "audiocodec.h"
#include "sfl_data_format.h"
#include <cassert>
class Ulaw : public sfl::AudioCodec {
......
......@@ -31,7 +31,7 @@
#ifndef DCBLOCKER_H
#define DCBLOCKER_H
#include "global.h"
#include "sfl_data_format.h"
class DcBlocker {
public:
......
......@@ -32,7 +32,7 @@
#ifndef DELAYDETECTION_H
#define DELAYDETECTION_H
#include "global.h"
#include "sfl_data_format.h"
#include <vector>
// Template size in samples for correlation
......
......@@ -7,7 +7,7 @@
#include <cassert>
#include <stdexcept>
#include "logger.h"
#include "echosuppress.h"
#include "pj/pool.h"
#include "pj/os.h"
......
......@@ -9,7 +9,7 @@
#define ECHOSUPPRESS_H_
#include "pjmedia/echo.h"
#include "global.h"
#include "sfl_data_format.h"
#include "noncopyable.h"
class EchoSuppress {
......
......@@ -2,7 +2,8 @@
#include <climits>
#include <fstream>
#include "global.h"
#include "sfl_data_format.h"
#include "logger.h"
#include "gaincontrol.h"
#define SFL_GAIN_ATTACK_TIME 10
......
......@@ -31,6 +31,7 @@
#include "mainbuffer.h"
#include <utility> // for std::pair
#include "logger.h"
#include "manager.h"
MainBuffer::MainBuffer() : ringBufferMap_(), callIDMap_(), mutex_(), internalSamplingRate_(8000)
......
......@@ -32,7 +32,7 @@
#define NOISESUPPRESS_H
#include <speex/speex_preprocess.h>
#include "global.h" // for SFLDataFormat
#include "sfl_data_format.h"
#include "noncopyable.h"
class NoiseSuppress {
......
......@@ -30,6 +30,7 @@
#include "audiostream.h"
#include "pulselayer.h"
#include "logger.h"
#include <stdexcept>
AudioStream::AudioStream(pa_context *c, pa_threaded_mainloop *m, const char *desc, int type, int smplrate, std::string& deviceName)
......@@ -95,7 +96,7 @@ AudioStream::~AudioStream()
}
void
AudioStream::stream_state_callback(pa_stream* s, void* user_data UNUSED)
AudioStream::stream_state_callback(pa_stream* s, void* /*user_data*/)
{
char str[PA_SAMPLE_SPEC_SNPRINT_MAX];
......
......@@ -36,6 +36,7 @@
#include "pulselayer.h"
#include "audio/samplerateconverter.h"
#include "audio/dcblocker.h"
#include "logger.h"
#include "manager.h"
namespace {
......
......@@ -36,8 +36,8 @@
#include <cstring>
#include <utility> // for std::pair
#include "logger.h"
#include "ringbuffer.h"
#include "global.h"
// corespond to 106 ms (about 5 rtp packets)
#define MIN_BUFFER_SIZE 1280
......
......@@ -33,8 +33,9 @@
#include <samplerate.h>
#include <cmath>
#include <cstring>
#include "global.h"
#include "sfl_data_format.h"
#include "noncopyable.h"
class SamplerateConverter {
......
......@@ -31,7 +31,7 @@
* as that of the covered work.
*/
#include <fstream>
#include <math.h>
#include <cmath>
#include <samplerate.h>
#include <cstring>
#include <vector>
......@@ -41,6 +41,7 @@
#include "audio/codecs/audiocodecfactory.h"
#include "audio/codecs/audiocodec.h"
#include "audio/samplerateconverter.h"
#include "logger.h"
#include "manager.h"
......
......@@ -35,10 +35,13 @@
* YM: 2006-11-15: changes unsigned int to std::string::size_type, thanks to Pierre Pomes (AMD64 compilation)
*/
#include "tone.h"
#include "logger.h"
#include "sfl_data_format.h"
#include <cmath>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <vector>
Tone::Tone(const std::string& definition, unsigned int sampleRate) :
sampleRate_(sampleRate), xhigher_(0.0), xlower_(0.0)
......@@ -55,8 +58,8 @@ Tone::genBuffer(const std::string& definition)
size_ = 0;
SFLDataFormat* buffer = new SFLDataFormat[SIZEBUF]; //1kb
SFLDataFormat* bufferPos = buffer;
std::vector<SFLDataFormat> buffer(SIZEBUF); // 1kb
SFLDataFormat* bufferPos = &(*buffer.begin());
// Number of format sections
std::string::size_type posStart = 0; // position of precedent comma
......@@ -123,9 +126,7 @@ Tone::genBuffer(const std::string& definition)
assert(!buffer_);
buffer_ = new SFLDataFormat[size_];
memcpy(buffer_, buffer, size_ * sizeof(SFLDataFormat)); // copy char, not SFLDataFormat.
delete [] buffer;
memcpy(buffer_, &(*buffer.begin()), size_ * sizeof(SFLDataFormat)); // copy char, not SFLDataFormat.
}
void
......
......@@ -21,6 +21,7 @@
#include <climits>
#include "speexechocancel.h"
#include "logger.h"
#include <speex/speex_echo.h>
#include <speex/speex_preprocess.h>
#include "manager.h"
......
......@@ -33,6 +33,7 @@
#define CALL_H
#include <sstream>
#include <map>
#include "cc_thread.h"
#include "audio/recordable.h"
......
......@@ -29,8 +29,10 @@
* as that of the covered work.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include "../global.h"
#endif
#include "logger.h"
#include <fstream>
#include <cstdlib>
#include <sys/types.h>
......
......@@ -29,8 +29,8 @@
*/
#include "yamlemitter.h"
#include <stdio.h>
#include "../global.h"
#include <cstdio>
#include "logger.h"
namespace Conf {
......
......@@ -29,7 +29,8 @@
*/
#include "yamlnode.h"
#include "global.h"
#include <cstdlib>
#include "logger.h"
namespace Conf {
......@@ -137,7 +138,7 @@ void MappingNode::getValue(const std::string &key, int *i) const
if (!node)
return;
*i = atoi(node->getValue().c_str());
*i = std::atoi(node->getValue().c_str());
}
void MappingNode::getValue(const std::string &key, std::string *v) const
......
......@@ -39,6 +39,7 @@
#include "audio/audiortp/audio_rtp_factory.h"
#include "audio/audiortp/audio_zrtp_session.h"
#include "logger.h"
#include "manager.h"
CallManager::CallManager(DBus::Connection& connection)
......
......@@ -30,15 +30,17 @@
* as that of the covered work.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "configurationmanager.h"
#include <sstream>
#include "config.h"
#include "../manager.h"
#include "sip/sipvoiplink.h"
#include "sip/siptransport.h"
#include "account.h"
#include "logger.h"
#include "sip/sipaccount.h"
const char* ConfigurationManager::SERVER_PATH =
......
......@@ -32,6 +32,7 @@
#include "dbusmanager.h"
#include "global.h"
#include "manager.h"
#include "logger.h"
#include "instance.h"
#include "callmanager.h"
......
......@@ -34,7 +34,10 @@
#include <cstdio>
#include <cstdlib>
#include <signal.h>
#include "global.h"
#include <string>
#include <sstream>
#include "fileutils.h"
#include "logger.h"
namespace {
// returns true if directory exists
......
......@@ -28,8 +28,18 @@
* as that of the covered work.
*/
#ifndef __FILEUTILS_H__
#define __FILEUTILS_H__
#ifndef FILEUTILS_H_
#define FILEUTILS_H_
#define HOMEDIR (getenv ("HOME")) /** Home directory */
#define XDG_DATA_HOME (getenv ("XDG_DATA_HOME"))
#define XDG_CONFIG_HOME (getenv ("XDG_CONFIG_HOME"))
#define XDG_CACHE_HOME (getenv ("XDG_CACHE_HOME"))
#define PIDFILE "sfl.pid"
#define DIR_SEPARATOR_STR "/" // Directory separator char
#define DIR_SEPARATOR_CH = '/' // Directory separator string
namespace fileutils {
void set_program_dir(char *program_path);
......@@ -37,4 +47,4 @@ namespace fileutils {
bool create_pidfile();
}
#endif // __FILEUTILS_H__
#endif // FILEUTILS_H_
......@@ -33,32 +33,17 @@
#ifndef __GLOBAL_H__
#define __GLOBAL_H__
#include <stdio.h>
#include <cstdio>
#include <libintl.h>
#include <locale.h>
#include <string>
#include <stdlib.h>
#include <cstdlib>
#include <sstream>
#include <map>
#include <vector>
#include "logger.h"
#define HOMEDIR (getenv ("HOME")) /** Home directory */
#define XDG_DATA_HOME (getenv ("XDG_DATA_HOME"))
#define XDG_CONFIG_HOME (getenv ("XDG_CONFIG_HOME"))
#define XDG_CACHE_HOME (getenv ("XDG_CACHE_HOME"))
const char * const ZRTP_ZID_FILENAME = "sfl.zid";
//useful typedefs.
typedef signed short SINT16;
typedef signed int SINT32;
#define PIDFILE "sfl.pid"
typedef short SFLDataFormat;
#define SIZEBUF 400000 /** About 12 sec of buffering at 8000 Hz*/
#define ALSA_DFT_CARD_ID 0 /** Index of the default soundcard */
#define PCM_PLUGHW "plughw" /** Alsa plugin */
......@@ -121,7 +106,4 @@ enum {
/** The struct to reflect the order the user wants to use the codecs */
typedef std::vector<int> CodecOrder;
#define DIR_SEPARATOR_STR "/" // Directory separator char
#define DIR_SEPARATOR_CH = '/' /** Directory separator string */
#endif // __GLOBAL_H__
......@@ -36,7 +36,7 @@
#include <fstream>
#include <sys/stat.h> // for mkdir
#include <ctime>
#include "global.h"
#include "fileutils.h"
#include "logger.h"
#include "call.h"
......
......@@ -31,10 +31,13 @@
* as that of the covered work.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "iaxaccount.h"
#include "iaxvoiplink.h"
#include "logger.h"
#include "manager.h"
#include "config/yamlnode.h"
#include "config/yamlemitter.h"
......
......@@ -34,6 +34,7 @@
#include <iax-client.h>
#include "iaxcall.h"
#include "iax2/frame.h"
#include "logger.h"
#include "account.h"
#include "manager.h"
......
......@@ -33,6 +33,7 @@
#include "eventthread.h"
#include "im/instant_messaging.h"
#include "iaxaccount.h"
#include "logger.h"
#include "manager.h"
#include "hooks/urlhook.h"
#include "audio/audiolayer.h"
......
......@@ -35,7 +35,7 @@
#include "voiplink.h"
#include <iax-client.h>
#include "audio/codecs/audiocodec.h" // for DEC_BUFFER_SIZE
#include "global.h"
#include "sfl_data_format.h"
#include "noncopyable.h"
#include "audio/samplerateconverter.h"
......@@ -116,7 +116,7 @@ class IAXVoIPLink : public VoIPLink {
* Cancel a call
* @param id The ID of the call
*/
virtual void cancel(const std::string& id UNUSED) {}
virtual void cancel(const std::string& /*id*/) {}
/**
* Put a call on hold
......
......@@ -38,6 +38,7 @@
#include <getopt.h>
#include "fileutils.h"
#include "dbus/dbusmanager.h"
#include "logger.h"
#include "manager.h"