Fix setting output/device for Xine and VLC backend

- Fixed setting output and device on Xine and VLC backend
- Fixed track slider for Xine, VLC and Phonon
- Improved backend settings to better support multiple backends
- Added group by samplerate and bitdepth in collection
- Fixed crash on exit when existing instance of the application is already runnung caused by NVIDIA driver
- Changed Q_OS_MAC to Q_OS_MACOS
This commit is contained in:
Jonas Kvinge
2018-06-28 01:15:32 +02:00
parent 6978983dd3
commit 985b91e5f4
56 changed files with 2799 additions and 2589 deletions

View File

@@ -1,29 +1,35 @@
/* This file is part of Strawberry.
Strawberry is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Strawberry is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Strawberry Music Player
* This file was part of Clementine
* Copyright 2017-2018, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "config.h"
#include <QtGlobal>
#include <QString>
#include <QUrl>
#include <QTimer>
#include "phononengine.h"
#include "core/logging.h"
#include "core/timeconstants.h"
#include "core/taskmanager.h"
#include "core/logging.h"
PhononEngine::PhononEngine(TaskManager *task_manager)
: media_object_(new Phonon::MediaObject(this)),
@@ -66,7 +72,7 @@ bool PhononEngine::Load(const QUrl &url, Engine::TrackChangeFlags change, bool f
bool PhononEngine::Play(quint64 offset_nanosec) {
// The seek happens in PhononStateChanged - phonon doesn't seem to change currentTime() if we seek before we start playing :S
seek_offset_ = offset_nanosec;
seek_offset_ = (offset_nanosec / kNsecPerMsec);
media_object_->play();
return true;
@@ -113,7 +119,8 @@ uint PhononEngine::length() const {
}
void PhononEngine::Seek(quint64 offset_nanosec) {
media_object_->seek(offset_nanosec);
int offset = (offset_nanosec / kNsecPerMsec);
media_object_->seek(offset);
}
void PhononEngine::SetVolumeSW(uint volume) {
@@ -144,13 +151,34 @@ void PhononEngine::StateTimeoutExpired() {
}
qint64 PhononEngine::position_nanosec() const {
return 0;
if (state() == Engine::Empty) return 0;
const qint64 result = (position() * kNsecPerMsec);
return qint64(qMax(0ll, result));
}
qint64 PhononEngine::length_nanosec() const {
return 0;
if (state() == Engine::Empty) return 0;
const qint64 result = end_nanosec_ - beginning_nanosec_;
if (result > 0) {
return result;
}
else {
// Get the length from the pipeline if we don't know.
return (length() * kNsecPerMsec);
}
}
EngineBase::OutputDetailsList PhononEngine::GetOutputsList() const {
OutputDetailsList ret;
OutputDetails output;
output.name = "none";
output.description = "Configured by the system";
output.iconname = "soundcard";
ret << output;
return ret;
}
bool PhononEngine::CustomDeviceSupport(const QString &name) {
return false;
}