summaryrefslogtreecommitdiffstats
path: root/app/phone.cpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-01-16 19:44:28 -0500
committerScott Murray <scott.murray@konsulko.com>2019-02-11 15:02:37 +0000
commit2a950adb3229056313c8a8267dec67d2ceadf5ef (patch)
treebafe6ed8a99ea76e4e6b98d7fd223645eebb9186 /app/phone.cpp
parent546f5137a2391984f96d65b318f74f1a918ba131 (diff)
Replace QtMultimedia usage with 4A + gstreamer
Replace QtMultimedia usage for ringtone playing with a gstreamer pipeline that uses the provided 4A role ALSA device for output. For now, a "phone" role is assumed to be available, but it does not exist in the current set of 4A policy and HALs, and needs to be added. Testing was done by making the required role changes locally and using some debug QML tweaks to allow triggering the ringtone manually. Bug-AGL: SPEC-1596 Change-Id: I55c2229de1bc5470ee818e5be382b64664fa2d29 Signed-off-by: Scott Murray <scott.murray@konsulko.com> (cherry picked from commit 90b83db9213308a4451d9c86b380aba6d13313b5)
Diffstat (limited to 'app/phone.cpp')
-rw-r--r--app/phone.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/app/phone.cpp b/app/phone.cpp
index 254fe24..8e8edcd 100644
--- a/app/phone.cpp
+++ b/app/phone.cpp
@@ -16,18 +16,14 @@
#include <QDebug>
#include <QObject>
-#include <QSoundEffect>
#include <QTimer>
#include <telephony.h>
#include "phone.h"
-Phone::Phone(Telephony *telephony, QObject *parent) :
- QObject(parent)
+Phone::Phone(Telephony *telephony, FilePlayer *player, QObject *parent) :
+ QObject(parent),
+ m_ringtone(player)
{
- m_ringtone.setSource(QUrl("qrc:./Phone.wav"));
- m_ringtone.setVolume(0.5f);
- m_ringtone.setLoopCount(QSoundEffect::Infinite);
-
QObject::connect(telephony, &Telephony::callStateChanged, this, &Phone::onCallStateChanged);
m_call_timer.setInterval(1000);
@@ -38,15 +34,18 @@ Phone::Phone(Telephony *telephony, QObject *parent) :
void Phone::onCallStateChanged(QString callState)
{
if (callState == "disconnected") {
- m_ringtone.stop();
+ if (m_ringtone)
+ m_ringtone->stop();
m_call_timer.stop();
} else if (callState == "active") {
- m_ringtone.stop();
+ if (m_ringtone)
+ m_ringtone->stop();
m_date_time = m_date_time.fromSecsSinceEpoch(0);
setElapsedTime("00:00:00");
m_call_timer.start();
} else if (callState == "incoming") {
- m_ringtone.play();
+ if (m_ringtone)
+ m_ringtone->play(true);
}
}