39#include <TargetConditionals.h>
56#pragma GCC diagnostic push
57#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
58#include <yaml-cpp/yaml.h>
59#pragma GCC diagnostic pop
73constexpr const char*
const Preferences::CONFIG_LABEL;
90constexpr const char*
const VoipPreference::CONFIG_LABEL;
96constexpr const char*
const AudioPreference::CONFIG_LABEL;
114static constexpr const char*
AGC_KEY {
"automaticGainControl"};
117static constexpr const char*
VAD_KEY {
"voiceActivityDetection"};
122constexpr const char*
const VideoPreferences::CONFIG_LABEL;
132constexpr const char*
const PluginPreferences::CONFIG_LABEL;
148 , historyMaxCalls_(20)
149 , ringingTimeout_(30)
150 , zoneToneChoice_(DFT_ZONE)
151 , portNum_(sip_utils::DEFAULT_SIP_PORT)
152 , searchBarDisplay_(
true)
159 std::vector<std::string>
tokens;
163 for (
const auto c : accountOrder_) {
170 JAMI_DBG(
"Dropping nonexistent account %s", token.c_str());
178 accountOrder_.clear();
179 for (
const auto& t :
tokens)
180 accountOrder_ += t +
'/';
188 if (
not accountOrder_.empty())
198 const size_t start = accountOrder_.find(
oldAccountID +
"/");
199 if (start != std::string::npos)
206 out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap;
212 out << YAML::Key <<
ORDER_KEY << YAML::Value << accountOrder_;
222 const auto& node =
in[CONFIG_LABEL];
224 parseValue(node,
ORDER_KEY, accountOrder_);
243 out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap;
253 const auto& node =
in[CONFIG_LABEL];
264 , alsaPlugin_(
"default")
265 , alsaSmplrate_(44100)
266 , pulseDevicePlayback_(
"")
267 , pulseDeviceRecord_(
"")
268 , pulseDeviceRingtone_(
"")
270 , alwaysRecording_(
false)
273 , audioProcessor_(
"webrtc")
277 , echoCanceller_(
"auto")
278 , captureMuted_(
false)
279 , playbackMuted_(
false)
290 JAMI_WARN(
" Card with index %d doesn't exist or is unusable.",
card);
306 if (
auto ret =
system(
"jack_lsp > /dev/null"))
307 throw std::runtime_error(
"Error running jack_lsp: " + std::to_string(
ret));
309 }
catch (
const std::runtime_error&
e) {
331 }
catch (
const std::runtime_error&
e) {
332 JAMI_WARN(
"Unable to create pulseaudio layer, falling back to ALSA");
352 }
catch (
const std::runtime_error&
e) {
353 JAMI_WARN(
"Unable to create coreaudio layer. There will be no sound.");
362 }
catch (
const std::runtime_error&
e) {
363 JAMI_WARN(
"Unable to create PortAudio layer. There will be no sound.");
373std::vector<std::string>
402 out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap;
405 out << YAML::Key <<
CARDIN_KEY << YAML::Value << alsaCardin_;
408 out << YAML::Key <<
PLUGIN_KEY << YAML::Value << alsaPlugin_;
439 out << YAML::Key <<
AGC_KEY << YAML::Value << agcEnabled_;
440 out << YAML::Key <<
VAD_KEY << YAML::Value << vadEnabled_;
454 JAMI_ERR(
"%s is not writable, unable to be the recording path", path.c_str());
462 const auto& node =
in[CONFIG_LABEL];
476 parseValue(node,
AGC_KEY, agcEnabled_);
498 parseValue(node,
VAD_KEY, vadEnabled_);
503VideoPreferences::VideoPreferences()
512VideoPreferences::serialize(YAML::Emitter&
out)
const
514 out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap;
528VideoPreferences::unserialize(
const YAML::Node&
in)
531 const auto& node =
in[CONFIG_LABEL];
559PluginPreferences::PluginPreferences()
564PluginPreferences::serialize(YAML::Emitter&
out)
const
566 out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap;
574PluginPreferences::unserialize(
const YAML::Node&
in)
577 const auto& node =
in[CONFIG_LABEL];
#define PULSEAUDIO_API_STR
#define PORTAUDIO_API_STR
#define COREAUDIO_API_STR
static bool soundCardIndexExists(int card, AudioDeviceType stream)
Check if the given index corresponds to an existing sound card and supports the specified streaming m...
AudioLayer * createAudioLayer()
bool setRecordPath(const std::string &r)
void unserialize(const YAML::Node &in) override
static std::vector< std::string > getSupportedAudioManagers()
void serialize(YAML::Emitter &out) const override
void verifyAccountOrder(const std::vector< std::string > &accounts)
static const char *const DFT_ZONE
void removeAccount(const std::string &acc)
void unserialize(const YAML::Node &in) override
void serialize(YAML::Emitter &out) const override
Preferences()
Default sound card index.
static const char *const REGISTRATION_EXPIRE_KEY
void addAccount(const std::string &acc)
void serialize(YAML::Emitter &out) const override
void unserialize(const YAML::Node &in) override
bool isDirectoryWritable(const std::string &directory)
std::string expand_path(const std::string &path)
Expand the given path.
void parseValue(const YAML::Node &node, const char *key, T &value)
std::set< std::string > parseVector(const YAML::Node &node)
static constexpr const char * CARDIN_KEY
static constexpr const char * RECORDPATH_KEY
static constexpr const char * VOLUMEMIC_KEY
static constexpr const char * CARLIBJAMI_KEY
static constexpr const char * NOISE_REDUCE_KEY
static constexpr const char * AGC_KEY
void emitSignal(Args... args)
static constexpr const char * AUDIO_API_KEY
static constexpr const char * CAPTURE_MUTED_KEY
static constexpr const char * PLAY_DTMF_KEY
static constexpr const char * RINGING_TIMEOUT
static constexpr const char * DEVICE_RECORD_KEY
constexpr std::string_view DEFAULT_CONFERENCE_RESOLUTION
static constexpr const char * ECHO_CANCEL_KEY
static constexpr const char * HISTORY_MAX_CALLS_KEY
static constexpr const char * SMPLRATE_KEY
static constexpr const char * PLAYBACK_MUTED_KEY
static constexpr const char * CARDOUT_KEY
static constexpr const char * MD5_HASH_KEY
static constexpr const char * ALWAYS_RECORDING_KEY
static constexpr const char * HISTORY_LIMIT_KEY
static constexpr const char * DEVICE_RINGTONE_KEY
static constexpr const char * ALSAMAP_KEY
static constexpr const char * PLAY_TONES_KEY
static constexpr const char * ORDER_KEY
static constexpr int PULSE_LENGTH_DEFAULT
static constexpr const char * VAD_KEY
static constexpr const char * SEARCH_BAR_DISPLAY_KEY
static constexpr const char * VOLUMESPKR_KEY
static constexpr const char * PLUGIN_KEY
static constexpr const char * DEVICE_PLAYBACK_KEY
static constexpr const char * PORTAUDIO_KEY
static constexpr const char * ALSA_DFT_CARD
Default DTMF length.
static constexpr const char * AUDIO_PROCESSOR_KEY
static constexpr const char * PULSEMAP_KEY
static constexpr const char * PULSE_LENGTH_KEY
static constexpr const char * PORT_NUM_KEY
static constexpr const char * ZONE_TONE_CHOICE_KEY