Remove VLC

This commit is contained in:
Jonas Kvinge
2024-09-28 16:38:23 +02:00
parent 25451d361c
commit e4a57aa768
27 changed files with 287 additions and 993 deletions

View File

@@ -291,12 +291,10 @@ MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OS
dialog->SetDestinationModel(app->collection()->model()->directory_model());
return dialog;
}),
#ifdef HAVE_GSTREAMER
transcode_dialog_([this]() {
TranscodeDialog *dialog = new TranscodeDialog(this);
return dialog;
}),
#endif
add_stream_dialog_([this]() {
AddStreamDialog *add_stream_dialog = new AddStreamDialog;
QObject::connect(add_stream_dialog, &AddStreamDialog::accepted, this, &MainWindow::AddStreamAccepted);
@@ -500,13 +498,11 @@ MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OS
// File view connections
QObject::connect(file_view_, &FileView::AddToPlaylist, this, &MainWindow::AddToPlaylist);
QObject::connect(file_view_, &FileView::PathChanged, this, &MainWindow::FilePathChanged);
#ifdef HAVE_GSTREAMER
QObject::connect(file_view_, &FileView::CopyToCollection, this, &MainWindow::CopyFilesToCollection);
QObject::connect(file_view_, &FileView::MoveToCollection, this, &MainWindow::MoveFilesToCollection);
QObject::connect(file_view_, &FileView::EditTags, this, &MainWindow::EditFileTags);
# ifndef Q_OS_WIN
#ifndef Q_OS_WIN
QObject::connect(file_view_, &FileView::CopyToDevice, this, &MainWindow::CopyFilesToDevice);
# endif
#endif
file_view_->SetTaskManager(app_->task_manager());
@@ -543,21 +539,13 @@ MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OS
QObject::connect(ui_->action_add_stream, &QAction::triggered, this, &MainWindow::AddStream);
QObject::connect(ui_->action_cover_manager, &QAction::triggered, this, &MainWindow::ShowCoverManager);
QObject::connect(ui_->action_equalizer, &QAction::triggered, this, &MainWindow::ShowEqualizer);
#if defined(HAVE_GSTREAMER)
QObject::connect(ui_->action_transcoder, &QAction::triggered, this, &MainWindow::ShowTranscodeDialog);
#else
ui_->action_transcoder->setDisabled(true);
#endif
QObject::connect(ui_->action_jump, &QAction::triggered, ui_->playlist->view(), &PlaylistView::JumpToCurrentlyPlayingTrack);
QObject::connect(ui_->action_update_collection, &QAction::triggered, &*app_->collection(), &SCollection::IncrementalScan);
QObject::connect(ui_->action_full_collection_scan, &QAction::triggered, &*app_->collection(), &SCollection::FullScan);
QObject::connect(ui_->action_stop_collection_scan, &QAction::triggered, &*app_->collection(), &SCollection::StopScan);
#if defined(HAVE_GSTREAMER)
QObject::connect(ui_->action_add_files_to_transcoder, &QAction::triggered, this, &MainWindow::AddFilesToTranscoder);
ui_->action_add_files_to_transcoder->setIcon(IconLoader::Load(QStringLiteral("tools-wizard")));
#else
ui_->action_add_files_to_transcoder->setDisabled(true);
#endif
QObject::connect(ui_->action_toggle_scrobbling, &QAction::triggered, &*app_->scrobbler(), &AudioScrobbler::ToggleScrobbling);
QObject::connect(ui_->action_love, &QAction::triggered, this, &MainWindow::Love);
@@ -757,9 +745,7 @@ MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OS
#endif
playlist_rescan_songs_ = playlist_menu_->addAction(IconLoader::Load(QStringLiteral("view-refresh")), tr("Rescan song(s)..."), this, &MainWindow::RescanSongs);
playlist_menu_->addAction(playlist_rescan_songs_);
#ifdef HAVE_GSTREAMER
playlist_menu_->addAction(ui_->action_add_files_to_transcoder);
#endif
playlist_menu_->addSeparator();
playlist_copy_url_ = playlist_menu_->addAction(IconLoader::Load(QStringLiteral("edit-copy")), tr("Copy URL(s)..."), this, &MainWindow::PlaylistCopyUrl);
playlist_show_in_collection_ = playlist_menu_->addAction(IconLoader::Load(QStringLiteral("edit-find")), tr("Show in collection..."), this, &MainWindow::ShowInCollection);
@@ -767,7 +753,7 @@ MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OS
playlist_organize_ = playlist_menu_->addAction(IconLoader::Load(QStringLiteral("edit-copy")), tr("Organize files..."), this, &MainWindow::PlaylistMoveToCollection);
playlist_copy_to_collection_ = playlist_menu_->addAction(IconLoader::Load(QStringLiteral("edit-copy")), tr("Copy to collection..."), this, &MainWindow::PlaylistCopyToCollection);
playlist_move_to_collection_ = playlist_menu_->addAction(IconLoader::Load(QStringLiteral("go-jump")), tr("Move to collection..."), this, &MainWindow::PlaylistMoveToCollection);
#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN)
#ifndef Q_OS_WIN
playlist_copy_to_device_ = playlist_menu_->addAction(IconLoader::Load(QStringLiteral("device")), tr("Copy to device..."), this, &MainWindow::PlaylistCopyToDevice);
#endif
playlist_delete_ = playlist_menu_->addAction(IconLoader::Load(QStringLiteral("edit-delete")), tr("Delete from disk..."), this, &MainWindow::PlaylistDelete);
@@ -787,7 +773,7 @@ MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OS
QObject::connect(ui_->playlist, &PlaylistContainer::UndoRedoActionsChanged, this, &MainWindow::PlaylistUndoRedoChanged);
#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN)
#ifndef Q_OS_WIN
playlist_copy_to_device_->setDisabled(app_->device_manager()->connected_devices_model()->rowCount() == 0);
QObject::connect(app_->device_manager()->connected_devices_model(), &DeviceStateFilterModel::IsEmptyChanged, playlist_copy_to_device_, &QAction::setDisabled);
#endif
@@ -1927,10 +1913,8 @@ void MainWindow::PlaylistRightClick(const QPoint global_pos, const QModelIndex &
playlist_rescan_songs_->setEnabled(local_songs > 0 && editable > 0);
playlist_rescan_songs_->setVisible(local_songs > 0 && editable > 0);
#ifdef HAVE_GSTREAMER
ui_->action_add_files_to_transcoder->setEnabled(local_songs > 0 && editable > 0);
ui_->action_add_files_to_transcoder->setVisible(local_songs > 0 && editable > 0);
#endif
playlist_open_in_browser_->setVisible(selected > 0 && local_songs == selected);
@@ -1944,7 +1928,7 @@ void MainWindow::PlaylistRightClick(const QPoint global_pos, const QModelIndex &
playlist_show_in_collection_->setVisible(false);
playlist_copy_to_collection_->setVisible(false);
playlist_move_to_collection_->setVisible(false);
#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN)
#ifndef Q_OS_WIN
playlist_copy_to_device_->setVisible(false);
#endif
playlist_organize_->setVisible(false);
@@ -2019,7 +2003,7 @@ void MainWindow::PlaylistRightClick(const QPoint global_pos, const QModelIndex &
playlist_move_to_collection_->setVisible(local_songs > 0);
}
#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN)
#ifndef Q_OS_WIN
playlist_copy_to_device_->setVisible(local_songs > 0);
#endif
@@ -2558,8 +2542,6 @@ void MainWindow::PlaylistUndoRedoChanged(QAction *undo, QAction *redo) {
void MainWindow::AddFilesToTranscoder() {
#ifdef HAVE_GSTREAMER
QStringList filenames;
const QModelIndexList proxy_indexes = ui_->playlist->view()->selectionModel()->selectedRows();
@@ -2579,8 +2561,6 @@ void MainWindow::AddFilesToTranscoder() {
ShowTranscodeDialog();
#endif
}
void MainWindow::ShowCollectionConfig() {
@@ -2630,7 +2610,7 @@ void MainWindow::MoveFilesToCollection(const QList<QUrl> &urls) {
void MainWindow::CopyFilesToDevice(const QList<QUrl> &urls) {
#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN)
#ifndef Q_OS_WIN
organize_dialog_->SetDestinationModel(app_->device_manager()->connected_devices_model(), true);
organize_dialog_->SetCopy(true);
if (organize_dialog_->SetUrls(urls)) {
@@ -2874,10 +2854,8 @@ void MainWindow::ShowAboutDialog() {
void MainWindow::ShowTranscodeDialog() {
#ifdef HAVE_GSTREAMER
transcode_dialog_->show();
transcode_dialog_->raise();
#endif
}

View File

@@ -88,9 +88,7 @@ class SystemTrayIcon;
class TagFetcher;
#endif
class TrackSelectionDialog;
#ifdef HAVE_GSTREAMER
class TranscodeDialog;
#endif
class Ui_MainWindow;
class StreamingSongsView;
class StreamingTabsView;
@@ -322,9 +320,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
Lazy<AlbumCoverManager> cover_manager_;
SharedPtr<Equalizer> equalizer_;
Lazy<OrganizeDialog> organize_dialog_;
#ifdef HAVE_GSTREAMER
Lazy<TranscodeDialog> transcode_dialog_;
#endif
Lazy<AddStreamDialog> add_stream_dialog_;
#ifdef HAVE_MUSICBRAINZ

View File

@@ -23,10 +23,8 @@
#include "metatypes.h"
#ifdef HAVE_GSTREAMER
# include <gst/gstbuffer.h>
# include <gst/gstelement.h>
#endif
#include <gst/gstbuffer.h>
#include <gst/gstelement.h>
#include <QAbstractSocket>
#include <QMetaType>
@@ -47,9 +45,7 @@
#include "engine/enginebase.h"
#include "engine/enginemetadata.h"
#ifdef HAVE_GSTREAMER
# include "engine/gstenginepipeline.h"
#endif
#include "engine/gstenginepipeline.h"
#include "collection/collectiondirectory.h"
#include "playlist/playlistitem.h"
#include "playlist/playlistsequence.h"
@@ -103,12 +99,10 @@ void RegisterMetaTypes() {
qRegisterMetaType<EngineBase::TrackChangeFlags>("EngineBase::TrackChangeFlags");
qRegisterMetaType<EngineBase::OutputDetails>("EngineBase::OutputDetails");
qRegisterMetaType<EngineMetadata>("EngineMetadata");
#ifdef HAVE_GSTREAMER
qRegisterMetaType<GstBuffer*>("GstBuffer*");
qRegisterMetaType<GstElement*>("GstElement*");
qRegisterMetaType<GstState>("GstState");
qRegisterMetaType<GstEnginePipeline*>("GstEnginePipeline*");
#endif
qRegisterMetaType<CollectionDirectory>("CollectionDirectory");
qRegisterMetaType<CollectionDirectoryList>("CollectionDirectoryList");
qRegisterMetaType<CollectionSubdirectory>("CollectionSubdirectory");

View File

@@ -49,14 +49,8 @@
#include "engine/enginebase.h"
#include "engine/enginemetadata.h"
#ifdef HAVE_GSTREAMER
# include "engine/gstengine.h"
# include "engine/gststartup.h"
#endif
#ifdef HAVE_VLC
# include "engine/vlcengine.h"
#endif
#include "engine/gstengine.h"
#include "engine/gststartup.h"
#include "collection/collectionbackend.h"
#include "playlist/playlist.h"
@@ -79,9 +73,7 @@ Player::Player(Application *app, QObject *parent)
: PlayerInterface(parent),
app_(app),
engine_(nullptr),
#ifdef HAVE_GSTREAMER
gst_startup_(new GstStartup(this)),
#endif
analyzer_(nullptr),
equalizer_(nullptr),
timer_save_volume_(new QTimer(this)),
@@ -124,7 +116,6 @@ EngineBase::Type Player::CreateEngine(EngineBase::Type enginetype) {
for (int i = 0; use_enginetype == EngineBase::Type::None; i++) {
switch (enginetype) {
case EngineBase::Type::None:
#ifdef HAVE_GSTREAMER
case EngineBase::Type::GStreamer:{
use_enginetype=EngineBase::Type::GStreamer;
ScopedPtr<GstEngine> gst_engine(new GstEngine(app_->task_manager()));
@@ -132,13 +123,6 @@ EngineBase::Type Player::CreateEngine(EngineBase::Type enginetype) {
engine_.reset(gst_engine.release());
break;
}
#endif
#ifdef HAVE_VLC
case EngineBase::Type::VLC:
use_enginetype = EngineBase::Type::VLC;
engine_ = make_shared<VLCEngine>(app_->task_manager());
break;
#endif
default:
if (i > 0) {
qFatal("No engine available!");

View File

@@ -44,9 +44,7 @@ class Application;
class Song;
class AnalyzerContainer;
class Equalizer;
#ifdef HAVE_GSTREAMER
class GstStartup;
#endif
class PlayerInterface : public QObject {
Q_OBJECT
@@ -228,9 +226,7 @@ class Player : public PlayerInterface {
private:
Application *app_;
SharedPtr<EngineBase> engine_;
#ifdef HAVE_GSTREAMER
GstStartup *gst_startup_;
#endif
AnalyzerContainer *analyzer_;
SharedPtr<Equalizer> equalizer_;
QTimer *timer_save_volume_;

View File

@@ -23,9 +23,7 @@
#include <algorithm>
#ifdef HAVE_GSTREAMER
# include <gst/gst.h>
#endif
#include <gst/gst.h>
#include <QObject>
#include <QIODevice>
@@ -58,7 +56,7 @@
#include "playlistparsers/parserbase.h"
#include "playlistparsers/playlistparser.h"
#if defined(HAVE_AUDIOCD) && defined(HAVE_GSTREAMER)
#ifdef HAVE_AUDIOCD
# include "device/cddasongloader.h"
#endif
@@ -78,10 +76,8 @@ SongLoader::SongLoader(SharedPtr<CollectionBackendInterface> collection_backend,
parser_(nullptr),
state_(State::WaitingForType),
timeout_(kDefaultTimeout),
#ifdef HAVE_GSTREAMER
fakesink_(nullptr),
buffer_probe_cb_id_(0),
#endif
success_(false) {
if (sRawUriSchemes.isEmpty()) {
@@ -104,9 +100,7 @@ SongLoader::SongLoader(SharedPtr<CollectionBackendInterface> collection_backend,
SongLoader::~SongLoader() {
#ifdef HAVE_GSTREAMER
CleanupPipeline();
#endif
}
@@ -128,13 +122,8 @@ SongLoader::Result SongLoader::Load(const QUrl &url) {
}
if (player_->engine()->type() == EngineBase::Type::GStreamer) {
#ifdef HAVE_GSTREAMER
preload_func_ = std::bind(&SongLoader::LoadRemote, this);
return Result::BlockingLoadRequired;
#else
errors_ << tr("You need GStreamer for this URL.");
return Result::Error;
#endif
}
else {
errors_ << tr("You need GStreamer for this URL.");
@@ -193,7 +182,7 @@ SongLoader::Result SongLoader::LoadLocalPartial(const QString &filename) {
SongLoader::Result SongLoader::LoadAudioCD() {
#if defined(HAVE_AUDIOCD) && defined(HAVE_GSTREAMER)
#ifdef HAVE_AUDIOCD
if (player_->engine()->type() == EngineBase::Type::GStreamer) {
CddaSongLoader *cdda_song_loader = new CddaSongLoader(QUrl(), this);
QObject::connect(cdda_song_loader, &CddaSongLoader::SongsDurationLoaded, this, &SongLoader::AudioCDTracksLoadFinishedSlot);
@@ -205,13 +194,13 @@ SongLoader::Result SongLoader::LoadAudioCD() {
#endif
errors_ << tr("CD playback is only available with the GStreamer engine.");
return Result::Error;
#if defined(HAVE_AUDIOCD) && defined(HAVE_GSTREAMER)
#ifdef HAVE_AUDIOCD
}
#endif
}
#if defined(HAVE_AUDIOCD) && defined(HAVE_GSTREAMER)
#ifdef HAVE_AUDIOCD
void SongLoader::AudioCDTracksLoadFinishedSlot(const SongList &songs, const QString &error) {
@@ -436,13 +425,12 @@ void SongLoader::Timeout() {
void SongLoader::StopTypefind() {
#ifdef HAVE_GSTREAMER
// Destroy the pipeline
if (pipeline_) {
gst_element_set_state(&*pipeline_, GST_STATE_NULL);
CleanupPipeline();
}
#endif
timeout_timer_->stop();
if (success_ && parser_) {
@@ -467,7 +455,6 @@ void SongLoader::StopTypefind() {
}
#ifdef HAVE_GSTREAMER
SongLoader::Result SongLoader::LoadRemote() {
qLog(Debug) << "Loading remote file" << url_;
@@ -542,9 +529,7 @@ SongLoader::Result SongLoader::LoadRemote() {
return Result::Success;
}
#endif
#ifdef HAVE_GSTREAMER
void SongLoader::TypeFound(GstElement *typefind, const uint probability, GstCaps *caps, void *self) {
Q_UNUSED(typefind)
@@ -567,9 +552,7 @@ void SongLoader::TypeFound(GstElement *typefind, const uint probability, GstCaps
instance->StopTypefindAsync(true);
}
#endif
#ifdef HAVE_GSTREAMER
GstPadProbeReturn SongLoader::DataReady(GstPad *pad, GstPadProbeInfo *info, gpointer self) {
Q_UNUSED(pad)
@@ -595,10 +578,9 @@ GstPadProbeReturn SongLoader::DataReady(GstPad *pad, GstPadProbeInfo *info, gpoi
}
return GST_PAD_PROBE_OK;
}
#endif
#ifdef HAVE_GSTREAMER
}
gboolean SongLoader::BusWatchCallback(GstBus *bus, GstMessage *msg, gpointer self) {
Q_UNUSED(bus)
@@ -615,10 +597,9 @@ gboolean SongLoader::BusWatchCallback(GstBus *bus, GstMessage *msg, gpointer sel
}
return TRUE;
}
#endif
#ifdef HAVE_GSTREAMER
}
GstBusSyncReply SongLoader::BusCallbackSync(GstBus *bus, GstMessage *msg, gpointer self) {
Q_UNUSED(bus)
@@ -637,11 +618,11 @@ GstBusSyncReply SongLoader::BusCallbackSync(GstBus *bus, GstMessage *msg, gpoint
default:
break;
}
return GST_BUS_PASS;
}
#endif
#ifdef HAVE_GSTREAMER
return GST_BUS_PASS;
}
void SongLoader::ErrorMessageReceived(GstMessage *msg) {
if (state_ == State::Finished) return;
@@ -667,9 +648,7 @@ void SongLoader::ErrorMessageReceived(GstMessage *msg) {
StopTypefindAsync(false);
}
#endif
#ifdef HAVE_GSTREAMER
void SongLoader::EndOfStreamReached() {
qLog(Debug) << Q_FUNC_INFO << static_cast<int>(state_);
@@ -696,9 +675,7 @@ void SongLoader::EndOfStreamReached() {
}
}
#endif
#ifdef HAVE_GSTREAMER
void SongLoader::MagicReady() {
qLog(Debug) << Q_FUNC_INFO;
@@ -730,9 +707,7 @@ void SongLoader::MagicReady() {
}
}
#endif
#ifdef HAVE_GSTREAMER
bool SongLoader::IsPipelinePlaying() {
GstState state = GST_STATE_NULL;
@@ -746,9 +721,7 @@ bool SongLoader::IsPipelinePlaying() {
return state == GST_STATE_PLAYING;
}
#endif
#ifdef HAVE_GSTREAMER
void SongLoader::StopTypefindAsync(const bool success) {
state_ = State::Finished;
@@ -757,7 +730,6 @@ void SongLoader::StopTypefindAsync(const bool success) {
QMetaObject::invokeMethod(this, &SongLoader::StopTypefind, Qt::QueuedConnection);
}
#endif
void SongLoader::ScheduleTimeoutAsync() {
@@ -776,8 +748,6 @@ void SongLoader::ScheduleTimeout() {
}
#ifdef HAVE_GSTREAMER
void SongLoader::CleanupPipeline() {
if (pipeline_) {
@@ -809,4 +779,3 @@ void SongLoader::CleanupPipeline() {
}
#endif

View File

@@ -27,10 +27,7 @@
#include <memory>
#include <functional>
#include <glib.h>
#ifdef HAVE_GSTREAMER
# include <gst/gst.h>
#endif
#include <gst/gst.h>
#include <QtGlobal>
#include <QObject>
@@ -51,7 +48,7 @@ class PlaylistParser;
class ParserBase;
class CueParser;
#if defined(HAVE_AUDIOCD) && defined(HAVE_GSTREAMER)
#ifdef HAVE_AUDIOCD
class CddaSongLoader;
#endif
@@ -95,10 +92,10 @@ class SongLoader : public QObject {
void ScheduleTimeout();
void Timeout();
void StopTypefind();
#if defined(HAVE_AUDIOCD) && defined(HAVE_GSTREAMER)
#ifdef HAVE_AUDIOCD
void AudioCDTracksLoadFinishedSlot(const SongList &songs, const QString &error);
void AudioCDTracksTagsLoaded(const SongList &songs);
#endif // HAVE_AUDIOCD && HAVE_GSTREAMER
#endif // HAVE_AUDIOCD
private:
enum class State {
@@ -117,7 +114,6 @@ class SongLoader : public QObject {
void AddAsRawStream();
#ifdef HAVE_GSTREAMER
Result LoadRemote();
// GStreamer callbacks
@@ -132,7 +128,6 @@ class SongLoader : public QObject {
bool IsPipelinePlaying();
void StopTypefindAsync(const bool success);
void CleanupPipeline();
#endif
void ScheduleTimeoutAsync();
@@ -156,11 +151,9 @@ class SongLoader : public QObject {
State state_;
int timeout_;
#ifdef HAVE_GSTREAMER
SharedPtr<GstElement> pipeline_;
GstElement *fakesink_;
gulong buffer_probe_cb_id_;
#endif
QThreadPool thread_pool_;
QStringList errors_;