maj copyright

This commit is contained in:
Gaelle Braud 2025-08-20 10:21:43 +02:00 committed by gaelle
parent d42af52ba1
commit 8566f830d1
37 changed files with 226 additions and 252 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).
@ -57,8 +57,9 @@ void ParticipantInfoList::setChatCore(const QSharedPointer<ChatCore> &chatCore)
QStringList participantAddresses; QStringList participantAddresses;
QList<QSharedPointer<ParticipantGui>> participantList; QList<QSharedPointer<ParticipantGui>> participantList;
auto participants = mChatCore->getParticipants(); auto participants = mChatCore->getParticipants();
resetData(); resetData();
for(auto p: participants) add(p); for (auto p : participants)
add(p);
}; };
connect(mChatCore.get(), &ChatCore::participantsChanged, this, buildList); connect(mChatCore.get(), &ChatCore::participantsChanged, this, buildList);
buildList(); buildList();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).
@ -25,46 +25,40 @@
// ============================================================================= // =============================================================================
DefaultTranslatorCore::DefaultTranslatorCore (QObject *parent) : QTranslator(parent) { DefaultTranslatorCore::DefaultTranslatorCore(QObject *parent) : QTranslator(parent) {
QDirIterator it(":", QDirIterator::Subdirectories); QDirIterator it(":", QDirIterator::Subdirectories);
while (it.hasNext()) { while (it.hasNext()) {
QFileInfo info(it.next()); QFileInfo info(it.next());
if (info.suffix() == QLatin1String("qml")) { if (info.suffix() == QLatin1String("qml")) {
QString dir = info.absoluteDir().absolutePath(); QString dir = info.absoluteDir().absolutePath();
// Ignore extra selectors. // Ignore extra selectors.
// TODO: Remove 5.9 support in July 2019. // TODO: Remove 5.9 support in July 2019.
for (const auto &selector : { "+linux", "+mac", "+windows", "+custom", "+5.9" }) for (const auto &selector : {"+linux", "+mac", "+windows", "+custom", "+5.9"})
if (dir.contains(selector)) if (dir.contains(selector)) goto end;
goto end;
// Ignore default imports. // Ignore default imports.
if (dir.startsWith(":/QtQuick")) if (dir.startsWith(":/QtQuick")) continue;
continue;
QString basename = info.baseName(); QString basename = info.baseName();
if (!mContexts.contains(basename)) if (!mContexts.contains(basename)) mContexts << basename;
mContexts << basename; }
} end:;
end:; }
}
} }
QString DefaultTranslatorCore::translate ( QString
const char *context, DefaultTranslatorCore::translate(const char *context, const char *sourceText, const char *disambiguation, int n) const {
const char *sourceText, if (!context) return QString("");
const char *disambiguation,
int n
) const {
if (!context)
return QString("");
QString translation = QTranslator::translate(context, sourceText, disambiguation, n); QString translation = QTranslator::translate(context, sourceText, disambiguation, n);
if (translation.length() == 0 && mContexts.contains(context)) if (translation.length() == 0 && mContexts.contains(context))
qDebug() << QStringLiteral("Unable to find a translation. (context=%1, label=%2, disambiguation=%3)") qDebug() << QStringLiteral("Unable to find a translation. (context=%1, label=%2, disambiguation=%3)")
.arg(context).arg(sourceText).arg(disambiguation); .arg(context)
.arg(sourceText)
.arg(disambiguation);
return translation; return translation;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).
@ -28,22 +28,20 @@
class DefaultTranslatorCore : public QTranslator { class DefaultTranslatorCore : public QTranslator {
public: public:
DefaultTranslatorCore (QObject *parent = Q_NULLPTR); DefaultTranslatorCore(QObject *parent = Q_NULLPTR);
QString translate ( QString translate(const char *context,
const char *context, const char *sourceText,
const char *sourceText, const char *disambiguation = Q_NULLPTR,
const char *disambiguation = Q_NULLPTR, int n = -1) const override;
int n = -1
) const override;
private: private:
QSet<QString> mContexts; QSet<QString> mContexts;
}; };
// Workaround for bad Application Menu translation on Mac: // Workaround for bad Application Menu translation on Mac:
// Overwrite Qt source by our translations : // Overwrite Qt source by our translations :
//static const char *application_menu_strings[] = // static const char *application_menu_strings[] =
//{ //{
// QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","About %1"), // QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","About %1"),
// QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Preferences…"), // QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Preferences…"),
@ -54,10 +52,11 @@ private:
// QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Quit %1") // QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Quit %1")
//}; //};
//class MAC_APPLICATION_MENU : public QObject{ // class MAC_APPLICATION_MENU : public QObject{
// QString forcedTranslation(){ // QString forcedTranslation(){
// return tr("About %1") + tr("Preferences…") + tr("Services") + tr("Hide %1") + tr("Hide Others") + tr("Show All") + tr("Quit %1"); // return tr("About %1") + tr("Preferences…") + tr("Services") + tr("Hide %1") + tr("Hide Others") + tr("Show All") +
//tr("Quit %1");
// } // }
//}; // };
#endif // DEFAULT_TRANSLATOR_CORE_H_ #endif // DEFAULT_TRANSLATOR_CORE_H_

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).
@ -18,62 +18,58 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "MediastreamerUtils.hpp"
#include <linphone/linphonecore.h> #include <linphone/linphonecore.h>
#include <mediastreamer2/msvolume.h>
#include <mediastreamer2/mssndcard.h> #include <mediastreamer2/mssndcard.h>
#include <mediastreamer2/msticker.h> #include <mediastreamer2/msticker.h>
#include <mediastreamer2/msvolume.h>
#include <model/core/CoreModel.hpp> #include <model/core/CoreModel.hpp>
#include "MediastreamerUtils.hpp"
#include <qlogging.h> #include <qlogging.h>
using namespace MediastreamerUtils; using namespace MediastreamerUtils;
SimpleCaptureGraph::SimpleCaptureGraph(const std::string &capture, const std::string &playback) SimpleCaptureGraph::SimpleCaptureGraph(const std::string &capture, const std::string &playback)
: captureCardId(capture), playbackCardId(playback) : captureCardId(capture), playbackCardId(playback) {
{
LinphoneCore *ccore = CoreModel::getInstance()->getCore()->cPtr(); LinphoneCore *ccore = CoreModel::getInstance()->getCore()->cPtr();
msFactory = linphone_core_get_ms_factory(ccore); msFactory = linphone_core_get_ms_factory(ccore);
playbackCard = ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(msFactory), playbackCardId.c_str()); playbackCard = ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(msFactory), playbackCardId.c_str());
if (!playbackCard) if (!playbackCard) qWarning("Cannot get playback card from MSFactory with : %s", playbackCardId.c_str());
qWarning("Cannot get playback card from MSFactory with : %s", playbackCardId.c_str());
captureCard = ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(msFactory), captureCardId.c_str()); captureCard = ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(msFactory), captureCardId.c_str());
if (!captureCard) if (!captureCard) qWarning("Cannot get capture card from MSFactory with : %s", captureCardId.c_str());
qWarning("Cannot get capture card from MSFactory with : %s", captureCardId.c_str());
if(playbackCard && captureCard)// Assure to initialize when playback and capture are available if (playbackCard && captureCard) // Assure to initialize when playback and capture are available
init(); init();
} }
SimpleCaptureGraph::~SimpleCaptureGraph() SimpleCaptureGraph::~SimpleCaptureGraph() {
{
destroy(); destroy();
} }
static void device_notify_cb(void *user_data, MSFilter *f, unsigned int event, void *eventdata) { static void device_notify_cb(void *user_data, MSFilter *f, unsigned int event, void *eventdata) {
if (event == MS_FILTER_OUTPUT_FMT_CHANGED) { if (event == MS_FILTER_OUTPUT_FMT_CHANGED) {
SimpleCaptureGraph * graph = (SimpleCaptureGraph *)user_data; SimpleCaptureGraph *graph = (SimpleCaptureGraph *)user_data;
int captureRate, playbackRate, captureChannels, playbackChannels; int captureRate, playbackRate, captureChannels, playbackChannels;
ms_filter_call_method(graph->audioCapture,MS_FILTER_GET_SAMPLE_RATE,&captureRate); ms_filter_call_method(graph->audioCapture, MS_FILTER_GET_SAMPLE_RATE, &captureRate);
ms_filter_call_method(graph->audioSink,MS_FILTER_GET_SAMPLE_RATE,&playbackRate); ms_filter_call_method(graph->audioSink, MS_FILTER_GET_SAMPLE_RATE, &playbackRate);
ms_filter_call_method(graph->audioCapture,MS_FILTER_GET_NCHANNELS,&captureChannels); ms_filter_call_method(graph->audioCapture, MS_FILTER_GET_NCHANNELS, &captureChannels);
ms_filter_call_method(graph->audioSink,MS_FILTER_GET_NCHANNELS,&playbackChannels); ms_filter_call_method(graph->audioSink, MS_FILTER_GET_NCHANNELS, &playbackChannels);
ms_filter_call_method(graph->resamplerFilter,MS_FILTER_SET_SAMPLE_RATE,&captureRate); ms_filter_call_method(graph->resamplerFilter, MS_FILTER_SET_SAMPLE_RATE, &captureRate);
ms_filter_call_method(graph->resamplerFilter,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&playbackRate); ms_filter_call_method(graph->resamplerFilter, MS_FILTER_SET_OUTPUT_SAMPLE_RATE, &playbackRate);
ms_filter_call_method(graph->resamplerFilter,MS_FILTER_SET_NCHANNELS,&captureChannels); ms_filter_call_method(graph->resamplerFilter, MS_FILTER_SET_NCHANNELS, &captureChannels);
ms_filter_call_method(graph->resamplerFilter,MS_FILTER_SET_OUTPUT_NCHANNELS,&playbackChannels); ms_filter_call_method(graph->resamplerFilter, MS_FILTER_SET_OUTPUT_NCHANNELS, &playbackChannels);
} }
} }
void SimpleCaptureGraph::init() { void SimpleCaptureGraph::init() {
if (!audioCapture) { if (!audioCapture) {
audioCapture = ms_snd_card_create_reader(captureCard); audioCapture = ms_snd_card_create_reader(captureCard);
ms_filter_add_notify_callback(audioCapture, device_notify_cb,this,FALSE); ms_filter_add_notify_callback(audioCapture, device_notify_cb, this, FALSE);
} }
if (!audioSink) { if (!audioSink) {
audioSink = ms_snd_card_create_writer(playbackCard); audioSink = ms_snd_card_create_writer(playbackCard);
ms_filter_add_notify_callback(audioSink, device_notify_cb,this,FALSE); ms_filter_add_notify_callback(audioSink, device_notify_cb, this, FALSE);
} }
if (!captureVolumeFilter) { if (!captureVolumeFilter) {
captureVolumeFilter = ms_factory_create_filter(msFactory, MS_VOLUME_ID); captureVolumeFilter = ms_factory_create_filter(msFactory, MS_VOLUME_ID);
@ -81,42 +77,39 @@ void SimpleCaptureGraph::init() {
if (!playbackVolumeFilter) { if (!playbackVolumeFilter) {
playbackVolumeFilter = ms_factory_create_filter(msFactory, MS_VOLUME_ID); playbackVolumeFilter = ms_factory_create_filter(msFactory, MS_VOLUME_ID);
} }
if(!resamplerFilter) if (!resamplerFilter) resamplerFilter = ms_factory_create_filter(msFactory, MS_RESAMPLE_ID);
resamplerFilter = ms_factory_create_filter(msFactory, MS_RESAMPLE_ID);
int captureRate, playbackRate, captureChannels, playbackChannels; int captureRate, playbackRate, captureChannels, playbackChannels;
ms_filter_call_method(audioCapture,MS_FILTER_GET_SAMPLE_RATE,&captureRate); ms_filter_call_method(audioCapture, MS_FILTER_GET_SAMPLE_RATE, &captureRate);
ms_filter_call_method(audioSink,MS_FILTER_GET_SAMPLE_RATE,&playbackRate); ms_filter_call_method(audioSink, MS_FILTER_GET_SAMPLE_RATE, &playbackRate);
ms_filter_call_method(audioCapture,MS_FILTER_GET_NCHANNELS,&captureChannels); ms_filter_call_method(audioCapture, MS_FILTER_GET_NCHANNELS, &captureChannels);
ms_filter_call_method(audioSink,MS_FILTER_GET_NCHANNELS,&playbackChannels); ms_filter_call_method(audioSink, MS_FILTER_GET_NCHANNELS, &playbackChannels);
ms_filter_call_method(resamplerFilter,MS_FILTER_SET_SAMPLE_RATE,&captureRate); ms_filter_call_method(resamplerFilter, MS_FILTER_SET_SAMPLE_RATE, &captureRate);
ms_filter_call_method(resamplerFilter,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&playbackRate); ms_filter_call_method(resamplerFilter, MS_FILTER_SET_OUTPUT_SAMPLE_RATE, &playbackRate);
ms_filter_call_method(resamplerFilter,MS_FILTER_SET_NCHANNELS,&captureChannels); ms_filter_call_method(resamplerFilter, MS_FILTER_SET_NCHANNELS, &captureChannels);
ms_filter_call_method(resamplerFilter,MS_FILTER_SET_OUTPUT_NCHANNELS,&playbackChannels); ms_filter_call_method(resamplerFilter, MS_FILTER_SET_OUTPUT_NCHANNELS, &playbackChannels);
ms_filter_link(audioCapture, 0, captureVolumeFilter, 0); ms_filter_link(audioCapture, 0, captureVolumeFilter, 0);
ms_filter_link(captureVolumeFilter, 0, resamplerFilter, 0); ms_filter_link(captureVolumeFilter, 0, resamplerFilter, 0);
ms_filter_link(resamplerFilter, 0, playbackVolumeFilter, 0); ms_filter_link(resamplerFilter, 0, playbackVolumeFilter, 0);
ms_filter_link(playbackVolumeFilter, 0, audioSink, 0); ms_filter_link(playbackVolumeFilter, 0, audioSink, 0);
//Mute playback // Mute playback
float muteGain = 0.0f; float muteGain = 0.0f;
ms_filter_call_method(playbackVolumeFilter, static_cast<unsigned int>(MS_VOLUME_SET_GAIN), &muteGain); ms_filter_call_method(playbackVolumeFilter, static_cast<unsigned int>(MS_VOLUME_SET_GAIN), &muteGain);
ticker = ms_ticker_new(); ticker = ms_ticker_new();
running = false; running = false;
} }
void SimpleCaptureGraph::start() { void SimpleCaptureGraph::start() {
if (!running && audioCapture) { if (!running && audioCapture) {
running = true; running = true;
ms_ticker_attach(ticker, audioCapture); ms_ticker_attach(ticker, audioCapture);
} }
} }
void SimpleCaptureGraph::stop() { void SimpleCaptureGraph::stop() {
if (running && audioCapture){ if (running && audioCapture) {
ms_ticker_detach(ticker, audioCapture); ms_ticker_detach(ticker, audioCapture);
running = false; running = false;
} }
@ -126,27 +119,18 @@ void SimpleCaptureGraph::destroy() {
if (running) { if (running) {
stop(); stop();
} }
if (audioSink) if (audioSink) ms_filter_unlink(playbackVolumeFilter, 0, audioSink, 0);
ms_filter_unlink(playbackVolumeFilter, 0, audioSink, 0); if (captureVolumeFilter && resamplerFilter) ms_filter_unlink(captureVolumeFilter, 0, resamplerFilter, 0);
if (captureVolumeFilter && resamplerFilter) if (resamplerFilter && playbackVolumeFilter) ms_filter_unlink(resamplerFilter, 0, playbackVolumeFilter, 0);
ms_filter_unlink(captureVolumeFilter, 0, resamplerFilter, 0); if (audioCapture) ms_filter_unlink(audioCapture, 0, captureVolumeFilter, 0);
if (resamplerFilter && playbackVolumeFilter) if (playbackVolumeFilter) ms_filter_destroy(playbackVolumeFilter);
ms_filter_unlink(resamplerFilter, 0, playbackVolumeFilter, 0); if (captureVolumeFilter) ms_filter_destroy(captureVolumeFilter);
if (audioCapture) if (resamplerFilter) ms_filter_destroy(resamplerFilter);
ms_filter_unlink(audioCapture, 0, captureVolumeFilter, 0); if (audioSink) ms_filter_destroy(audioSink);
if (playbackVolumeFilter) if (audioCapture) ms_filter_destroy(audioCapture);
ms_filter_destroy(playbackVolumeFilter);
if (captureVolumeFilter)
ms_filter_destroy(captureVolumeFilter);
if (resamplerFilter)
ms_filter_destroy(resamplerFilter);
if (audioSink)
ms_filter_destroy(audioSink);
if (audioCapture)
ms_filter_destroy(audioCapture);
if (ticker) { if (ticker) {
ms_ticker_destroy(ticker);// Destroy ticker at the end to avoid conflicts between attached filters ms_ticker_destroy(ticker); // Destroy ticker at the end to avoid conflicts between attached filters
} }
ticker = nullptr; ticker = nullptr;
playbackVolumeFilter = nullptr; playbackVolumeFilter = nullptr;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).
@ -36,64 +36,62 @@ struct _MSFactory;
namespace MediastreamerUtils { namespace MediastreamerUtils {
inline float computeVu (float volume) { inline float computeVu(float volume) {
constexpr float VuMin = -20.f; constexpr float VuMin = -20.f;
constexpr float VuMax = 4.f; constexpr float VuMax = 4.f;
if (volume < VuMin) if (volume < VuMin) return 0.f;
return 0.f; if (volume > VuMax) return 1.f;
if (volume > VuMax)
return 1.f;
return (volume - VuMin) / (VuMax - VuMin);
}
inline float dbToLinear(float volume) {
return static_cast<float>(pow(10.0, volume / 10.0));
}
float linearToDb(float volume);
//Simple mediastreamer audio capture graph
//Used to get current microphone volume in audio settings
class SimpleCaptureGraph {
public:
SimpleCaptureGraph(const std::string &captureCardId, const std::string &playbackCardId);
~SimpleCaptureGraph();
void start();
void stop();
float getCaptureVolume();
float getCaptureGain();
float getPlaybackGain();
void setCaptureGain(float volume);
void setPlaybackGain(float volume);
bool isRunning() const {
return running;
}
void init();
void destroy();
bool running = false;
std::string captureCardId;
std::string playbackCardId;
_MSFilter *audioSink = nullptr;
_MSFilter *audioCapture = nullptr;
_MSFilter *captureVolumeFilter = nullptr;
_MSFilter *playbackVolumeFilter = nullptr;
_MSFilter *resamplerFilter = nullptr;
_MSTicker *ticker = nullptr;
_MSSndCard *playbackCard = nullptr;
_MSSndCard *captureCard = nullptr;
_MSFactory *msFactory = nullptr;
};
return (volume - VuMin) / (VuMax - VuMin);
} }
inline float dbToLinear(float volume) {
return static_cast<float>(pow(10.0, volume / 10.0));
}
float linearToDb(float volume);
// Simple mediastreamer audio capture graph
// Used to get current microphone volume in audio settings
class SimpleCaptureGraph {
public:
SimpleCaptureGraph(const std::string &captureCardId, const std::string &playbackCardId);
~SimpleCaptureGraph();
void start();
void stop();
float getCaptureVolume();
float getCaptureGain();
float getPlaybackGain();
void setCaptureGain(float volume);
void setPlaybackGain(float volume);
bool isRunning() const {
return running;
}
void init();
void destroy();
bool running = false;
std::string captureCardId;
std::string playbackCardId;
_MSFilter *audioSink = nullptr;
_MSFilter *audioCapture = nullptr;
_MSFilter *captureVolumeFilter = nullptr;
_MSFilter *playbackVolumeFilter = nullptr;
_MSFilter *resamplerFilter = nullptr;
_MSTicker *ticker = nullptr;
_MSSndCard *playbackCard = nullptr;
_MSSndCard *captureCard = nullptr;
_MSFactory *msFactory = nullptr;
};
} // namespace MediastreamerUtils
#endif // ifndef MEDIASTREAMER_UTILS_H_ #endif // ifndef MEDIASTREAMER_UTILS_H_

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).
@ -24,11 +24,11 @@
#include <QtGlobal> #include <QtGlobal>
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#include "DesktopToolsLinux.hpp" #include "DesktopToolsLinux.hpp"
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
#include "DesktopToolsWindows.hpp" #include "DesktopToolsWindows.hpp"
#else #else
#include "DesktopToolsMacOs.hpp" #include "DesktopToolsMacOs.hpp"
#endif // ifdef Q_OS_LINUX #endif // ifdef Q_OS_LINUX
// ============================================================================= // =============================================================================

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).
@ -22,22 +22,23 @@
// ============================================================================= // =============================================================================
extern "C" bool enableScreenSaverMacOs (); extern "C" bool enableScreenSaverMacOs();
extern "C" bool disableScreenSaverMacOs (); extern "C" bool disableScreenSaverMacOs();
DesktopTools::DesktopTools (QObject *parent) : QObject(parent) {} DesktopTools::DesktopTools(QObject *parent) : QObject(parent) {
DesktopTools::~DesktopTools () {
setScreenSaverStatus(true);
} }
bool DesktopTools::getScreenSaverStatus () const { DesktopTools::~DesktopTools() {
return mScreenSaverStatus; setScreenSaverStatus(true);
} }
void DesktopTools::setScreenSaverStatus (bool status) { bool DesktopTools::getScreenSaverStatus() const {
if (status != mScreenSaverStatus && (status ? enableScreenSaverMacOs() : disableScreenSaverMacOs())) { return mScreenSaverStatus;
mScreenSaverStatus = status; }
emit screenSaverStatusChanged(mScreenSaverStatus);
} void DesktopTools::setScreenSaverStatus(bool status) {
if (status != mScreenSaverStatus && (status ? enableScreenSaverMacOs() : disableScreenSaverMacOs())) {
mScreenSaverStatus = status;
emit screenSaverStatusChanged(mScreenSaverStatus);
}
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).
@ -28,23 +28,23 @@
class QDBusPendingCallWatcher; class QDBusPendingCallWatcher;
class ScreenSaverDBus : public QObject { class ScreenSaverDBus : public QObject {
Q_OBJECT; Q_OBJECT;
public: public:
ScreenSaverDBus (QObject *parent = Q_NULLPTR); ScreenSaverDBus(QObject *parent = Q_NULLPTR);
~ScreenSaverDBus (); ~ScreenSaverDBus();
bool getScreenSaverStatus () const; bool getScreenSaverStatus() const;
void setScreenSaverStatus (bool status); void setScreenSaverStatus(bool status);
signals: signals:
void screenSaverStatusChanged (bool status); void screenSaverStatusChanged(bool status);
private: private:
bool mScreenSaverStatus = true; bool mScreenSaverStatus = true;
QDBusInterface mBus; QDBusInterface mBus;
uint32_t mToken; uint32_t mToken;
}; };
#endif // SCREEN_SAVER_DBUS_H_ #endif // SCREEN_SAVER_DBUS_H_

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).
@ -25,32 +25,29 @@
// ============================================================================= // =============================================================================
namespace { namespace {
constexpr char Program[] = "xdg-screensaver"; constexpr char Program[] = "xdg-screensaver";
const QStringList Arguments{"reset"}; const QStringList Arguments{"reset"};
constexpr int Interval = 30000; constexpr int Interval = 30000;
} // namespace
ScreenSaverXdg::ScreenSaverXdg(QObject *parent) : QObject(parent) {
mTimer.setInterval(Interval);
QObject::connect(&mTimer, &QTimer::timeout, []() {
// Legacy for systems without DBus screensaver.
QProcess::startDetached(Program, Arguments);
});
} }
ScreenSaverXdg::ScreenSaverXdg (QObject *parent) : QObject(parent) { bool ScreenSaverXdg::getScreenSaverStatus() const {
mTimer.setInterval(Interval); return !mTimer.isActive();
QObject::connect(&mTimer, &QTimer::timeout, []() {
// Legacy for systems without DBus screensaver.
QProcess::startDetached(Program, Arguments);
});
} }
bool ScreenSaverXdg::getScreenSaverStatus () const { void ScreenSaverXdg::setScreenSaverStatus(bool status) {
return !mTimer.isActive(); if (status == !mTimer.isActive()) return;
}
if (status) mTimer.stop();
void ScreenSaverXdg::setScreenSaverStatus (bool status) { else mTimer.start();
if (status == !mTimer.isActive())
return; emit screenSaverStatusChanged(status);
if (status)
mTimer.stop();
else
mTimer.start();
emit screenSaverStatusChanged(status);
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).
@ -26,19 +26,19 @@
// ============================================================================= // =============================================================================
class ScreenSaverXdg : public QObject { class ScreenSaverXdg : public QObject {
Q_OBJECT; Q_OBJECT;
public: public:
ScreenSaverXdg (QObject *parent = Q_NULLPTR); ScreenSaverXdg(QObject *parent = Q_NULLPTR);
bool getScreenSaverStatus () const; bool getScreenSaverStatus() const;
void setScreenSaverStatus (bool status); void setScreenSaverStatus(bool status);
signals: signals:
void screenSaverStatusChanged (bool status); void screenSaverStatusChanged(bool status);
private: private:
QTimer mTimer; QTimer mTimer;
}; };
#endif // SCREEN_SAVER_XDG_H_ #endif // SCREEN_SAVER_XDG_H_

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010-2020 Belledonne Communications SARL. * Copyright (c) 2010-2024 Belledonne Communications SARL.
* *
* This file is part of linphone-desktop * This file is part of linphone-desktop
* (see https://www.linphone.org). * (see https://www.linphone.org).