Commit 4b599526 authored by Julien Bonjean's avatar Julien Bonjean

[#2402] Code indent

parent 028a833c
......@@ -43,14 +43,17 @@ Account::Account (const AccountID& accountID, std::string type) :
, _ringtonePath ("/usr/share/sflphone/ringtones/konga.ul")
, _ringtoneEnabled (true)
, _displayName ("")
, _useragent ("SFLphone") {
, _useragent ("SFLphone")
{
setRegistrationState (Unregistered);
}
Account::~Account() {
Account::~Account()
{
}
void Account::loadConfig() {
void Account::loadConfig()
{
// If IAX is not supported, do not register this account
#ifndef USE_IAX
......@@ -63,7 +66,8 @@ void Account::loadConfig() {
loadAudioCodecs ();
}
void Account::setRegistrationState (RegistrationState state) {
void Account::setRegistrationState (RegistrationState state)
{
if (state != _registrationState) {
_debug ("Account: set registration state");
......@@ -74,7 +78,8 @@ void Account::setRegistrationState (RegistrationState state) {
}
}
void Account::loadAudioCodecs (void) {
void Account::loadAudioCodecs (void)
{
// if the user never set the codec list, use the default configuration for this account
if (_codecStr == "") {
......@@ -90,7 +95,8 @@ void Account::loadAudioCodecs (void) {
}
}
void Account::setActiveCodecs (const std::vector <std::string> &list) {
void Account::setActiveCodecs (const std::vector <std::string> &list)
{
_codecOrder.clear();
// list contains the ordered payload of active codecs picked by the user for this account
......
......@@ -36,15 +36,18 @@
#include "iax/iaxaccount.h"
#endif
AccountCreator::AccountCreator() {
AccountCreator::AccountCreator()
{
}
AccountCreator::~AccountCreator() {
AccountCreator::~AccountCreator()
{
}
Account*
AccountCreator::createAccount (AccountType type, AccountID accountID) {
AccountCreator::createAccount (AccountType type, AccountID accountID)
{
switch (type) {
case SIP_ACCOUNT: {
......
......@@ -65,7 +65,8 @@ AlsaLayer::AlsaLayer (ManagerImpl* manager)
}
// Destructor
AlsaLayer::~AlsaLayer (void) {
AlsaLayer::~AlsaLayer (void)
{
_debug ("Audio: Destroy of ALSA layer");
closeLayer();
......@@ -76,7 +77,8 @@ AlsaLayer::~AlsaLayer (void) {
}
bool
AlsaLayer::closeLayer() {
AlsaLayer::closeLayer()
{
_debugAlsa ("Audio: Close ALSA streams");
try {
......@@ -103,7 +105,8 @@ AlsaLayer::closeLayer() {
}
bool
AlsaLayer::openDevice (int indexIn, int indexOut, int indexRing, int sampleRate, int frameSize, int stream , std::string plugin) {
AlsaLayer::openDevice (int indexIn, int indexOut, int indexRing, int sampleRate, int frameSize, int stream , std::string plugin)
{
/* Close the devices before open it */
if (stream == SFL_PCM_BOTH && is_capture_open() == true && is_playback_open() == true) {
closeCaptureStream();
......@@ -146,7 +149,8 @@ AlsaLayer::openDevice (int indexIn, int indexOut, int indexRing, int sampleRate,
}
void
AlsaLayer::startStream (void) {
AlsaLayer::startStream (void)
{
_debug ("Audio: Start stream");
if (_audiofilter)
......@@ -209,7 +213,8 @@ AlsaLayer::startStream (void) {
}
void
AlsaLayer::stopStream (void) {
AlsaLayer::stopStream (void)
{
_debug ("Audio: Stop stream");
try {
......@@ -238,7 +243,8 @@ AlsaLayer::stopStream (void) {
}
bool AlsaLayer::isCaptureActive (void) {
bool AlsaLayer::isCaptureActive (void)
{
ost::MutexLock guard (_mutex);
if (_CaptureHandle)
......@@ -248,7 +254,8 @@ bool AlsaLayer::isCaptureActive (void) {
}
void AlsaLayer::setEchoCancelState (bool state) {
void AlsaLayer::setEchoCancelState (bool state)
{
// if a stream already running
if (AudioLayer::_echoCancel)
_echoCancel->setEchoCancelState (state);
......@@ -256,7 +263,8 @@ void AlsaLayer::setEchoCancelState (bool state) {
AudioLayer::_echocancelstate = state;
}
void AlsaLayer::setNoiseSuppressState (bool state) {
void AlsaLayer::setNoiseSuppressState (bool state)
{
// if a stream already opened
if (AudioLayer::_echoCancel)
_echoCancel->setNoiseSuppressState (state);
......@@ -270,7 +278,8 @@ void AlsaLayer::setNoiseSuppressState (bool state) {
///////////////// ALSA PRIVATE FUNCTIONS ////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
void AlsaLayer::stopCaptureStream (void) {
void AlsaLayer::stopCaptureStream (void)
{
int err;
if (_CaptureHandle) {
......@@ -284,7 +293,8 @@ void AlsaLayer::stopCaptureStream (void) {
}
}
void AlsaLayer::closeCaptureStream (void) {
void AlsaLayer::closeCaptureStream (void)
{
int err;
if (is_capture_prepared() == true && is_capture_running() == true)
......@@ -300,7 +310,8 @@ void AlsaLayer::closeCaptureStream (void) {
}
}
void AlsaLayer::startCaptureStream (void) {
void AlsaLayer::startCaptureStream (void)
{
int err;
if (_CaptureHandle && !is_capture_running()) {
......@@ -313,7 +324,8 @@ void AlsaLayer::startCaptureStream (void) {
}
}
void AlsaLayer::prepareCaptureStream (void) {
void AlsaLayer::prepareCaptureStream (void)
{
int err;
if (is_capture_open() && !is_capture_prepared()) {
......@@ -326,7 +338,8 @@ void AlsaLayer::prepareCaptureStream (void) {
}
}
void AlsaLayer::stopPlaybackStream (void) {
void AlsaLayer::stopPlaybackStream (void)
{
int err;
if (_RingtoneHandle && is_playback_running()) {
......@@ -348,7 +361,8 @@ void AlsaLayer::stopPlaybackStream (void) {
}
void AlsaLayer::closePlaybackStream (void) {
void AlsaLayer::closePlaybackStream (void)
{
int err;
if (is_playback_prepared() == true && is_playback_running() == true)
......@@ -373,7 +387,8 @@ void AlsaLayer::closePlaybackStream (void) {
}
void AlsaLayer::startPlaybackStream (void) {
void AlsaLayer::startPlaybackStream (void)
{
int err;
if (_PlaybackHandle && !is_playback_running()) {
......@@ -386,7 +401,8 @@ void AlsaLayer::startPlaybackStream (void) {
}
}
void AlsaLayer::preparePlaybackStream (void) {
void AlsaLayer::preparePlaybackStream (void)
{
int err;
if (is_playback_open() && !is_playback_prepared()) {
......@@ -428,7 +444,8 @@ void AlsaLayer::recoverPlaybackStream(int error)
*/
bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate) {
bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate)
{
snd_pcm_hw_params_t *hwparams = NULL;
snd_pcm_sw_params_t *swparams = NULL;
......@@ -553,7 +570,8 @@ bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate) {
bool
AlsaLayer::open_device (std::string pcm_p, std::string pcm_c, std::string pcm_r, int flag) {
AlsaLayer::open_device (std::string pcm_p, std::string pcm_c, std::string pcm_r, int flag)
{
int err;
......@@ -623,7 +641,8 @@ AlsaLayer::open_device (std::string pcm_p, std::string pcm_c, std::string pcm_r,
//TODO first frame causes broken pipe (underrun) because not enough data are send --> make the handle wait to be ready
int
AlsaLayer::write (void* buffer, int length, snd_pcm_t * handle) {
AlsaLayer::write (void* buffer, int length, snd_pcm_t * handle)
{
if (_trigger_request == true) {
_trigger_request = false;
startPlaybackStream ();
......@@ -664,7 +683,8 @@ AlsaLayer::write (void* buffer, int length, snd_pcm_t * handle) {
}
int
AlsaLayer::read (void* buffer, int toCopy) {
AlsaLayer::read (void* buffer, int toCopy)
{
//ost::MutexLock lock( _mutex );
int samples;
......@@ -709,7 +729,8 @@ AlsaLayer::read (void* buffer, int toCopy) {
}
void
AlsaLayer::handle_xrun_capture (void) {
AlsaLayer::handle_xrun_capture (void)
{
_debugAlsa ("Audio: Handle xrun capture");
snd_pcm_status_t* status;
......@@ -728,7 +749,8 @@ AlsaLayer::handle_xrun_capture (void) {
}
void
AlsaLayer::handle_xrun_playback (snd_pcm_t *handle) {
AlsaLayer::handle_xrun_playback (snd_pcm_t *handle)
{
_debugAlsa ("Audio: Handle xrun playback");
int state;
......@@ -752,7 +774,8 @@ AlsaLayer::handle_xrun_playback (snd_pcm_t *handle) {
}
std::string
AlsaLayer::buildDeviceTopo (std::string plugin, int card, int subdevice) {
AlsaLayer::buildDeviceTopo (std::string plugin, int card, int subdevice)
{
std::stringstream ss,ss1;
std::string pcm = plugin;
......@@ -777,7 +800,8 @@ AlsaLayer::buildDeviceTopo (std::string plugin, int card, int subdevice) {
}
std::vector<std::string>
AlsaLayer::getSoundCardsInfo (int stream) {
AlsaLayer::getSoundCardsInfo (int stream)
{
std::vector<std::string> cards_id;
HwIDPair p;
......@@ -837,7 +861,8 @@ AlsaLayer::getSoundCardsInfo (int stream) {
bool
AlsaLayer::soundCardIndexExist (int card , int stream) {
AlsaLayer::soundCardIndexExist (int card , int stream)
{
snd_ctl_t* handle;
snd_pcm_info_t *pcminfo;
snd_pcm_info_alloca (&pcminfo);
......@@ -857,7 +882,8 @@ AlsaLayer::soundCardIndexExist (int card , int stream) {
}
int
AlsaLayer::soundCardGetIndex (std::string description) {
AlsaLayer::soundCardGetIndex (std::string description)
{
unsigned int i;
for (i = 0 ; i < IDSoundCards.size() ; i++) {
......@@ -871,7 +897,8 @@ AlsaLayer::soundCardGetIndex (std::string description) {
return 0;
}
void AlsaLayer::audioCallback (void) {
void AlsaLayer::audioCallback (void)
{
int toGet, urgentAvailBytes, normalAvailBytes, maxBytes;
unsigned short spkrVolume, micVolume;
......@@ -1117,7 +1144,8 @@ void AlsaLayer::audioCallback (void) {
}
}
void* AlsaLayer::adjustVolume (void* buffer , int len, int stream) {
void* AlsaLayer::adjustVolume (void* buffer , int len, int stream)
{
int vol, i, size;
SFLDataFormat *src = NULL;
......
......@@ -34,10 +34,12 @@
const double AudioDevice::DEFAULT_RATE = 8000.0;
AudioDevice::AudioDevice (int id, const std::string& name) :
_id (id), _name (name), _rate (DEFAULT_RATE) {
_id (id), _name (name), _rate (DEFAULT_RATE)
{
_rate = DEFAULT_RATE;
}
AudioDevice::~AudioDevice() {
AudioDevice::~AudioDevice()
{
}
......@@ -30,7 +30,8 @@
#include "audiolayer.h"
void AudioLayer::flushMain (void) {
void AudioLayer::flushMain (void)
{
ost::MutexLock guard (_mutex);
// should pass call id
......@@ -41,13 +42,15 @@ void AudioLayer::flushMain (void) {
}
void AudioLayer::flushUrgent (void) {
void AudioLayer::flushUrgent (void)
{
ost::MutexLock guard (_mutex);
_urgentRingBuffer.flushAll();
}
int AudioLayer::putUrgent (void* buffer, int toCopy) {
int AudioLayer::putUrgent (void* buffer, int toCopy)
{
int a;
ost::MutexLock guard (_mutex);
......@@ -62,7 +65,8 @@ int AudioLayer::putUrgent (void* buffer, int toCopy) {
return 0;
}
int AudioLayer::putMain (void *buffer, int toCopy, CallID call_id) {
int AudioLayer::putMain (void *buffer, int toCopy, CallID call_id)
{
int a;
ost::MutexLock guard (_mutex);
......
......@@ -36,16 +36,19 @@
#include <math.h>
#include <strings.h>
AudioLoop::AudioLoop() :_buffer (0), _size (0), _pos (0), _sampleRate (0) {
AudioLoop::AudioLoop() :_buffer (0), _size (0), _pos (0), _sampleRate (0)
{
}
AudioLoop::~AudioLoop() {
AudioLoop::~AudioLoop()
{
delete [] _buffer;
_buffer = 0;
}
int
AudioLoop::getNext (SFLDataFormat* output, int nb, short volume) {
AudioLoop::getNext (SFLDataFormat* output, int nb, short volume)
{
int copied = 0;
int block;
int pos = _pos;
......
......@@ -38,29 +38,34 @@ AudioProcessing::AudioProcessing (Algorithm *_algo) : _algorithm (_algo) {}
AudioProcessing::~AudioProcessing (void) {}
void AudioProcessing::resetAlgorithm (void) {
void AudioProcessing::resetAlgorithm (void)
{
if (_algorithm)
_algorithm->reset();
}
int AudioProcessing::getData (SFLDataFormat *outputData) {
int AudioProcessing::getData (SFLDataFormat *outputData)
{
if (_algorithm)
return _algorithm->getData (outputData);
else
return 0;
}
void AudioProcessing::putData (SFLDataFormat *inputData, int nbBytes) {
void AudioProcessing::putData (SFLDataFormat *inputData, int nbBytes)
{
if (_algorithm)
_algorithm->putData (inputData, nbBytes);
}
void AudioProcessing::processAudio (SFLDataFormat *inputData, int nbBytes) {
void AudioProcessing::processAudio (SFLDataFormat *inputData, int nbBytes)
{
if (_algorithm)
_algorithm->process (inputData, nbBytes);
}
int AudioProcessing::processAudio (SFLDataFormat *inputData, SFLDataFormat *outputData, int nbBytes) {
int AudioProcessing::processAudio (SFLDataFormat *inputData, SFLDataFormat *outputData, int nbBytes)
{
if (_algorithm)
return _algorithm->process (inputData, outputData, nbBytes);
else
......@@ -68,7 +73,8 @@ int AudioProcessing::processAudio (SFLDataFormat *inputData, SFLDataFormat *outp
}
void AudioProcessing::processAudio (SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData, int nbBytes) {
void AudioProcessing::processAudio (SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData, int nbBytes)
{
if (_algorithm)
_algorithm->process (micData, spkrData, outputData, nbBytes);
}
......@@ -49,7 +49,8 @@ struct wavhdr {
};
AudioRecord::AudioRecord() {
AudioRecord::AudioRecord()
{
sndSmplRate_ = 8000;
channels_ = 1;
......@@ -65,18 +66,21 @@ AudioRecord::AudioRecord() {
spkBuffer_ = new SFLDataFormat[nbSamplesMax_];
}
AudioRecord::~AudioRecord() {
AudioRecord::~AudioRecord()
{
delete [] mixBuffer_;
delete [] micBuffer_;
delete [] spkBuffer_;
}
void AudioRecord::setSndSamplingRate (int smplRate) {
void AudioRecord::setSndSamplingRate (int smplRate)
{
sndSmplRate_ = smplRate;
}
void AudioRecord::setRecordingOption (FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path) {
void AudioRecord::setRecordingOption (FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path)
{
fileType_ = type;
......@@ -90,7 +94,8 @@ void AudioRecord::setRecordingOption (FILE_TYPE type, SOUND_FORMAT format, int s
void AudioRecord::initFileName (std::string peerNumber) {
void AudioRecord::initFileName (std::string peerNumber)
{
std::string fName;
......@@ -112,7 +117,8 @@ void AudioRecord::initFileName (std::string peerNumber) {
savePath_.append (fName);
}
void AudioRecord::openFile() {
void AudioRecord::openFile()
{
bool result = false;
......@@ -139,7 +145,8 @@ void AudioRecord::openFile() {
}
void AudioRecord::closeFile() {
void AudioRecord::closeFile()
{
if (fp == 0) return;
......@@ -153,7 +160,8 @@ void AudioRecord::closeFile() {
}
bool AudioRecord::isOpenFile() {
bool AudioRecord::isOpenFile()
{
if (fp) {
return true;
......@@ -163,7 +171,8 @@ bool AudioRecord::isOpenFile() {
}
bool AudioRecord::isFileExist() {
bool AudioRecord::isFileExist()
{
_info ("AudioRecord: Try to open name : %s ", fileName_);
if (fopen (fileName_,"rb") ==0) {
......@@ -173,7 +182,8 @@ bool AudioRecord::isFileExist() {
return false;
}
bool AudioRecord::isRecording() {
bool AudioRecord::isRecording()
{
if (recordingEnabled_)
return true;
......@@ -182,7 +192,8 @@ bool AudioRecord::isRecording() {
}
bool AudioRecord::setRecording() {
bool AudioRecord::setRecording()
{
if (isOpenFile()) {
if (!recordingEnabled_) {
......@@ -203,7 +214,8 @@ bool AudioRecord::setRecording() {
}
void AudioRecord::stopRecording() {
void AudioRecord::stopRecording()
{
_info ("AudioRecording: Stop recording");
if (recordingEnabled_)
......@@ -211,7 +223,8 @@ void AudioRecord::stopRecording() {
}
void AudioRecord::createFilename() {
void AudioRecord::createFilename()
{
time_t rawtime;
......@@ -263,7 +276,8 @@ void AudioRecord::createFilename() {
_info ("AudioRecord: create filename for this call %s ", fileName_);
}
bool AudioRecord::setRawFile() {
bool AudioRecord::setRawFile()
{
fp = fopen (savePath_.c_str(), "wb");
......@@ -283,7 +297,8 @@ bool AudioRecord::setRawFile() {
}
bool AudioRecord::setWavFile() {
bool AudioRecord::setWavFile()
{
fp = fopen (savePath_.c_str(), "wb");
......@@ -326,7 +341,8 @@ bool AudioRecord::setWavFile() {
}
bool AudioRecord::openExistingRawFile() {
bool AudioRecord::openExistingRawFile()
{
fp = fopen (fileName_, "ab+");
if (!fp) {
......@@ -338,7 +354,8 @@ bool AudioRecord::openExistingRawFile() {
}
bool AudioRecord::openExistingWavFile() {
bool AudioRecord::openExistingWavFile()
{
_info ("AudioRecord: Open existing wave file");
fp = fopen (fileName_, "rb+");
......@@ -380,7 +397,8 @@ bool AudioRecord::openExistingWavFile() {
}
void AudioRecord::closeWavFile() {
void AudioRecord::closeWavFile()
{
if (fp == 0) {
_debug ("AudioRecord: Can't closeWavFile, a file has not yet been opened!");
return;
......@@ -421,7 +439,8 @@ void AudioRecord::closeWavFile() {
}
void AudioRecord::recSpkrData (SFLDataFormat* buffer, int nSamples) {
void AudioRecord::recSpkrData (SFLDataFormat* buffer, int nSamples)
{
if (recordingEnabled_) {
......@@ -435,7 +454,8 @@ void AudioRecord::recSpkrData (SFLDataFormat* buffer, int nSamples) {
}
void AudioRecord::recMicData (SFLDataFormat* buffer, int nSamples) {
void AudioRecord::recMicData (SFLDataFormat* buffer, int nSamples)
{
if (recordingEnabled_) {
......@@ -450,7 +470,8 @@ void AudioRecord::recMicData (SFLDataFormat* buffer, int nSamples) {
}
void AudioRecord::recData (SFLDataFormat* buffer, int nSamples) {
void AudioRecord::recData (SFLDataFormat* buffer, int nSamples)
{
if (recordingEnabled_) {
......@@ -475,7 +496,8 @@ void AudioRecord::recData (SFLDataFormat* buffer, int nSamples) {
}
void AudioRecord::recData (SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int nSamples_1, int nSamples_2) {
void AudioRecord::recData (SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int nSamples_1, int nSamples_2)
{
if (recordingEnabled_) {
......
......@@ -33,7 +33,8 @@
int AudioRecorder::count = 0;
AudioRecorder::AudioRecorder (AudioRecord *arec, MainBuffer *mb) : Thread() {
AudioRecorder::AudioRecorder (AudioRecord *arec, MainBuffer *mb) : Thread()
{
setCancel (cancelDeferred);
++count;
......@@ -56,7 +57,8 @@ AudioRecorder::AudioRecorder (AudioRecord *arec, MainBuffer *mb) : Thread() {
/**
* Reimplementation of run()
*/
void AudioRecorder::run (void) {
void AudioRecorder::run (void)
{
SFLDataFormat buffer[10000];
while (true) {
......
......@@ -40,13 +40,16 @@
#include <assert.h>
namespace sfl {
namespace sfl
{
AudioRtpFactory::AudioRtpFactory() : _rtpSession (NULL) {
AudioRtpFactory::AudioRtpFactory() : _rtpSession (NULL)
{
}