Commit a9f3dc57 authored by Tristan Matthews's avatar Tristan Matthews

* #7127: apply astylerc to daemon and client.

99 % of these are just whitespace changes. Some unnecessary includes
removed as well
parent 58a31825
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
# Savoir-faire Linux Inc # Savoir-faire Linux Inc
# http://www.sflphone.org # http://www.sflphone.org
style=k&r # Kernighan & Ritchie style formatting/indenting uses linux bracket style=stroustrup # stroustrup style http://astyle.sourceforge.net/astyle.html#_style=stroustrup
indent=spaces=4 # Use spaces instead of tabs for indentation indent=spaces=4 # Use spaces instead of tabs for indentation
indent-classes # Indent 'class' and 'struct' blocks so that the blocks 'public:', 'protected:' and 'private:' are indented indent-classes # Indent 'class' and 'struct' blocks so that the blocks 'public:', 'protected:' and 'private:' are indented
indent-switches # Indent 'switch' blocks so that the 'case X:' statements are indented in the switch block indent-switches # Indent 'switch' blocks so that the 'case X:' statements are indented in the switch block
break-blocks # Pad empty lines around header blocks (e.g. 'if', 'while'...). break-blocks # Pad empty lines around header blocks (e.g. 'if', 'while'...).
brackets=linux brackets=linux
unpad=paren unpad-paren # Remove unwanted space around parentheses
formatted pad-header # Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...)
-d formatted # only display files that have changed
recursive # recursively enter subdirs
suffix=none # don't create backup files (that's what version control is for)
...@@ -36,8 +36,7 @@ ...@@ -36,8 +36,7 @@
* Interface for both audio codecs as well as video codecs. * Interface for both audio codecs as well as video codecs.
*/ */
namespace sfl { namespace sfl {
class Codec class Codec {
{
public: public:
Codec() {}; Codec() {};
virtual ~Codec() {} virtual ~Codec() {}
......
...@@ -33,18 +33,18 @@ ...@@ -33,18 +33,18 @@
#include "account.h" #include "account.h"
#include "manager.h" #include "manager.h"
Account::Account (const std::string& accountID, const std::string &type) : Account::Account(const std::string& accountID, const std::string &type) :
accountID_ (accountID) accountID_(accountID)
, link_ (NULL) , link_(NULL)
, enabled_ (true) , enabled_(true)
, type_ (type) , type_(type)
, registrationState_ (Unregistered) , registrationState_(Unregistered)
, codecOrder_ () , codecOrder_()
, codecStr_ ("") , codecStr_("")
, ringtonePath_ ("/usr/share/sflphone/ringtones/konga.ul") , ringtonePath_("/usr/share/sflphone/ringtones/konga.ul")
, ringtoneEnabled_ (true) , ringtoneEnabled_(true)
, displayName_ ("") , displayName_("")
, userAgent_ ("SFLphone") , userAgent_("SFLphone")
{ {
// Initialize the codec order, used when creating a new account // Initialize the codec order, used when creating a new account
loadDefaultCodecs(); loadDefaultCodecs();
...@@ -54,7 +54,7 @@ Account::~Account() ...@@ -54,7 +54,7 @@ Account::~Account()
{ {
} }
void Account::setRegistrationState (const RegistrationState &state) void Account::setRegistrationState(const RegistrationState &state)
{ {
if (state != registrationState_) { if (state != registrationState_) {
registrationState_ = state; registrationState_ = state;
...@@ -71,20 +71,20 @@ void Account::loadDefaultCodecs() ...@@ -71,20 +71,20 @@ void Account::loadDefaultCodecs()
// Initialize codec // Initialize codec
std::vector <std::string> codecList; std::vector <std::string> codecList;
codecList.push_back ("0"); codecList.push_back("0");
codecList.push_back ("3"); codecList.push_back("3");
codecList.push_back ("8"); codecList.push_back("8");
codecList.push_back ("9"); codecList.push_back("9");
codecList.push_back ("110"); codecList.push_back("110");
codecList.push_back ("111"); codecList.push_back("111");
codecList.push_back ("112"); codecList.push_back("112");
setActiveCodecs (codecList); setActiveCodecs(codecList);
} }
void Account::setActiveCodecs (const std::vector <std::string> &list) void Account::setActiveCodecs(const std::vector <std::string> &list)
{ {
// first clear the previously stored codecs // first clear the previously stored codecs
codecOrder_.clear(); codecOrder_.clear();
...@@ -93,12 +93,12 @@ void Account::setActiveCodecs (const std::vector <std::string> &list) ...@@ -93,12 +93,12 @@ void Account::setActiveCodecs (const std::vector <std::string> &list)
// we used the CodecOrder vector to save the order. // we used the CodecOrder vector to save the order.
for (std::vector<std::string>::const_iterator iter = list.begin(); iter != list.end(); for (std::vector<std::string>::const_iterator iter = list.begin(); iter != list.end();
++iter) { ++iter) {
int payload = std::atoi (iter->c_str()); int payload = std::atoi(iter->c_str());
codecOrder_.push_back ( (int) payload); codecOrder_.push_back((int) payload);
} }
// update the codec string according to new codec selection // update the codec string according to new codec selection
codecStr_ = ManagerImpl::serialize (list); codecStr_ = ManagerImpl::serialize(list);
} }
std::string Account::mapStateNumberToString(RegistrationState state) std::string Account::mapStateNumberToString(RegistrationState state)
......
...@@ -143,12 +143,11 @@ static const char * const ringtonePathKey = "ringtonePath"; ...@@ -143,12 +143,11 @@ static const char * const ringtonePathKey = "ringtonePath";
static const char * const ringtoneEnabledKey = "ringtoneEnabled"; static const char * const ringtoneEnabledKey = "ringtoneEnabled";
static const char * const displayNameKey = "displayName"; static const char * const displayNameKey = "displayName";
class Account : public Serializable class Account : public Serializable {
{
public: public:
Account (const std::string& accountID, const std::string &type); Account(const std::string& accountID, const std::string &type);
/** /**
* Virtual destructor * Virtual destructor
...@@ -159,15 +158,15 @@ class Account : public Serializable ...@@ -159,15 +158,15 @@ class Account : public Serializable
* Method called by the configuration engine to serialize instance's information * Method called by the configuration engine to serialize instance's information
* into configuration file. * into configuration file.
*/ */
virtual void serialize (Conf::YamlEmitter *emitter) = 0; virtual void serialize(Conf::YamlEmitter *emitter) = 0;
/** /**
* Method called by the configuration engine to restore instance internal state * Method called by the configuration engine to restore instance internal state
* from configuration file. * from configuration file.
*/ */
virtual void unserialize (Conf::MappingNode *map) = 0; virtual void unserialize(Conf::MappingNode *map) = 0;
virtual void setAccountDetails (std::map<std::string, std::string> details) = 0; virtual void setAccountDetails(std::map<std::string, std::string> details) = 0;
virtual std::map<std::string, std::string> getAccountDetails() const = 0; virtual std::map<std::string, std::string> getAccountDetails() const = 0;
...@@ -213,7 +212,7 @@ class Account : public Serializable ...@@ -213,7 +212,7 @@ class Account : public Serializable
return enabled_; return enabled_;
} }
void setEnabled (bool enable) { void setEnabled(bool enable) {
enabled_ = enable; enabled_ = enable;
} }
...@@ -221,31 +220,31 @@ class Account : public Serializable ...@@ -221,31 +220,31 @@ class Account : public Serializable
* Set the registration state of the specified link * Set the registration state of the specified link
* @param state The registration state of underlying VoIPLink * @param state The registration state of underlying VoIPLink
*/ */
void setRegistrationState (const RegistrationState &state); void setRegistrationState(const RegistrationState &state);
/* They should be treated like macro definitions by the C++ compiler */ /* They should be treated like macro definitions by the C++ compiler */
std::string getUsername (void) const { std::string getUsername(void) const {
return username_; return username_;
} }
std::string getHostname (void) const { std::string getHostname(void) const {
return hostname_; return hostname_;
} }
void setHostname (const std::string &hostname) { void setHostname(const std::string &hostname) {
hostname_ = hostname; hostname_ = hostname;
} }
std::string getAlias (void) const { std::string getAlias(void) const {
return alias_; return alias_;
} }
void setAlias (const std::string &alias) { void setAlias(const std::string &alias) {
alias_ = alias; alias_ = alias;
} }
std::string getType (void) const { std::string getType(void) const {
return type_; return type_;
} }
void setType (const std::string &type) { void setType(const std::string &type) {
type_ = type; type_ = type;
} }
...@@ -253,7 +252,7 @@ class Account : public Serializable ...@@ -253,7 +252,7 @@ class Account : public Serializable
* Accessor to data structures * Accessor to data structures
* @return CodecOrder& The list that reflects the user's choice * @return CodecOrder& The list that reflects the user's choice
*/ */
const CodecOrder& getActiveCodecs (void) const { const CodecOrder& getActiveCodecs(void) const {
return codecOrder_; return codecOrder_;
} }
...@@ -261,40 +260,40 @@ class Account : public Serializable ...@@ -261,40 +260,40 @@ class Account : public Serializable
* Update both the codec order structure and the codec string used for * Update both the codec order structure and the codec string used for
* SDP offer and configuration respectively * SDP offer and configuration respectively
*/ */
void setActiveCodecs (const std::vector <std::string>& list); void setActiveCodecs(const std::vector <std::string>& list);
std::string getRingtonePath (void) const { std::string getRingtonePath(void) const {
return ringtonePath_; return ringtonePath_;
} }
void setRingtonePath (const std::string &path) { void setRingtonePath(const std::string &path) {
ringtonePath_ = path; ringtonePath_ = path;
} }
bool getRingtoneEnabled (void) const { bool getRingtoneEnabled(void) const {
return ringtoneEnabled_; return ringtoneEnabled_;
} }
void setRingtoneEnabled (bool enable) { void setRingtoneEnabled(bool enable) {
ringtoneEnabled_ = enable; ringtoneEnabled_ = enable;
} }
std::string getDisplayName (void) const { std::string getDisplayName(void) const {
return displayName_; return displayName_;
} }
void setDisplayName (const std::string &name) { void setDisplayName(const std::string &name) {
displayName_ = name; displayName_ = name;
} }
std::string getMailBox (void) const { std::string getMailBox(void) const {
return mailBox_; return mailBox_;
} }
void setMailBox (const std::string &mb) { void setMailBox(const std::string &mb) {
mailBox_ = mb; mailBox_ = mb;
} }
private: private:
// copy constructor // copy constructor
Account (const Account& rh); Account(const Account& rh);
// assignment operator // assignment operator
Account& operator= (const Account& rh); Account& operator= (const Account& rh);
...@@ -303,10 +302,10 @@ class Account : public Serializable ...@@ -303,10 +302,10 @@ class Account : public Serializable
* Helper function used to load the default codec order from the codec factory * Helper function used to load the default codec order from the codec factory
* setActiveCodecs is called to sync both codecOrder_ and codecStr_ * setActiveCodecs is called to sync both codecOrder_ and codecStr_
*/ */
void loadDefaultCodecs (void); void loadDefaultCodecs(void);
protected: protected:
static std::string mapStateNumberToString (RegistrationState state); static std::string mapStateNumberToString(RegistrationState state);
/** /**
* Account ID are assign in constructor and shall not changed * Account ID are assign in constructor and shall not changed
......
This diff is collapsed.
...@@ -47,32 +47,31 @@ class AlsaThread; ...@@ -47,32 +47,31 @@ class AlsaThread;
/** Associate a sound card index to its string description */ /** Associate a sound card index to its string description */
typedef std::pair<int , std::string> HwIDPair; typedef std::pair<int , std::string> HwIDPair;
class AlsaLayer : public AudioLayer class AlsaLayer : public AudioLayer {
{
public: public:
/** /**
* Constructor * Constructor
*/ */
AlsaLayer (); AlsaLayer();
/** /**
* Destructor * Destructor
*/ */
~AlsaLayer (void); ~AlsaLayer(void);
/** /**
* Start the capture stream and prepare the playback stream. * Start the capture stream and prepare the playback stream.
* The playback starts accordingly to its threshold * The playback starts accordingly to its threshold
* ALSA Library API * ALSA Library API
*/ */
void startStream (void); void startStream(void);
/** /**
* Stop the playback and capture streams. * Stop the playback and capture streams.
* Drops the pending frames and put the capture and playback handles to PREPARED state * Drops the pending frames and put the capture and playback handles to PREPARED state
* ALSA Library API * ALSA Library API
*/ */
void stopStream (void); void stopStream(void);
/** /**
* Concatenate two strings. Used to build a valid pcm device name. * Concatenate two strings. Used to build a valid pcm device name.
...@@ -80,7 +79,7 @@ class AlsaLayer : public AudioLayer ...@@ -80,7 +79,7 @@ class AlsaLayer : public AudioLayer
* @param card the sound card number * @param card the sound card number
* @return std::string the concatenated string * @return std::string the concatenated string
*/ */
std::string buildDeviceTopo (const std::string &plugin, int card); std::string buildDeviceTopo(const std::string &plugin, int card);
/** /**
* Scan the sound card available on the system * Scan the sound card available on the system
...@@ -90,7 +89,7 @@ class AlsaLayer : public AudioLayer ...@@ -90,7 +89,7 @@ class AlsaLayer : public AudioLayer
* SFL_PCM_BOTH * SFL_PCM_BOTH
* @return std::vector<std::string> The vector containing the string description of the card * @return std::vector<std::string> The vector containing the string description of the card
*/ */
std::vector<std::string> getSoundCardsInfo (int stream); std::vector<std::string> getSoundCardsInfo(int stream);
/** /**
* Check if the given index corresponds to an existing sound card and supports the specified streaming mode * Check if the given index corresponds to an existing sound card and supports the specified streaming mode
...@@ -109,12 +108,12 @@ class AlsaLayer : public AudioLayer ...@@ -109,12 +108,12 @@ class AlsaLayer : public AudioLayer
* @param description The string description * @param description The string description
* @return int Its index * @return int Its index
*/ */
int soundCardGetIndex (const std::string &description); int soundCardGetIndex(const std::string &description);
void playback(int maxSamples); void playback(int maxSamples);
void capture(void); void capture(void);
void audioCallback (void); void audioCallback(void);
/** /**
* Get the index of the audio card for capture * Get the index of the audio card for capture
...@@ -135,10 +134,10 @@ class AlsaLayer : public AudioLayer ...@@ -135,10 +134,10 @@ class AlsaLayer : public AudioLayer
} }
/** /**
* Get the index of the audio card for ringtone (could be differnet from playback) * Get the index of the audio card for ringtone (could be differnet from playback)
* @return int The index of the card used for ringtone * @return int The index of the card used for ringtone
* 0 for the first available card on the system, 1 ... * 0 for the first available card on the system, 1 ...
*/ */
int getIndexRing() const { int getIndexRing() const {
return indexRing_; return indexRing_;
} }
...@@ -170,7 +169,7 @@ class AlsaLayer : public AudioLayer ...@@ -170,7 +169,7 @@ class AlsaLayer : public AudioLayer
// Copy Constructor // Copy Constructor
AlsaLayer (const AlsaLayer& rh); AlsaLayer(const AlsaLayer& rh);
// Assignment Operator // Assignment Operator
AlsaLayer& operator= (const AlsaLayer& rh); AlsaLayer& operator= (const AlsaLayer& rh);
...@@ -179,17 +178,17 @@ class AlsaLayer : public AudioLayer ...@@ -179,17 +178,17 @@ class AlsaLayer : public AudioLayer
* Drop the pending frames and close the capture device * Drop the pending frames and close the capture device
* ALSA Library API * ALSA Library API
*/ */
void closeCaptureStream (void); void closeCaptureStream(void);
void stopCaptureStream (void); void stopCaptureStream(void);
void startCaptureStream (void); void startCaptureStream(void);
void prepareCaptureStream (void); void prepareCaptureStream(void);
void closePlaybackStream (void); void closePlaybackStream(void);
void stopPlaybackStream (void); void stopPlaybackStream(void);
void startPlaybackStream (void); void startPlaybackStream(void);
void preparePlaybackStream (void); void preparePlaybackStream(void);
bool alsa_set_params (snd_pcm_t *pcm_handle); bool alsa_set_params(snd_pcm_t *pcm_handle);
/** /**
* Copy a data buffer in the internal ring buffer * Copy a data buffer in the internal ring buffer
...@@ -197,7 +196,7 @@ class AlsaLayer : public AudioLayer ...@@ -197,7 +196,7 @@ class AlsaLayer : public AudioLayer
* @param buffer The data to be copied * @param buffer The data to be copied
* @param length The size of the buffer * @param length The size of the buffer
*/ */
void write (void* buffer, int length, snd_pcm_t *handle); void write(void* buffer, int length, snd_pcm_t *handle);
/** /**
* Read data from the internal ring buffer * Read data from the internal ring buffer
...@@ -206,7 +205,7 @@ class AlsaLayer : public AudioLayer ...@@ -206,7 +205,7 @@ class AlsaLayer : public AudioLayer
* @param toCopy The number of bytes to get * @param toCopy The number of bytes to get
* @return int The number of frames actually read * @return int The number of frames actually read
*/ */
int read (void* buffer, int toCopy); int read(void* buffer, int toCopy);
/** /**
* Handles to manipulate playback stream * Handles to manipulate playback stream
......
...@@ -34,70 +34,70 @@ ...@@ -34,70 +34,70 @@
#include "audio/dcblocker.h" #include "audio/dcblocker.h"
#include "manager.h" #include "manager.h"
AudioLayer::AudioLayer () AudioLayer::AudioLayer()
: isStarted_ (false) : isStarted_(false)
, urgentRingBuffer_ (SIZEBUF, Call::DEFAULT_ID) , urgentRingBuffer_(SIZEBUF, Call::DEFAULT_ID)
, audioSampleRate_(Manager::instance().getMainBuffer()->getInternalSamplingRate()) , audioSampleRate_(Manager::instance().getMainBuffer()->getInternalSamplingRate())
, mutex_ () , mutex_()
, audioPref(Manager::instance().audioPreference) , audioPref(Manager::instance().audioPreference)
, converter_ (new SamplerateConverter(audioSampleRate_)) , converter_(new SamplerateConverter(audioSampleRate_))
, lastNotificationTime_ (0) , lastNotificationTime_(0)
{ {
urgentRingBuffer_.createReadPointer(); urgentRingBuffer_.createReadPointer();
} }
AudioLayer::~AudioLayer () AudioLayer::~AudioLayer()
{ {
delete converter_; delete converter_;
} }
void AudioLayer::flushMain (void) void AudioLayer::flushMain(void)
{ {
ost::MutexLock guard (mutex_); ost::MutexLock guard(mutex_);
// should pass call id // should pass call id
Manager::instance().getMainBuffer()->flushAllBuffers(); Manager::instance().getMainBuffer()->flushAllBuffers();
} }
void AudioLayer::flushUrgent (void) void AudioLayer::flushUrgent(void)
{ {
ost::MutexLock guard (mutex_); ost::MutexLock guard(mutex_);
urgentRingBuffer_.flushAll(); urgentRingBuffer_.flushAll();
} }
void AudioLayer::putUrgent (void* buffer, int toCopy) void AudioLayer::putUrgent(void* buffer, int toCopy)
{ {
ost::MutexLock guard (mutex_); ost::MutexLock guard(mutex_);
urgentRingBuffer_.Put (buffer, toCopy); urgentRingBuffer_.Put(buffer, toCopy);
} }
// Notify (with a beep) an incoming call when there is already a call in progress // Notify (with a beep) an incoming call when there is already a call in progress
void AudioLayer::notifyincomingCall() void AudioLayer::notifyincomingCall()
{