From 6e061764eed830a2af31ba5eb072ca6308fb28c9 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 25 Apr 2020 01:42:29 +0200 Subject: [PATCH] Remove phonon --- CMakeLists.txt | 9 +- README.md | 4 +- debian/copyright | 2 - dist/pacman/PKGBUILD.in | 2 - src/CMakeLists.txt | 14 -- src/config.h.in | 1 - src/core/player.cpp | 9 -- src/engine/enginetype.cpp | 3 - src/engine/enginetype.h | 3 +- src/engine/phononengine.cpp | 212 --------------------------- src/engine/phononengine.h | 89 ----------- src/settings/backendsettingspage.cpp | 3 - 12 files changed, 5 insertions(+), 346 deletions(-) delete mode 100644 src/engine/phononengine.cpp delete mode 100644 src/engine/phononengine.h diff --git a/CMakeLists.txt b/CMakeLists.txt index d1132a6b4..8c10340d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,6 @@ pkg_check_modules(GSTREAMER_TAG gstreamer-tag-1.0) pkg_check_modules(GSTREAMER_PBUTILS gstreamer-pbutils-1.0) pkg_check_modules(LIBXINE libxine) pkg_check_modules(LIBVLC libvlc) -pkg_check_modules(PHONON phonon4qt5) pkg_check_modules(SQLITE REQUIRED sqlite3>=3.9) pkg_check_modules(LIBPULSE libpulse) pkg_check_modules(CHROMAPRINT libchromaprint) @@ -297,10 +296,6 @@ optional_component(VLC ON "Engine: VLC backend" DEPENDS "libvlc" LIBVLC_FOUND ) -optional_component(PHONON OFF "Engine: Phonon backend (UNSTABLE)" - DEPENDS "phonon4qt5" PHONON_FOUND -) - optional_component(CHROMAPRINT ON "Chromaprint (Tag fetching from Musicbrainz)" DEPENDS "chromaprint" CHROMAPRINT_FOUND ) @@ -441,8 +436,8 @@ add_custom_target(uninstall # Show a summary of what we have enabled summary_show() -if(NOT HAVE_GSTREAMER AND NOT HAVE_XINE AND NOT HAVE_VLC AND NOT HAVE_PHONON) - message(FATAL_ERROR "You need to have either GStreamer, Xine, VLC or Phonon to compile!") +if(NOT HAVE_GSTREAMER AND NOT HAVE_XINE AND NOT HAVE_VLC) + message(FATAL_ERROR "You need to have either GStreamer, Xine or VLC to compile!") elseif(NOT HAVE_GSTREAMER) message(WARNING "GStreamer is the only engine that is fully implemented. Using other engines is possible but not recommended.") endif() diff --git a/README.md b/README.md index 93c1d0855..a6290dff3 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ To build Strawberry from source you need the following installed on your system * [ALSA library (linux)](https://www.alsa-project.org/) * [DBus (linux)](https://www.freedesktop.org/wiki/Software/dbus/) * [PulseAudio (linux optional)](https://www.freedesktop.org/wiki/Software/PulseAudio/?) -* [GStreamer](https://gstreamer.freedesktop.org/), [Xine](https://www.xine-project.org), [VLC](https://www.videolan.org) or [Phonon](https://techbase.kde.org/Phonon) +* [GStreamer](https://gstreamer.freedesktop.org/), [Xine](https://www.xine-project.org) or [VLC](https://www.videolan.org) * [GnuTLS](https://www.gnutls.org/) Optional dependencies: @@ -74,7 +74,7 @@ Optional dependencies: * iPhone, iPod Touch, iPad and Apple TV devices: [libimobiledevice, libplist and libusbmuxd](https://www.libimobiledevice.org/) * Moodbar: [fftw3](http://www.fftw.org/) -Either GStreamer, Xine, VLC or Phonon engine is required, but only GStreamer is fully implemented so far. +Either GStreamer, Xine or VLC engine is required, but only GStreamer is fully implemented so far. You should also install the gstreamer plugins base and good, and optionally bad and ugly. ### :wrench: Compiling from source diff --git a/debian/copyright b/debian/copyright index 6d615810d..074bd42b1 100644 --- a/debian/copyright +++ b/debian/copyright @@ -34,8 +34,6 @@ Files: src/core/main.h src/engine/devicefinder.h src/engine/enginedevice.cpp src/engine/enginedevice.h - src/engine/phononengine.cpp - src/engine/phononengine.h src/internet/internetservice.cpp src/internet/internetservice.h src/internet/internettabsview.cpp diff --git a/dist/pacman/PKGBUILD.in b/dist/pacman/PKGBUILD.in index 12c040878..6e09ef5ba 100644 --- a/dist/pacman/PKGBUILD.in +++ b/dist/pacman/PKGBUILD.in @@ -32,7 +32,6 @@ depends=( libusbmuxd libplist libimobiledevice - phonon-qt5 fftw ) optdepends=( @@ -54,7 +53,6 @@ build() { cmake ../${pkgname}-@STRAWBERRY_VERSION_PACKAGE@ \ -DCMAKE_INSTALL_PREFIX=/usr \ -DUSE_SYSTEM_TAGLIB=ON \ - -DENABLE_PHONON=ON \ -DENABLE_TRANSLATIONS=ON make -j$(nproc) } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a0d683d4b..8d46a70ef 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(HAVE_GSTREAMER) include_directories(${GSTREAMER_PBUTILS_INCLUDE_DIRS}) endif(HAVE_GSTREAMER) -if(HAVE_PHONON) - include_directories(${PHONON_INCLUDE_DIRS}) -endif(HAVE_PHONON) - if(HAVE_CHROMAPRINT) link_directories(${CHROMAPRINT_LIBRARY_DIRS}) include_directories(${CHROMAPRINT_INCLUDE_DIRS}) @@ -588,12 +584,6 @@ optional_source(HAVE_VLC HEADERS engine/vlcengine.h ) -# Phonon -optional_source(HAVE_PHONON - SOURCES engine/phononengine.cpp - HEADERS engine/phononengine.h -) - # DBUS and MPRIS - Unix specific if(UNIX AND HAVE_DBUS) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus) @@ -1023,10 +1013,6 @@ if(HAVE_VLC) target_link_libraries(strawberry_lib ${LIBVLC_LIBRARIES}) endif() -if(HAVE_PHONON) - target_link_libraries(strawberry_lib ${PHONON_LIBRARIES}) -endif() - if(HAVE_LIBGPOD) target_link_libraries(strawberry_lib ${LIBGPOD_LIBRARIES}) endif(HAVE_LIBGPOD) diff --git a/src/config.h.in b/src/config.h.in index 7ba2d3888..4e80b1094 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -45,7 +45,6 @@ #cmakedefine HAVE_GSTREAMER #cmakedefine HAVE_VLC #cmakedefine HAVE_XINE -#cmakedefine HAVE_PHONON #cmakedefine XINE_ANALYZER #cmakedefine HAVE_SUBSONIC diff --git a/src/core/player.cpp b/src/core/player.cpp index 89e2fde1b..1a211ca7b 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -54,9 +54,6 @@ #ifdef HAVE_XINE # include "engine/xineengine.h" #endif -#ifdef HAVE_PHONON -# include "engine/phononengine.h" -#endif #ifdef HAVE_VLC # include "engine/vlcengine.h" #endif @@ -139,12 +136,6 @@ Engine::EngineType Player::CreateEngine(Engine::EngineType enginetype) { use_enginetype=Engine::VLC; engine_.reset(new VLCEngine(app_->task_manager())); break; -#endif -#ifdef HAVE_PHONON - case Engine::Phonon: - use_enginetype=Engine::Phonon; - engine_.reset(new PhononEngine(app_->task_manager())); - break; #endif default: if (i > 0) { qFatal("No engine available!"); } diff --git a/src/engine/enginetype.cpp b/src/engine/enginetype.cpp index 1e68014bd..443c39c40 100644 --- a/src/engine/enginetype.cpp +++ b/src/engine/enginetype.cpp @@ -30,7 +30,6 @@ Engine::EngineType EngineTypeFromName(QString enginename) { if (lower == "gstreamer") return Engine::GStreamer; else if (lower == "xine") return Engine::Xine; else if (lower == "vlc") return Engine::VLC; - else if (lower == "phonon") return Engine::Phonon; else return Engine::None; } @@ -39,7 +38,6 @@ QString EngineName(Engine::EngineType enginetype) { case Engine::GStreamer: return QString("gstreamer"); case Engine::Xine: return QString("xine"); case Engine::VLC: return QString("vlc"); - case Engine::Phonon: return QString("phonon"); case Engine::None: default: return QString("None"); } @@ -50,7 +48,6 @@ QString EngineDescription(Engine::EngineType enginetype) { case Engine::GStreamer: return QString("GStreamer"); case Engine::Xine: return QString("Xine"); case Engine::VLC: return QString("VLC"); - case Engine::Phonon: return QString("Phonon"); case Engine::None: default: return QString("None"); diff --git a/src/engine/enginetype.h b/src/engine/enginetype.h index 1bdde6e19..b4a697673 100644 --- a/src/engine/enginetype.h +++ b/src/engine/enginetype.h @@ -31,8 +31,7 @@ enum EngineType { None, GStreamer, VLC, - Xine, - Phonon + Xine }; Engine::EngineType EngineTypeFromName(QString enginename); diff --git a/src/engine/phononengine.cpp b/src/engine/phononengine.cpp deleted file mode 100644 index 535a77b4c..000000000 --- a/src/engine/phononengine.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Strawberry Music Player - * This file was part of Clementine - * Copyright 2010, David Sansome - * Copyright 2017-2018, Jonas Kvinge - * - * 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 . - * - */ - -#include "config.h" - -#include -#include -#include -#include - -#include "phononengine.h" - -#include "core/timeconstants.h" -#include "core/taskmanager.h" -#include "core/logging.h" - -PhononEngine::PhononEngine(TaskManager *task_manager) - : EngineBase(), - media_object_(new Phonon::MediaObject(this)), - audio_output_(new Phonon::AudioOutput(Phonon::MusicCategory, this)), - state_timer_(new QTimer(this)), - seek_offset_(-1) { - - Q_UNUSED(task_manager); - - type_ = Engine::Phonon; - - Phonon::createPath(media_object_, audio_output_); - - connect(media_object_, SIGNAL(finished()), SLOT(PhononFinished())); - connect(media_object_, SIGNAL(stateChanged(Phonon::State,Phonon::State)), SLOT(PhononStateChanged(Phonon::State))); - - state_timer_->setSingleShot(true); - connect(state_timer_, SIGNAL(timeout()), SLOT(StateTimeoutExpired())); - -} - -PhononEngine::~PhononEngine() { - delete media_object_; - delete audio_output_; -} - -bool PhononEngine::Init() { - return true; -} - -bool PhononEngine::CanDecode(const QUrl &url) { - Q_UNUSED(url); - // TODO - return true; -} - -bool PhononEngine::Load(const QUrl &stream_url, const QUrl &original_url, const Engine::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec) { - - Q_UNUSED(original_url); - Q_UNUSED(change); - Q_UNUSED(force_stop_at_end); - Q_UNUSED(beginning_nanosec); - Q_UNUSED(end_nanosec); - - media_object_->setCurrentSource(Phonon::MediaSource(stream_url)); - return true; -} - -bool PhononEngine::Play(const 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 / kNsecPerMsec); - - media_object_->play(); - return true; - -} - -void PhononEngine::Stop(const bool stop_after) { - Q_UNUSED(stop_after); - media_object_->stop(); -} - -void PhononEngine::Pause() { - media_object_->pause(); -} - -void PhononEngine::Unpause() { - media_object_->play(); -} - -Engine::State PhononEngine::state() const { - - switch (media_object_->state()) { - case Phonon::LoadingState: - case Phonon::PlayingState: - case Phonon::BufferingState: - return Engine::Playing; - - case Phonon::PausedState: - return Engine::Paused; - - case Phonon::StoppedState: - case Phonon::ErrorState: - default: - return Engine::Empty; - } - -} - -uint PhononEngine::position() const { - return media_object_->currentTime(); -} - -uint PhononEngine::length() const { - return media_object_->totalTime(); -} - -void PhononEngine::Seek(const quint64 offset_nanosec) { - int offset = (offset_nanosec / kNsecPerMsec); - media_object_->seek(offset); -} - -void PhononEngine::SetVolumeSW(const uint volume) { - audio_output_->setVolume(volume); -} - -void PhononEngine::PhononFinished() { - emit TrackEnded(); -} - -void PhononEngine::PhononStateChanged(const Phonon::State new_state) { - - if (new_state == Phonon::ErrorState) { - emit Error(media_object_->errorString()); - } - if (new_state == Phonon::PlayingState && seek_offset_ != -1) { - media_object_->seek(seek_offset_); - seek_offset_ = -1; - } - - // Don't emit the state change straight away - state_timer_->start(100); - -} - -void PhononEngine::StateTimeoutExpired() { - emit StateChanged(state()); -} - -qint64 PhononEngine::position_nanosec() const { - if (state() == Engine::Empty) return 0; - const qint64 result = (position() * kNsecPerMsec); - return qint64(qMax(0ll, result)); - -} - -qint64 PhononEngine::length_nanosec() const { - - 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::ValidOutput(const QString &output) { - - return (output == "auto" || output == "" || output == DefaultOutput()); - -} - -bool PhononEngine::CustomDeviceSupport(const QString &output) { - Q_UNUSED(output); - return false; -} - -bool PhononEngine::ALSADeviceSupport(const QString &output) { - Q_UNUSED(output); - return false; -} diff --git a/src/engine/phononengine.h b/src/engine/phononengine.h deleted file mode 100644 index 06e43ad8e..000000000 --- a/src/engine/phononengine.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Strawberry Music Player - * This file was part of Clementine - * Copyright 2010, David Sansome - * Copyright 2017-2018, Jonas Kvinge - * - * 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 . - * - */ - -#ifndef PHONONENGINE_H -#define PHONONENGINE_H - -#include "config.h" - -#include -#include - -#include -#include -#include - -#include "enginebase.h" - -class QTimer; -class TaskManager; - -class PhononEngine : public Engine::Base { - Q_OBJECT - - public: - explicit PhononEngine(TaskManager *task_manager); - ~PhononEngine(); - - bool Init(); - - OutputDetailsList GetOutputsList() const; - - bool CanDecode(const QUrl &url); - - bool Load(const QUrl &stream_url, const QUrl &original_url, const Engine::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec); - bool Play(const quint64 offset_nanosec); - void Stop(const bool stop_after = false); - void Pause(); - void Unpause(); - - Engine::State state() const; - uint position() const; - uint length() const; - - void Seek(const quint64 offset_nanosec); - - qint64 position_nanosec() const; - qint64 length_nanosec() const; - - QString DefaultOutput() { return QString(""); } - bool ValidOutput(const QString &output); - bool CustomDeviceSupport(const QString &output); - bool ALSADeviceSupport(const QString &output); - - protected: - void SetVolumeSW(const uint percent ); - - private slots: - void PhononFinished(); - void PhononStateChanged(const Phonon::State new_state); - void StateTimeoutExpired(); - - private: - Phonon::MediaObject *media_object_; - Phonon::AudioOutput *audio_output_; - - QTimer *state_timer_; - - qint64 seek_offset_; -}; - -#endif // PHONONENGINE_H diff --git a/src/settings/backendsettingspage.cpp b/src/settings/backendsettingspage.cpp index 8c8023f9a..0295c8fca 100644 --- a/src/settings/backendsettingspage.cpp +++ b/src/settings/backendsettingspage.cpp @@ -100,9 +100,6 @@ void BackendSettingsPage::Load() { #ifdef HAVE_VLC ui_->combobox_engine->addItem(IconLoader::Load("vlc"), EngineDescription(Engine::VLC), QVariant::fromValue(Engine::VLC)); #endif -#ifdef HAVE_PHONON - ui_->combobox_engine->addItem(IconLoader::Load("speaker"), EngineDescription(Engine::Phonon), QVariant::fromValue(Engine::Phonon)); -#endif enginetype_current_ = enginetype; output_current_ = s_.value("output", QString()).toString();