mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2024-12-27 00:34:16 +01:00
Remove redundant code.
This commit is contained in:
parent
e1c33f093f
commit
1b32e61aba
2
README
2
README
@ -2,7 +2,7 @@ Strawberry Music Player
|
||||
=======================
|
||||
README
|
||||
|
||||
Strawberry is a audio player and music collection organiser. It was forked from Clementine in 2013 with a diffrent goal.
|
||||
Strawberry is a audio player and music collection organizer. It was forked from Clementine in 2013 with a diffrent goal.
|
||||
It's written in C++ and Qt 5 and runs on Linux. The name is inspired by the band Strawbs.
|
||||
|
||||
Features:
|
||||
|
@ -79,7 +79,7 @@ QString About::MakeHtml() const {
|
||||
|
||||
ret += tr("<p>");
|
||||
|
||||
ret += tr("Strawberry is a audio player and music collection organiser.<br />");
|
||||
ret += tr("Strawberry is a audio player and music collection organizer.<br />");
|
||||
ret += tr("It is a fork of Clementine. The name is inspired by the band Strawbs.");
|
||||
ret += tr("</p>");
|
||||
|
||||
|
@ -86,10 +86,6 @@ const char *GstEngine::kPulseSink = "pulsesink";
|
||||
const char *GstEngine::kA2DPSink = "a2dpsink";
|
||||
const char *GstEngine::kAVDTPSink = "avdtpsink";
|
||||
|
||||
const char *GstEngine::kEnterprisePipeline =
|
||||
"audiotestsrc wave=5 ! "
|
||||
"audiocheblimit mode=0 cutoff=120";
|
||||
|
||||
GstEngine::GstEngine(TaskManager *task_manager)
|
||||
: Engine::Base(),
|
||||
task_manager_(task_manager),
|
||||
@ -716,19 +712,20 @@ void GstEngine::HandlePipelineError(int pipeline_id, const QString &message, int
|
||||
// unable to play media stream with this url
|
||||
emit InvalidSongRequested(url_);
|
||||
|
||||
#if 0
|
||||
// TODO: the types of errors listed below won't be shown to user
|
||||
// they will get logged and the current song will be skipped; instead of maintaining the list we should probably:
|
||||
// - don't report any engine's errors to user (always just log and skip)
|
||||
// - come up with a less intrusive error box (not a dialog but a notification
|
||||
// popup of some kind) and then report all errors
|
||||
// - come up with a less intrusive error box (not a dialog but a notification popup of some kind) and then report all errors
|
||||
if (!(domain == GST_RESOURCE_ERROR &&
|
||||
error_code == GST_RESOURCE_ERROR_NOT_FOUND) &&
|
||||
!(domain == GST_STREAM_ERROR &&
|
||||
error_code == GST_STREAM_ERROR_TYPE_NOT_FOUND) &&
|
||||
!(domain == GST_RESOURCE_ERROR &&
|
||||
error_code == GST_RESOURCE_ERROR_OPEN_READ)) {
|
||||
#endif
|
||||
emit Error(message);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
void GstEngine::EndOfStreamReached(int pipeline_id, bool has_next_track) {
|
||||
@ -751,7 +748,7 @@ void GstEngine::NewMetaData(int pipeline_id, const Engine::SimpleMetaBundle &bun
|
||||
emit MetaData(bundle);
|
||||
}
|
||||
|
||||
GstElement *GstEngine::CreateElement(const QString &factoryName, GstElement *bin, bool showerror) {
|
||||
GstElement *GstEngine::CreateElement(const QString &factoryName, GstElement *bin, bool fatal, bool showerror) {
|
||||
|
||||
// Make a unique name
|
||||
QString name = factoryName + "-" + QString::number(next_element_id_++);
|
||||
@ -759,8 +756,9 @@ GstElement *GstEngine::CreateElement(const QString &factoryName, GstElement *bin
|
||||
GstElement *element = gst_element_factory_make(factoryName.toUtf8().constData(), name.toUtf8().constData());
|
||||
|
||||
if (!element) {
|
||||
if (showerror) emit Error(QString("GStreamer could not create the element: %1. Please make sure that you have installed all necessary GStreamer plugins").arg(factoryName));
|
||||
gst_object_unref(GST_OBJECT(bin));
|
||||
if (showerror)
|
||||
emit Error(QString("GStreamer could not create the element: %1. Please make sure that you have installed all necessary GStreamer plugins").arg(factoryName));
|
||||
if (fatal) gst_object_unref(GST_OBJECT(bin));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -824,11 +822,6 @@ shared_ptr<GstEnginePipeline> GstEngine::CreatePipeline(const QUrl &url, qint64
|
||||
|
||||
shared_ptr<GstEnginePipeline> ret = CreatePipeline();
|
||||
|
||||
if (url.scheme() == "enterprise") {
|
||||
ret->InitFromString(kEnterprisePipeline);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!ret->InitFromUrl(url.toEncoded(), end_nanosec)) ret.reset();
|
||||
|
||||
return ret;
|
||||
@ -888,29 +881,19 @@ EngineBase::OutputDetailsList GstEngine::GetOutputsList() const {
|
||||
EngineBase::OutputDetailsList ret;
|
||||
|
||||
PluginDetailsList plugins = GetPluginList("Sink/Audio");
|
||||
//if (plugins.count() > 0) {
|
||||
for (const PluginDetails &plugin : plugins) {
|
||||
OutputDetails output;
|
||||
output.name = plugin.name;
|
||||
output.description = plugin.description;
|
||||
if (plugin.name == kAutoSink) output.iconname = "soundcard";
|
||||
else if ((plugin.name == kALSASink) || (plugin.name == kOSS4Sink) || (plugin.name == kOSS4Sink)) output.iconname = "alsa";
|
||||
else if (plugin.name== kJackAudioSink) output.iconname = "jack";
|
||||
else if (plugin.name == kPulseSink) output.iconname = "pulseaudio";
|
||||
else if ((plugin.name == kA2DPSink) || (plugin.name == kAVDTPSink)) output.iconname = "bluetooth";
|
||||
else output.iconname = "soundcard";
|
||||
ret.append(output);
|
||||
}
|
||||
#if 0
|
||||
}
|
||||
else {
|
||||
|
||||
for (const PluginDetails &plugin : plugins) {
|
||||
OutputDetails output;
|
||||
output.name = kAutoSink;
|
||||
output.description = "Auto";
|
||||
output.iconname = "soundcard";
|
||||
output.name = plugin.name;
|
||||
output.description = plugin.description;
|
||||
if (plugin.name == kAutoSink) output.iconname = "soundcard";
|
||||
else if ((plugin.name == kALSASink) || (plugin.name == kOSS4Sink) || (plugin.name == kOSS4Sink)) output.iconname = "alsa";
|
||||
else if (plugin.name== kJackAudioSink) output.iconname = "jack";
|
||||
else if (plugin.name == kPulseSink) output.iconname = "pulseaudio";
|
||||
else if ((plugin.name == kA2DPSink) || (plugin.name == kAVDTPSink)) output.iconname = "bluetooth";
|
||||
else output.iconname = "soundcard";
|
||||
ret.append(output);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -85,7 +85,7 @@ class GstEngine : public Engine::Base, public BufferConsumer {
|
||||
|
||||
static bool ALSADeviceSupport(const QString &name);
|
||||
|
||||
GstElement *CreateElement(const QString &factoryName, GstElement *bin = 0, bool showerror = true);
|
||||
GstElement *CreateElement(const QString &factoryName, GstElement *bin = 0, bool fatal = true, bool showerror = true);
|
||||
|
||||
// BufferConsumer
|
||||
void ConsumeBuffer(GstBuffer *buffer, int pipeline_id);
|
||||
@ -159,8 +159,6 @@ class GstEngine : public Engine::Base, public BufferConsumer {
|
||||
static const qint64 kPreloadGapNanosec = 3000 *kNsecPerMsec; // 3s
|
||||
static const qint64 kSeekDelayNanosec = 100 *kNsecPerMsec; // 100msec
|
||||
|
||||
static const char *kEnterprisePipeline;
|
||||
|
||||
TaskManager *task_manager_;
|
||||
int buffering_task_id_;
|
||||
|
||||
|
@ -91,11 +91,11 @@ GstEnginePipeline::GstEnginePipeline(GstEngine *engine)
|
||||
rglimiter_(nullptr),
|
||||
audioconvert2_(nullptr),
|
||||
equalizer_(nullptr),
|
||||
stereo_panorama_(nullptr),
|
||||
audio_panorama_(nullptr),
|
||||
volume_(nullptr),
|
||||
audioscale_(nullptr),
|
||||
audiosink_(nullptr) {
|
||||
|
||||
|
||||
if (!sElementDeleter) {
|
||||
sElementDeleter = new GstElementDeleter;
|
||||
}
|
||||
@ -228,9 +228,9 @@ bool GstEnginePipeline::InitAudioBin() {
|
||||
probe_sink = engine_->CreateElement("fakesink", audiobin_);
|
||||
|
||||
audio_queue = engine_->CreateElement("queue", audiobin_);
|
||||
equalizer_preamp_ = engine_->CreateElement("volume", audiobin_);
|
||||
equalizer_ = engine_->CreateElement("equalizer-nbands", audiobin_);
|
||||
stereo_panorama_ = engine_->CreateElement("audiopanorama", audiobin_, false);
|
||||
equalizer_preamp_ = engine_->CreateElement("volume", audiobin_, false, true);
|
||||
equalizer_ = engine_->CreateElement("equalizer-nbands", audiobin_, false, true);
|
||||
audio_panorama_ = engine_->CreateElement("audiopanorama", audiobin_, false, false);
|
||||
volume_ = engine_->CreateElement("volume", audiobin_);
|
||||
audioscale_ = engine_->CreateElement("audioresample", audiobin_);
|
||||
convert = engine_->CreateElement("audioconvert", audiobin_);
|
||||
@ -307,7 +307,7 @@ bool GstEnginePipeline::InitAudioBin() {
|
||||
}
|
||||
|
||||
// Set the stereo balance.
|
||||
if (stereo_panorama_) g_object_set(G_OBJECT(stereo_panorama_), "panorama", stereo_balance_, nullptr);
|
||||
if (audio_panorama_) g_object_set(G_OBJECT(audio_panorama_), "panorama", stereo_balance_, nullptr);
|
||||
|
||||
// Set the buffer duration. We set this on this queue instead of the decode bin (in ReplaceDecodeBin()) because setting it on the decode bin only affects network sources.
|
||||
// Disable the default buffer and byte limits, so we only buffer based on time.
|
||||
@ -341,7 +341,7 @@ bool GstEnginePipeline::InitAudioBin() {
|
||||
// Don't force 16 bit.
|
||||
gst_element_link(probe_queue, probe_converter);
|
||||
|
||||
if (engine_->IsEqualizerEnabled() && equalizer_ && equalizer_preamp_ && stereo_panorama_) gst_element_link_many(audio_queue, equalizer_preamp_, equalizer_, stereo_panorama_, volume_, audioscale_, convert, nullptr);
|
||||
if (engine_->IsEqualizerEnabled() && equalizer_ && equalizer_preamp_ && audio_panorama_) gst_element_link_many(audio_queue, equalizer_preamp_, equalizer_, audio_panorama_, volume_, audioscale_, convert, nullptr);
|
||||
else gst_element_link_many(audio_queue, volume_, audioscale_, convert, nullptr);
|
||||
|
||||
// Let the audio output of the tee autonegotiate the bit depth and format.
|
||||
@ -957,8 +957,8 @@ void GstEnginePipeline::UpdateEqualizer() {
|
||||
}
|
||||
|
||||
void GstEnginePipeline::UpdateStereoBalance() {
|
||||
if (stereo_panorama_) {
|
||||
g_object_set(G_OBJECT(stereo_panorama_), "panorama", stereo_balance_, nullptr);
|
||||
if (audio_panorama_) {
|
||||
g_object_set(G_OBJECT(audio_panorama_), "panorama", stereo_balance_, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ signals:
|
||||
GstElement *audioconvert2_;
|
||||
GstElement *equalizer_preamp_;
|
||||
GstElement *equalizer_;
|
||||
GstElement *stereo_panorama_;
|
||||
GstElement *audio_panorama_;
|
||||
GstElement *volume_;
|
||||
GstElement *audioscale_;
|
||||
GstElement *audiosink_;
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "core/logging.h"
|
||||
#include "engine/pulsedevicefinder.h"
|
||||
|
||||
PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder("pulsesink"), mainloop_(nullptr), context_(nullptr) {
|
||||
PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder("pulseaudio"), mainloop_(nullptr), context_(nullptr) {
|
||||
}
|
||||
|
||||
bool PulseDeviceFinder::Initialise() {
|
||||
|
Loading…
Reference in New Issue
Block a user