Improvments to gstreamer backend and settings +++
- Fixed bug not setting environment for gstreamer before initialization - Fixed windows directsound device - Fixed crash on failure to create gstreamer element - Fixed crash when switching backend - Don't stop playback if equalizer or replay gain fails in gstreamer - Improvments to backend settings - Fixed backend settings to work for windows - Fixed replay gain settings not working - Fixed right click menu for album showing in statusview even when no song was playing - Removed redundant code
This commit is contained in:
parent
6bbc1271e4
commit
43bf7e3ca8
1
TODO
1
TODO
@ -3,4 +3,3 @@ Strawberry Music Player
|
||||
TODO
|
||||
|
||||
- Finalize / Improve status/context
|
||||
- Fix crash when switching backend while playing
|
||||
|
@ -28,11 +28,6 @@
|
||||
#include <glib-object.h>
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
#include <gst/gst.h>
|
||||
#include <gst/pbutils/pbutils.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
#include <unistd.h>
|
||||
#endif // Q_OS_UNIX
|
||||
@ -89,10 +84,6 @@
|
||||
#include "core/iconloader.h"
|
||||
#include "core/systemtrayicon.h"
|
||||
#include "core/scangiomodulepath.h"
|
||||
#include "engine/enginebase.h"
|
||||
#ifdef HAVE_GSTREAMER
|
||||
#include "engine/gstengine.h"
|
||||
#endif
|
||||
|
||||
#include "widgets/osd.h"
|
||||
|
||||
@ -116,12 +107,6 @@ int main(int argc, char* argv[]) {
|
||||
// Do Mac specific startup to get media keys working.
|
||||
// This must go before QApplication initialisation.
|
||||
mac::MacMain();
|
||||
|
||||
if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) {
|
||||
// Work around 10.9 issue.
|
||||
// https://bugreports.qt-project.org/browse/QTBUG-32789
|
||||
QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN)
|
||||
@ -241,11 +226,6 @@ int main(int argc, char* argv[]) {
|
||||
#ifdef HAVE_DBUS
|
||||
mpris::Mpris mpris(&app);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
gst_init(nullptr, nullptr);
|
||||
gst_pb_utils_init();
|
||||
#endif
|
||||
|
||||
// Window
|
||||
MainWindow w(&app, tray_icon.get(), &osd, options);
|
||||
|
@ -60,7 +60,6 @@ void RegisterMetaTypes() {
|
||||
qRegisterMetaType<Engine::State>("Engine::State");
|
||||
qRegisterMetaType<Engine::TrackChangeFlags>("Engine::TrackChangeFlags");
|
||||
qRegisterMetaType<Equalizer::Params>("Equalizer::Params");
|
||||
qRegisterMetaType<EngineBase::PluginDetails>("EngineBase::PluginDetails");
|
||||
qRegisterMetaType<EngineBase::OutputDetails>("EngineBase::OutputDetails");
|
||||
#ifdef HAVE_GSTREAMER
|
||||
qRegisterMetaType<GstBuffer*>("GstBuffer*");
|
||||
|
@ -77,7 +77,7 @@ bool AmazonCoverProvider::StartSearch(const QString &artist, const QString &albu
|
||||
|
||||
// Sign the request
|
||||
|
||||
const QByteArray data_to_sign = QString("GET\n%1\n%2\n%3").arg(url.host(), url.path(), query_items.join("&")).toLatin1();
|
||||
const QByteArray data_to_sign = QString("GET\n%1\n%2\n%3").arg(url.host(), url.path(), query_items.join("&")).toUtf8();
|
||||
//const QByteArray signature(Utilities::HmacSha256(kSecretAccessKey, data_to_sign));
|
||||
const QByteArray signature(Utilities::HmacSha256(QByteArray::fromBase64(kSecretAccessKeyB64), data_to_sign));
|
||||
|
||||
|
@ -118,7 +118,7 @@ void DiscogsCoverProvider::SendSearchRequest(DiscogsCoverSearchContext *s_ctx) {
|
||||
}
|
||||
|
||||
// Sign the request
|
||||
const QByteArray data_to_sign = QString("GET\n%1\n%2\n%3").arg(url.host(), url.path(), query_items.join("&")).toLatin1();
|
||||
const QByteArray data_to_sign = QString("GET\n%1\n%2\n%3").arg(url.host(), url.path(), query_items.join("&")).toUtf8();
|
||||
const QByteArray signature(Utilities::HmacSha256(QByteArray::fromBase64(kSecretKeyB64), data_to_sign));
|
||||
|
||||
// Add the signature to the request
|
||||
|
@ -97,12 +97,9 @@ QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
||||
snd_pcm_info_get_name(pcminfo);
|
||||
|
||||
Device device;
|
||||
device.card = card;
|
||||
device.device = dev;
|
||||
device.description = QString("%1 %2").arg(snd_ctl_card_info_get_name(cardinfo)).arg(snd_pcm_info_get_name(pcminfo));
|
||||
device.string = QString("hw:%1,%2").arg(card).arg(dev);
|
||||
device.device_property_value = QString("hw:%1,%2").arg(card).arg(dev);
|
||||
device.iconname = GuessIconName("", device.description);
|
||||
device.value = QString("hw:%1,%2").arg(card).arg(dev);
|
||||
device.iconname = GuessIconName(device.description);
|
||||
ret.append(device);
|
||||
|
||||
}
|
||||
|
@ -23,13 +23,10 @@
|
||||
|
||||
#include "core/logging.h"
|
||||
|
||||
DeviceFinder::DeviceFinder(const QString &output): output_(output) {
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__ << output;
|
||||
DeviceFinder::DeviceFinder(const QString &name): name_(name) {
|
||||
}
|
||||
|
||||
QString DeviceFinder::GuessIconName(const QString &name, const QString &description) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__ << name << description;
|
||||
QString DeviceFinder::GuessIconName(const QString &description) {
|
||||
|
||||
QString description_lower = description.toLower();
|
||||
|
||||
|
@ -31,18 +31,15 @@ class DeviceFinder {
|
||||
|
||||
public:
|
||||
struct Device {
|
||||
int card;
|
||||
int device;
|
||||
QVariant device_property_value;
|
||||
QString string;
|
||||
QString description;
|
||||
QVariant value;
|
||||
QString iconname;
|
||||
};
|
||||
|
||||
virtual ~DeviceFinder() {}
|
||||
|
||||
// The name of the gstreamer sink element that devices found by this class can be used with.
|
||||
QString output() const { return output_; }
|
||||
QString name() const { return name_; }
|
||||
|
||||
// Does any necessary setup, returning false if this DeviceFinder cannot be used.
|
||||
virtual bool Initialise() = 0;
|
||||
@ -51,12 +48,12 @@ class DeviceFinder {
|
||||
virtual QList<Device> ListDevices() = 0;
|
||||
|
||||
protected:
|
||||
explicit DeviceFinder(const QString &output);
|
||||
explicit DeviceFinder(const QString &name);
|
||||
|
||||
static QString GuessIconName(const QString &, const QString &);
|
||||
static QString GuessIconName(const QString &description);
|
||||
|
||||
private:
|
||||
QString output_;
|
||||
QString name_;
|
||||
|
||||
};
|
||||
|
||||
|
@ -44,15 +44,13 @@ BOOL DirectSoundDeviceFinder::EnumerateCallback(LPGUID guid, LPCSTR description,
|
||||
|
||||
State *state = reinterpret_cast<State*>(state_voidptr);
|
||||
|
||||
if (guid) {
|
||||
Device dev;
|
||||
dev.description = QString::fromUtf8(description);
|
||||
dev.device_property_value = QUuid(*guid).toByteArray();
|
||||
dev.iconname = GuessIconName(dev.string, dev.description);
|
||||
state->devices.append(dev);
|
||||
}
|
||||
Device dev;
|
||||
dev.description = QString::fromUtf8(description);
|
||||
if (guid) dev.value = QUuid(*guid).toByteArray();
|
||||
else dev.value = QVariant();
|
||||
dev.iconname = GuessIconName(dev.description);
|
||||
state->devices.append(dev);
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
@ -90,19 +90,11 @@ class Base : public QObject {
|
||||
bool crossfade_same_album() const { return crossfade_same_album_; }
|
||||
|
||||
static const int kScopeSize = 1024;
|
||||
|
||||
struct PluginDetails {
|
||||
QString name;
|
||||
QString description;
|
||||
QString iconname;
|
||||
};
|
||||
typedef QList<PluginDetails> PluginDetailsList;
|
||||
|
||||
struct OutputDetails {
|
||||
QString name;
|
||||
QString description;
|
||||
QString iconname;
|
||||
QVariant device_property_value;
|
||||
};
|
||||
typedef QList<OutputDetails> OutputDetailsList;
|
||||
|
||||
@ -159,6 +151,13 @@ signals:
|
||||
int next_background_stream_id_;
|
||||
bool fadeout_pause_enabled_;
|
||||
qint64 fadeout_pause_duration_nanosec_;
|
||||
|
||||
struct PluginDetails {
|
||||
QString name;
|
||||
QString description;
|
||||
QString iconname;
|
||||
};
|
||||
typedef QList<PluginDetails> PluginDetailsList;
|
||||
|
||||
private:
|
||||
bool about_to_end_emitted_;
|
||||
|
@ -81,7 +81,7 @@ void EngineDevice::Init() {
|
||||
|
||||
for (DeviceFinder *finder : device_finders) {
|
||||
if (!finder->Initialise()) {
|
||||
qLog(Warning) << "Failed to initialise DeviceFinder for" << finder->output();
|
||||
qLog(Warning) << "Failed to initialise DeviceFinder for" << finder->name();
|
||||
delete finder;
|
||||
continue;
|
||||
}
|
||||
|
@ -41,9 +41,6 @@ class EngineDevice : public QObject {
|
||||
void Init();
|
||||
|
||||
QList<DeviceFinder*> device_finders_;
|
||||
|
||||
protected:
|
||||
//static QString GuessIconName(const QString &, const QString &);
|
||||
|
||||
private:
|
||||
QString output_;
|
||||
|
@ -149,10 +149,8 @@ bool GstEngine::Init() {
|
||||
|
||||
void GstEngine::InitialiseGStreamer() {
|
||||
|
||||
#if 0
|
||||
gst_init(nullptr, nullptr);
|
||||
gst_pb_utils_init();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -435,7 +433,7 @@ bool GstEngine::Load(const QUrl &url, Engine::TrackChangeFlags change, bool forc
|
||||
|
||||
SetVolume(volume_);
|
||||
SetEqualizerEnabled(equalizer_enabled_);
|
||||
SetEqualizerParameters(equalizer_preamp_, equalizer_gains_);
|
||||
if (equalizer_preamp_) SetEqualizerParameters(equalizer_preamp_, equalizer_gains_);
|
||||
SetStereoBalance(stereo_balance_);
|
||||
|
||||
// Maybe fade in this track
|
||||
@ -757,7 +755,7 @@ GstElement *GstEngine::CreateElement(const QString &factoryName, GstElement *bin
|
||||
// Make a unique name
|
||||
QString name = factoryName + "-" + QString::number(next_element_id_++);
|
||||
|
||||
GstElement *element = gst_element_factory_make(factoryName.toLatin1().constData(), name.toLatin1().constData());
|
||||
GstElement *element = gst_element_factory_make(factoryName.toUtf8().constData(), name.toUtf8().constData());
|
||||
|
||||
if (!element) {
|
||||
emit Error(QString("GStreamer could not create the element: %1. Please make sure that you have installed all necessary GStreamer plugins").arg(factoryName));
|
||||
@ -889,18 +887,29 @@ EngineBase::OutputDetailsList GstEngine::GetOutputsList() const {
|
||||
EngineBase::OutputDetailsList ret;
|
||||
|
||||
PluginDetailsList plugins = GetPluginList("Sink/Audio");
|
||||
for (const PluginDetails &plugin : plugins) {
|
||||
//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 {
|
||||
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";
|
||||
output.name = kAutoSink;
|
||||
output.description = "Auto";
|
||||
output.iconname = "soundcard";
|
||||
ret.append(output);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -189,29 +189,20 @@ bool GstEnginePipeline::InitAudioBin() {
|
||||
|
||||
// Audio bin
|
||||
audiobin_ = gst_bin_new("audiobin");
|
||||
//audiobin_ = gst_bin_new("playbackbin");
|
||||
//gst_bin_add(GST_BIN(pipeline_), audiobin_);
|
||||
|
||||
// Create the sink
|
||||
if (!(audiosink_ = engine_->CreateElement(sink_, audiobin_))) return false;
|
||||
|
||||
//if (GstEngine::SinkDeviceSupport(sink_) && !device_.isEmpty())
|
||||
//g_object_set(G_OBJECT(audiosink_), "device", device_.toUtf8().constData(), NULL);
|
||||
|
||||
|
||||
if (g_object_class_find_property(G_OBJECT_GET_CLASS(audiosink_), "device") && !device_.toString().isEmpty()) {
|
||||
audiosink_ = engine_->CreateElement(sink_, audiobin_);
|
||||
if (!audiosink_) return false;
|
||||
|
||||
if (g_object_class_find_property(G_OBJECT_GET_CLASS(audiosink_), "device") && device_.isValid()) {
|
||||
switch (device_.type()) {
|
||||
case QVariant::Int:
|
||||
g_object_set(G_OBJECT(audiosink_), "device", device_.toInt(), nullptr);
|
||||
break;
|
||||
case QVariant::String:
|
||||
//qLog(Info) << "g_object_set: " << device_.toString().toUtf8().constData();
|
||||
//g_object_set(G_OBJECT(audiosink_), "device", device_.toString().toUtf8().constData(), nullptr);
|
||||
g_object_set(audiosink_, "device", device_.toString().toUtf8().constData(), nullptr);
|
||||
//g_object_set(G_OBJECT(audiosink_), "device", "hw:0,0", nullptr);
|
||||
if (device_.toString().isEmpty()) break;
|
||||
g_object_set(G_OBJECT(audiosink_), "device", device_.toString().toUtf8().constData(), nullptr);
|
||||
break;
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
case QVariant::ByteArray: {
|
||||
GUID guid = QUuid(device_.toByteArray());
|
||||
@ -219,7 +210,6 @@ bool GstEnginePipeline::InitAudioBin() {
|
||||
break;
|
||||
}
|
||||
#endif // Q_OS_WIN32
|
||||
|
||||
default:
|
||||
qLog(Warning) << "Unknown device type" << device_;
|
||||
break;
|
||||
@ -245,7 +235,7 @@ bool GstEnginePipeline::InitAudioBin() {
|
||||
audioscale_ = engine_->CreateElement("audioresample", audiobin_);
|
||||
convert = engine_->CreateElement("audioconvert", audiobin_);
|
||||
|
||||
if (!queue_ || !audioconvert_ || !tee || !probe_queue || !probe_converter || !probe_sink || !audio_queue || !equalizer_preamp_ || !equalizer_ || !stereo_panorama_ || !volume_ || !audioscale_ || !convert) {
|
||||
if (!queue_ || !audioconvert_ || !tee || !probe_queue || !probe_converter || !probe_sink || !audio_queue || !volume_ || !audioscale_ || !convert) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -258,17 +248,14 @@ bool GstEnginePipeline::InitAudioBin() {
|
||||
rgvolume_ = engine_->CreateElement("rgvolume", audiobin_);
|
||||
rglimiter_ = engine_->CreateElement("rglimiter", audiobin_);
|
||||
audioconvert2_ = engine_->CreateElement("audioconvert", audiobin_);
|
||||
event_probe = audioconvert2_;
|
||||
convert_sink = rgvolume_;
|
||||
|
||||
if (!rgvolume_ || !rglimiter_ || !audioconvert2_) {
|
||||
return false;
|
||||
if (rgvolume_ && rglimiter_ && audioconvert2_) {
|
||||
event_probe = audioconvert2_;
|
||||
convert_sink = rgvolume_;
|
||||
// Set replaygain settings
|
||||
g_object_set(G_OBJECT(rgvolume_), "album-mode", rg_mode_, nullptr);
|
||||
g_object_set(G_OBJECT(rgvolume_), "pre-amp", double(rg_preamp_), nullptr);
|
||||
g_object_set(G_OBJECT(rglimiter_), "enabled", int(rg_compression_), nullptr);
|
||||
}
|
||||
|
||||
// Set replaygain settings
|
||||
g_object_set(G_OBJECT(rgvolume_), "album-mode", rg_mode_, nullptr);
|
||||
g_object_set(G_OBJECT(rgvolume_), "pre-amp", double(rg_preamp_), nullptr);
|
||||
g_object_set(G_OBJECT(rglimiter_), "enabled", int(rg_compression_), nullptr);
|
||||
}
|
||||
|
||||
// Create a pad on the outside of the audiobin and connect it to the pad of the first element.
|
||||
@ -292,33 +279,35 @@ bool GstEnginePipeline::InitAudioBin() {
|
||||
// As a workaround, we create two dummy bands at both ends of the spectrum.
|
||||
// This causes the actual first and last adjustable bands to be implemented using band-pass filters.
|
||||
|
||||
g_object_set(G_OBJECT(equalizer_), "num-bands", 10 + 2, nullptr);
|
||||
if (equalizer_) {
|
||||
g_object_set(G_OBJECT(equalizer_), "num-bands", 10 + 2, nullptr);
|
||||
|
||||
// Dummy first band (bandwidth 0, cutting below 20Hz):
|
||||
GstObject *first_band = GST_OBJECT(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), 0));
|
||||
g_object_set(G_OBJECT(first_band), "freq", 20.0, "bandwidth", 0, "gain", 0.0f, nullptr);
|
||||
g_object_unref(G_OBJECT(first_band));
|
||||
// Dummy first band (bandwidth 0, cutting below 20Hz):
|
||||
GstObject *first_band = GST_OBJECT(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), 0));
|
||||
g_object_set(G_OBJECT(first_band), "freq", 20.0, "bandwidth", 0, "gain", 0.0f, nullptr);
|
||||
g_object_unref(G_OBJECT(first_band));
|
||||
|
||||
// Dummy last band (bandwidth 0, cutting over 20KHz):
|
||||
GstObject *last_band = GST_OBJECT(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), kEqBandCount + 1));
|
||||
g_object_set(G_OBJECT(last_band), "freq", 20000.0, "bandwidth", 0, "gain", 0.0f, nullptr);
|
||||
g_object_unref(G_OBJECT(last_band));
|
||||
// Dummy last band (bandwidth 0, cutting over 20KHz):
|
||||
GstObject *last_band = GST_OBJECT(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), kEqBandCount + 1));
|
||||
g_object_set(G_OBJECT(last_band), "freq", 20000.0, "bandwidth", 0, "gain", 0.0f, nullptr);
|
||||
g_object_unref(G_OBJECT(last_band));
|
||||
|
||||
int last_band_frequency = 0;
|
||||
for (int i = 0; i < kEqBandCount; ++i) {
|
||||
const int index_in_eq = i + 1;
|
||||
GstObject *band = GST_OBJECT(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), index_in_eq));
|
||||
int last_band_frequency = 0;
|
||||
for (int i = 0; i < kEqBandCount; ++i) {
|
||||
const int index_in_eq = i + 1;
|
||||
GstObject *band = GST_OBJECT(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), index_in_eq));
|
||||
|
||||
const float frequency = kEqBandFrequencies[i];
|
||||
const float bandwidth = frequency - last_band_frequency;
|
||||
last_band_frequency = frequency;
|
||||
const float frequency = kEqBandFrequencies[i];
|
||||
const float bandwidth = frequency - last_band_frequency;
|
||||
last_band_frequency = frequency;
|
||||
|
||||
g_object_set(G_OBJECT(band), "freq", frequency, "bandwidth", bandwidth, "gain", 0.0f, nullptr);
|
||||
g_object_unref(G_OBJECT(band));
|
||||
g_object_set(G_OBJECT(band), "freq", frequency, "bandwidth", bandwidth, "gain", 0.0f, nullptr);
|
||||
g_object_unref(G_OBJECT(band));
|
||||
}
|
||||
}
|
||||
|
||||
// Set the stereo balance.
|
||||
g_object_set(G_OBJECT(stereo_panorama_), "panorama", stereo_balance_, nullptr);
|
||||
if (stereo_panorama_) g_object_set(G_OBJECT(stereo_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.
|
||||
@ -340,7 +329,7 @@ bool GstEnginePipeline::InitAudioBin() {
|
||||
gst_pad_link(gst_element_get_request_pad(tee, "src_%u"), gst_element_get_static_pad(audio_queue, "sink"));
|
||||
|
||||
// Link replaygain elements if enabled.
|
||||
if (rg_enabled_) {
|
||||
if (rg_enabled_ && rgvolume_ && rglimiter_ && audioconvert2_) {
|
||||
gst_element_link_many(rgvolume_, rglimiter_, audioconvert2_, tee, nullptr);
|
||||
}
|
||||
|
||||
@ -352,7 +341,7 @@ bool GstEnginePipeline::InitAudioBin() {
|
||||
// Don't force 16 bit.
|
||||
gst_element_link(probe_queue, probe_converter);
|
||||
|
||||
if (engine_->IsEqualizerEnabled()) gst_element_link_many(audio_queue, equalizer_preamp_, equalizer_, stereo_panorama_, volume_, audioscale_, convert, nullptr);
|
||||
if (engine_->IsEqualizerEnabled() && equalizer_ && equalizer_preamp_ && stereo_panorama_) gst_element_link_many(audio_queue, equalizer_preamp_, equalizer_, stereo_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.
|
||||
@ -383,6 +372,8 @@ bool GstEnginePipeline::InitFromUrl(const QByteArray &url, qint64 end_nanosec) {
|
||||
end_offset_nanosec_ = end_nanosec;
|
||||
|
||||
pipeline_ = engine_->CreateElement("playbin");
|
||||
if (pipeline_ == nullptr) return false;
|
||||
|
||||
g_object_set(G_OBJECT(pipeline_), "uri", url.constData(), nullptr);
|
||||
CHECKED_GCONNECT(G_OBJECT(pipeline_), "about-to-finish", &AboutToFinishCallback, this);
|
||||
|
||||
@ -939,6 +930,8 @@ void GstEnginePipeline::SetStereoBalance(float value) {
|
||||
}
|
||||
|
||||
void GstEnginePipeline::UpdateEqualizer() {
|
||||
|
||||
if (!equalizer_ || !equalizer_preamp_) return;
|
||||
|
||||
// Update band gains
|
||||
for (int i = 0; i < kEqBandCount; ++i) {
|
||||
@ -957,8 +950,7 @@ void GstEnginePipeline::UpdateEqualizer() {
|
||||
|
||||
// Update preamp
|
||||
float preamp = 1.0;
|
||||
if (eq_enabled_)
|
||||
preamp = float(eq_preamp_ + 100) * 0.01; // To scale from 0.0 to 2.0
|
||||
if (eq_enabled_) preamp = float(eq_preamp_ + 100) * 0.01; // To scale from 0.0 to 2.0
|
||||
|
||||
g_object_set(G_OBJECT(equalizer_preamp_), "volume", preamp, nullptr);
|
||||
|
||||
|
@ -101,8 +101,8 @@ QList<DeviceFinder::Device> OsxDeviceFinder::ListDevices() {
|
||||
|
||||
Device dev;
|
||||
dev.description = QString::fromUtf8(CFStringGetCStringPtr(*device_name, CFStringGetSystemEncoding()));
|
||||
dev.device_property_value = id;
|
||||
dev.icon_name = GuessIconName(dev.description);
|
||||
dev.value = id;
|
||||
dev.iconname = GuessIconName(dev.description);
|
||||
ret.append(dev);
|
||||
}
|
||||
return ret;
|
||||
|
@ -116,9 +116,9 @@ void PulseDeviceFinder::GetSinkInfoCallback(pa_context *c, const pa_sink_info *i
|
||||
|
||||
if (info) {
|
||||
Device dev;
|
||||
dev.device_property_value = QString::fromUtf8(info->name);
|
||||
dev.description = QString::fromUtf8(info->description);
|
||||
dev.iconname = QString::fromUtf8(pa_proplist_gets(info->proplist, "device.icon_name"));
|
||||
dev.value = QString::fromUtf8(info->name);
|
||||
dev.iconname = QString::fromUtf8(pa_proplist_gets(info->proplist, "device.iconname"));
|
||||
|
||||
state->devices.append(dev);
|
||||
}
|
||||
|
@ -25,8 +25,6 @@
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QErrorMessage>
|
||||
|
||||
#include "settingsdialog.h"
|
||||
#include "core/application.h"
|
||||
@ -44,6 +42,8 @@
|
||||
#endif
|
||||
#include "engine/devicefinder.h"
|
||||
|
||||
#include "dialogs/errordialog.h"
|
||||
|
||||
const char *BackendSettingsPage::kSettingsGroup = "Backend";
|
||||
const char *BackendSettingsPage::EngineText_Xine = "Xine";
|
||||
const char *BackendSettingsPage::EngineText_GStreamer = "GStreamer";
|
||||
@ -52,8 +52,6 @@ const char *BackendSettingsPage::EngineText_VLC = "VLC";
|
||||
|
||||
BackendSettingsPage::BackendSettingsPage(SettingsDialog *dialog) : SettingsPage(dialog), ui_(new Ui_BackendSettingsPage) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("soundcard"));
|
||||
|
||||
@ -67,30 +65,22 @@ BackendSettingsPage::BackendSettingsPage(SettingsDialog *dialog) : SettingsPage(
|
||||
|
||||
connect(ui_->stickslider_replaygainpreamp, SIGNAL(valueChanged(int)), SLOT(RgPreampChanged(int)));
|
||||
ui_->label_replaygainpreamp->setMinimumWidth(QFontMetrics(ui_->label_replaygainpreamp->font()).width("-WW.W dB"));
|
||||
|
||||
RgPreampChanged(ui_->stickslider_replaygainpreamp->value());
|
||||
|
||||
|
||||
s_.beginGroup(BackendSettingsPage::kSettingsGroup);
|
||||
|
||||
}
|
||||
|
||||
BackendSettingsPage::~BackendSettingsPage() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
//dialog()->app()->player()->CreateEngine(engineloaded_);
|
||||
//dialog()->app()->player()->ReloadSettings();
|
||||
//dialog()->app()->player()->Init();
|
||||
|
||||
s_.endGroup();
|
||||
|
||||
s_.endGroup();
|
||||
delete ui_;
|
||||
|
||||
}
|
||||
|
||||
void BackendSettingsPage::Load() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
configloaded_ = false;
|
||||
engineloaded_ = Engine::None;
|
||||
|
||||
@ -111,10 +101,11 @@ void BackendSettingsPage::Load() {
|
||||
#endif
|
||||
|
||||
configloaded_ = true;
|
||||
enginereset_ = false;
|
||||
|
||||
ui_->combobox_engine->setCurrentIndex(ui_->combobox_engine->findData(enginetype));
|
||||
if (enginetype != engineloaded_) Load_Engine(enginetype);
|
||||
|
||||
|
||||
ui_->spinbox_bufferduration->setValue(s_.value("bufferduration", 4000).toInt());
|
||||
ui_->checkbox_monoplayback->setChecked(s_.value("monoplayback", false).toBool());
|
||||
ui_->slider_bufferminfill->setValue(s_.value("bufferminfill", 33).toInt());
|
||||
@ -124,14 +115,18 @@ void BackendSettingsPage::Load() {
|
||||
ui_->stickslider_replaygainpreamp->setValue(s_.value("rgpreamp", 0.0).toDouble() * 10 + 150);
|
||||
ui_->checkbox_replaygaincompression->setChecked(s_.value("rgcompression", true).toBool());
|
||||
|
||||
//if (dialog()->app()->player()->engine()->state() != Engine::Empty) ui_->combobox_engine->setEnabled(false);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
ui_->combobox_engine->setEnabled(false);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void BackendSettingsPage::Load_Engine(Engine::EngineType enginetype) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
output_ = s_.value("output", "").toString();
|
||||
device_ = s_.value("device", "").toString();
|
||||
QString output = s_.value("output", "").toString();
|
||||
QVariant device = s_.value("device", QVariant());
|
||||
|
||||
ui_->combobox_output->clear();
|
||||
ui_->combobox_device->clear();
|
||||
@ -141,13 +136,15 @@ void BackendSettingsPage::Load_Engine(Engine::EngineType enginetype) {
|
||||
|
||||
ui_->lineedit_device->setEnabled(false);
|
||||
ui_->lineedit_device->setText("");
|
||||
|
||||
ui_->groupbox_replaygain->setEnabled(false);
|
||||
|
||||
// If a engine is loaded (!= Engine::None) AND engine has been switched reset output and device.
|
||||
if ((engineloaded_ != Engine::None) && (engineloaded_ != enginetype)) {
|
||||
output_ = "";
|
||||
device_ = "";
|
||||
output = "";
|
||||
device = QVariant();
|
||||
s_.setValue("output", "");
|
||||
s_.setValue("device", "");
|
||||
s_.setValue("device", QVariant());
|
||||
}
|
||||
|
||||
if (dialog()->app()->player()->engine()->type() != enginetype) {
|
||||
@ -159,168 +156,177 @@ void BackendSettingsPage::Load_Engine(Engine::EngineType enginetype) {
|
||||
switch(enginetype) {
|
||||
#ifdef HAVE_XINE
|
||||
case Engine::Xine:
|
||||
Xine_Load();
|
||||
Xine_Load(output, device);
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_GSTREAMER
|
||||
case Engine::GStreamer:
|
||||
Gst_Load();
|
||||
Gst_Load(output, device);
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_PHONON
|
||||
case Engine::Phonon:
|
||||
Phonon_Load();
|
||||
Phonon_Load(output, device);
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_VLC
|
||||
case Engine::VLC:
|
||||
VLC_Load();
|
||||
VLC_Load(output, device);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
QMessageBox messageBox;
|
||||
QString msg = QString("Missing engine %1!").arg(Engine::EngineNameFromType(enginetype));
|
||||
messageBox.critical(nullptr, "Error", msg);
|
||||
messageBox.setFixedSize(500, 200);
|
||||
errordialog_.ShowMessage(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BackendSettingsPage::Load_Device(QString output) {
|
||||
void BackendSettingsPage::Load_Device(QString output, QVariant device, bool alsa) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
int devices = 0;
|
||||
DeviceFinder::Device dfdevice;
|
||||
|
||||
ui_->combobox_device->setEnabled(false);
|
||||
ui_->combobox_device->clear();
|
||||
ui_->lineedit_device->setEnabled(false);
|
||||
ui_->combobox_device->setEnabled(false);
|
||||
ui_->lineedit_device->setText("");
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
ui_->combobox_device->addItem(IconLoader::Load("soundcard"), "Automatically select", "");
|
||||
ui_->combobox_device->addItem(IconLoader::Load("soundcard"), "Custom", "");
|
||||
int i = 0;
|
||||
for (DeviceFinder *finder : dialog()->app()->enginedevice()->device_finders_) {
|
||||
if (finder->output() != output) continue;
|
||||
for (const DeviceFinder::Device &device : finder->ListDevices()) {
|
||||
i++;
|
||||
ui_->combobox_device->addItem(IconLoader::Load(device.iconname), device.description, device.string);
|
||||
#endif
|
||||
|
||||
if (alsa) ui_->lineedit_device->setEnabled(true);
|
||||
else ui_->lineedit_device->setEnabled(false);
|
||||
|
||||
for (DeviceFinder *f : dialog()->app()->enginedevice()->device_finders_) {
|
||||
if (f->name() == "alsa" && !alsa) continue;
|
||||
for (const DeviceFinder::Device &d : f->ListDevices()) {
|
||||
devices++;
|
||||
ui_->combobox_device->addItem(IconLoader::Load(d.iconname), d.description, d.value);
|
||||
if (d.value == device) { dfdevice = d; }
|
||||
}
|
||||
}
|
||||
if (i > 0) {
|
||||
ui_->combobox_device->setEnabled(true);
|
||||
ui_->lineedit_device->setEnabled(true);
|
||||
ui_->lineedit_device->setText(device_);
|
||||
|
||||
if (alsa) ui_->combobox_device->addItem(IconLoader::Load("soundcard"), "Custom", QVariant(""));
|
||||
|
||||
bool found = false;
|
||||
if (devices > 0) ui_->combobox_device->setEnabled(true);
|
||||
for (int i = 0; i < ui_->combobox_device->count(); ++i) {
|
||||
QVariant d = ui_->combobox_device->itemData(i).value<QVariant>();
|
||||
if (dfdevice.value == d) {
|
||||
ui_->combobox_device->setCurrentIndex(i);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// This allows a custom ALSA device string ie: "hw:0,0" even if it is not listed.
|
||||
if (found == false && alsa && device.type() == QVariant::String && !device.toString().isEmpty()) {
|
||||
ui_->lineedit_device->setText(device.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
void BackendSettingsPage::Gst_Load() {
|
||||
void BackendSettingsPage::Gst_Load(QString output, QVariant device) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
if (output_ == "") output_ = GstEngine::kAutoSink;
|
||||
if (output == "") output = GstEngine::kAutoSink;
|
||||
|
||||
if (dialog()->app()->player()->engine()->type() != Engine::GStreamer) {
|
||||
QMessageBox messageBox;
|
||||
messageBox.critical(nullptr, "Error", "GStramer not initialized! Please restart.");
|
||||
messageBox.setFixedSize(500, 200);
|
||||
errordialog_.ShowMessage("GStramer not initialized! Please restart.");
|
||||
return;
|
||||
}
|
||||
|
||||
GstEngine *gstengine = qobject_cast<GstEngine*>(dialog()->app()->player()->engine());
|
||||
|
||||
ui_->combobox_output->clear();
|
||||
int i = 0;
|
||||
for (const EngineBase::OutputDetails &output : gstengine->GetOutputsList()) {
|
||||
for (const EngineBase::OutputDetails &o : gstengine->GetOutputsList()) {
|
||||
i++;
|
||||
ui_->combobox_output->addItem(IconLoader::Load(output.iconname), output.description, QVariant::fromValue(output));
|
||||
//qLog(Debug) << output.description;
|
||||
ui_->combobox_output->addItem(IconLoader::Load(o.iconname), o.description, QVariant::fromValue(o));
|
||||
}
|
||||
if (i > 0) ui_->combobox_output->setEnabled(true);
|
||||
|
||||
for (int i = 0; i < ui_->combobox_output->count(); ++i) {
|
||||
EngineBase::OutputDetails details = ui_->combobox_output->itemData(i).value<EngineBase::OutputDetails>();
|
||||
if (details.name == output_) {
|
||||
EngineBase::OutputDetails o = ui_->combobox_output->itemData(i).value<EngineBase::OutputDetails>();
|
||||
if (o.name == output) {
|
||||
ui_->combobox_output->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
engineloaded_=Engine::GStreamer;
|
||||
ui_->groupbox_replaygain->setEnabled(true);
|
||||
|
||||
Load_Device(output, device, GstEngine::ALSADeviceSupport(output));
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XINE
|
||||
void BackendSettingsPage::Xine_Load() {
|
||||
void BackendSettingsPage::Xine_Load(QString output, QVariant device) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
if (output_ == "") output_ = "auto";
|
||||
if (output == "") output = "auto";
|
||||
|
||||
if (dialog()->app()->player()->engine()->type() != Engine::Xine) {
|
||||
QMessageBox messageBox;
|
||||
messageBox.critical(nullptr, "Error", "Xine not initialized! Please restart.");
|
||||
messageBox.setFixedSize(500, 200);
|
||||
errordialog_.ShowMessage("Xine not initialized! Please restart.");
|
||||
return;
|
||||
}
|
||||
XineEngine *xineengine = qobject_cast<XineEngine*>(dialog()->app()->player()->engine());
|
||||
|
||||
ui_->combobox_output->clear();
|
||||
int i = 0;
|
||||
for (const EngineBase::OutputDetails &output : xineengine->GetOutputsList()) {
|
||||
for (const EngineBase::OutputDetails &o : xineengine->GetOutputsList()) {
|
||||
i++;
|
||||
ui_->combobox_output->addItem(IconLoader::Load(output.iconname), output.description, QVariant::fromValue(output));
|
||||
//qLog(Debug) << output.description;
|
||||
ui_->combobox_output->addItem(IconLoader::Load(o.iconname), o.description, QVariant::fromValue(o));
|
||||
}
|
||||
if (i > 0) ui_->combobox_output->setEnabled(true);
|
||||
|
||||
for (int i = 0; i < ui_->combobox_output->count(); ++i) {
|
||||
EngineBase::OutputDetails details = ui_->combobox_output->itemData(i).value<EngineBase::OutputDetails>();
|
||||
if (details.name == output_) {
|
||||
EngineBase::OutputDetails o = ui_->combobox_output->itemData(i).value<EngineBase::OutputDetails>();
|
||||
if (o.name == output) {
|
||||
ui_->combobox_output->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
engineloaded_=Engine::Xine;
|
||||
|
||||
Load_Device(output, device, false);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PHONON
|
||||
void BackendSettingsPage::Phonon_Load() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
void BackendSettingsPage::Phonon_Load(QString output, QVariant device) {
|
||||
|
||||
ui_->combobox_output->clear();
|
||||
ui_->combobox_device->clear();
|
||||
ui_->lineedit_device->setText("");
|
||||
|
||||
engineloaded_=Engine::Phonon;
|
||||
|
||||
Load_Device(output, device, false);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VLC
|
||||
void BackendSettingsPage::VLC_Load() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
void BackendSettingsPage::VLC_Load(QString output, QVariant device) {
|
||||
|
||||
ui_->combobox_output->clear();
|
||||
ui_->combobox_device->clear();
|
||||
ui_->lineedit_device->setText("");
|
||||
|
||||
engineloaded_=Engine::VLC;
|
||||
|
||||
Load_Device(output, device, false);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void BackendSettingsPage::Save() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
s_.setValue("engine", ui_->combobox_engine->itemText(ui_->combobox_engine->currentIndex()).toLower());
|
||||
|
||||
QVariant myVariant = ui_->combobox_engine->itemData(ui_->combobox_engine->currentIndex());
|
||||
@ -351,7 +357,8 @@ void BackendSettingsPage::Save() {
|
||||
break;
|
||||
}
|
||||
|
||||
s_.setValue("device", ui_->lineedit_device->text());
|
||||
s_.setValue("device", ui_->combobox_device->itemData(ui_->combobox_device->currentIndex()).value<QVariant>());
|
||||
|
||||
s_.setValue("bufferduration", ui_->spinbox_bufferduration->value());
|
||||
s_.setValue("monoplayback", ui_->checkbox_monoplayback->isChecked());
|
||||
s_.setValue("bufferminfill", ui_->slider_bufferminfill->value());
|
||||
@ -364,18 +371,9 @@ void BackendSettingsPage::Save() {
|
||||
|
||||
#ifdef HAVE_XINE
|
||||
void BackendSettingsPage::Xine_Save() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
XineEngine *xineengine = qobject_cast<XineEngine*>(dialog()->app()->player()->engine());
|
||||
|
||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||
s_.setValue("output", output.name);
|
||||
|
||||
for (EngineBase::OutputDetails &output : xineengine->GetOutputsList()) {
|
||||
if (xineengine->ALSADeviceSupport(output.name)) output.device_property_value = QVariant(ui_->lineedit_device->text());
|
||||
else output.device_property_value = QVariant(ui_->combobox_device->itemData(ui_->combobox_device->currentIndex()));
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
@ -383,45 +381,36 @@ void BackendSettingsPage::Xine_Save() {
|
||||
#ifdef HAVE_GSTREAMER
|
||||
void BackendSettingsPage::Gst_Save() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
GstEngine *gstengine = qobject_cast<GstEngine*>(dialog()->app()->player()->engine());
|
||||
|
||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||
s_.setValue("output", output.name);
|
||||
|
||||
for (EngineBase::OutputDetails &output : gstengine->GetOutputsList()) {
|
||||
if (GstEngine::ALSADeviceSupport(output.name)) output.device_property_value = QVariant(ui_->lineedit_device->text());
|
||||
else output.device_property_value = QVariant(ui_->combobox_device->itemData(ui_->combobox_device->currentIndex()));
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PHONON
|
||||
void BackendSettingsPage::Phonon_Save() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VLC
|
||||
void BackendSettingsPage::VLC_Save() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void BackendSettingsPage::EngineChanged(int index) {
|
||||
|
||||
if (configloaded_ == false) return;
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
QVariant myVariant = ui_->combobox_engine->itemData(index);
|
||||
Engine::EngineType enginetype = myVariant.value<Engine::EngineType>();
|
||||
|
||||
if ((engineloaded_ != Engine::None) && (dialog()->app()->player()->engine()->state() != Engine::Empty)) {
|
||||
if (enginereset_ == true) { enginereset_ = false; return; }
|
||||
errordialog_.ShowMessage("Can't switch engine while playing!");
|
||||
enginereset_ = true;
|
||||
ui_->combobox_engine->setCurrentIndex(ui_->combobox_engine->findData(engineloaded_));
|
||||
return;
|
||||
}
|
||||
|
||||
QVariant v = ui_->combobox_engine->itemData(index);
|
||||
Engine::EngineType enginetype = v.value<Engine::EngineType>();
|
||||
|
||||
Load_Engine(enginetype);
|
||||
|
||||
@ -429,18 +418,14 @@ void BackendSettingsPage::EngineChanged(int index) {
|
||||
|
||||
void BackendSettingsPage::OutputChanged(int index) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
QVariant myVariant = ui_->combobox_engine->itemData(ui_->combobox_engine->currentIndex());
|
||||
Engine::EngineType enginetype = myVariant.value<Engine::EngineType>();
|
||||
QVariant v = ui_->combobox_engine->itemData(ui_->combobox_engine->currentIndex());
|
||||
Engine::EngineType enginetype = v.value<Engine::EngineType>();
|
||||
OutputChanged(index, enginetype);
|
||||
|
||||
}
|
||||
|
||||
void BackendSettingsPage::OutputChanged(int index, Engine::EngineType enginetype) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
switch(enginetype) {
|
||||
case Engine::Xine:
|
||||
#ifdef HAVE_XINE
|
||||
@ -471,76 +456,82 @@ void BackendSettingsPage::OutputChanged(int index, Engine::EngineType enginetype
|
||||
#ifdef HAVE_XINE
|
||||
void BackendSettingsPage::Xine_OutputChanged(int index) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(index).value<EngineBase::OutputDetails>();
|
||||
Load_Device(output.name, QVariant(), false);
|
||||
|
||||
EngineBase::OutputDetails details = ui_->combobox_output->itemData(index).value<EngineBase::OutputDetails>();
|
||||
QString name = details.name;
|
||||
if (XineEngine::ALSADeviceSupport(name)) Load_Device("alsa");
|
||||
else Load_Device(name);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
void BackendSettingsPage::Gst_OutputChanged(int index) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
EngineBase::OutputDetails details = ui_->combobox_output->itemData(index).value<EngineBase::OutputDetails>();
|
||||
QString name = details.name;
|
||||
if (GstEngine::ALSADeviceSupport(name)) Load_Device("alsa");
|
||||
else Load_Device(name);
|
||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(index).value<EngineBase::OutputDetails>();
|
||||
Load_Device(output.name, QVariant(), GstEngine::ALSADeviceSupport(output.name));
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PHONON
|
||||
void BackendSettingsPage::Phonon_OutputChanged(int index) {
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
Load_Device("");
|
||||
Load_Device("", QVariant(), false);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VLC
|
||||
void BackendSettingsPage::VLC_OutputChanged(int index) {
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
Load_Device("");
|
||||
Load_Device("", QVariant(), false);
|
||||
}
|
||||
#endif
|
||||
|
||||
void BackendSettingsPage::DeviceSelectionChanged(int index) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
if (ui_->combobox_device->currentText() == "Custom") {
|
||||
ui_->lineedit_device->setEnabled(true);
|
||||
ui_->combobox_device->setItemData(index, QVariant(ui_->lineedit_device->text()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (index == 1) return;
|
||||
QVariant device = ui_->combobox_device->itemData(index).value<QVariant>();
|
||||
if (device.type() == QVariant::String) {
|
||||
ui_->lineedit_device->setEnabled(true);
|
||||
ui_->lineedit_device->setText(device.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
QString string = ui_->combobox_device->itemData(index).value<QString>();
|
||||
|
||||
ui_->lineedit_device->setText(string);
|
||||
ui_->lineedit_device->setEnabled(false);
|
||||
ui_->lineedit_device->setText("");
|
||||
|
||||
}
|
||||
|
||||
void BackendSettingsPage::DeviceStringChanged() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
QString string = ui_->lineedit_device->text();
|
||||
|
||||
for (int i = 0; i < ui_->combobox_device->count(); ++i) {
|
||||
QString s = ui_->combobox_device->itemData(i).value<QString>();
|
||||
if (s == string ) {
|
||||
QVariant v = ui_->combobox_device->itemData(i).value<QVariant>();
|
||||
if (v.type() != QVariant::String) continue;
|
||||
if (v.toString() == ui_->lineedit_device->text()) {
|
||||
ui_->combobox_device->setCurrentIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Assume this is a custom alsa device string
|
||||
|
||||
ui_->combobox_device->setCurrentIndex(1);
|
||||
if (ui_->combobox_device->currentText() != "Custom") {
|
||||
for (int i = 0; i < ui_->combobox_device->count(); ++i) {
|
||||
if (ui_->combobox_device->itemText(i) == "Custom") {
|
||||
ui_->combobox_device->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ui_->combobox_device->currentText() == "Custom") {
|
||||
ui_->combobox_device->setItemData(ui_->combobox_device->currentIndex(), QVariant(ui_->lineedit_device->text()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BackendSettingsPage::RgPreampChanged(int value) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
float db = float(value) / 10 - 15;
|
||||
QString db_str;
|
||||
db_str.sprintf("%+.1f dB", db);
|
||||
@ -549,8 +540,5 @@ void BackendSettingsPage::RgPreampChanged(int value) {
|
||||
}
|
||||
|
||||
void BackendSettingsPage::BufferMinFillChanged(int value) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
ui_->label_bufferminfillvalue->setText(QString::number(value) + "%");
|
||||
}
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "engine/engine_fwd.h"
|
||||
#include "engine/enginetype.h"
|
||||
|
||||
#include "dialogs/errordialog.h"
|
||||
|
||||
class Ui_BackendSettingsPage;
|
||||
|
||||
class BackendSettingsPage : public SettingsPage {
|
||||
@ -40,7 +42,7 @@ class BackendSettingsPage : public SettingsPage {
|
||||
public:
|
||||
BackendSettingsPage(SettingsDialog *dialog);
|
||||
~BackendSettingsPage();
|
||||
|
||||
|
||||
static const char *kSettingsGroup;
|
||||
static const char *EngineText_Xine;
|
||||
static const char *EngineText_GStreamer;
|
||||
@ -63,39 +65,39 @@ private:
|
||||
|
||||
void EngineChanged(Engine::EngineType enginetype);
|
||||
void OutputChanged(int index, Engine::EngineType enginetype);
|
||||
|
||||
|
||||
void Load_Engine(Engine::EngineType enginetype);
|
||||
void Load_Device(QString output);
|
||||
|
||||
void Load_Device(QString output, QVariant device, bool alsa);
|
||||
|
||||
#ifdef HAVE_XINE
|
||||
void Xine_Load();
|
||||
void Xine_Load(QString output, QVariant device);
|
||||
void Xine_Save();
|
||||
void Xine_OutputChanged(int index);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
void Gst_Load();
|
||||
void Gst_Load(QString output, QVariant device);
|
||||
void Gst_Save();
|
||||
void Gst_OutputChanged(int index);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PHONON
|
||||
void Phonon_Load();
|
||||
void Phonon_Load(QString output, QVariant device);
|
||||
void Phonon_Save();
|
||||
void Phonon_OutputChanged(int index);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VLC
|
||||
void VLC_Load();
|
||||
void VLC_Load(QString output, QVariant device);
|
||||
void VLC_Save();
|
||||
void VLC_OutputChanged(int index);
|
||||
#endif
|
||||
|
||||
bool configloaded_;
|
||||
Engine::EngineType engineloaded_;
|
||||
QString output_;
|
||||
QString device_;
|
||||
QSettings s_;
|
||||
ErrorDialog errordialog_;
|
||||
bool enginereset_;
|
||||
|
||||
};
|
||||
|
||||
|
@ -174,19 +174,25 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupbox_replaygain">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Replay Gain</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkbox_replaygain">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use Replay Gain metadata if it is available</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<widget class="QWidget" name="widget_replaygain" native="true">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -295,5 +301,22 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>checkbox_replaygain</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>widget_replaygain</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>89</x>
|
||||
<y>259</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>143</x>
|
||||
<y>285</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
@ -168,9 +168,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
@ -195,22 +192,6 @@
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>replaygain</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>widget</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>89</x>
|
||||
<y>259</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>143</x>
|
||||
<y>285</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>fading_auto</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
|
@ -85,7 +85,7 @@ StatusView::StatusView(CollectionViewContainer *collectionviewcontainer, QWidget
|
||||
widgetstate_(None),
|
||||
menu_(new QMenu(this))
|
||||
{
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
collectionview_ = collectionviewcontainer->view();
|
||||
@ -112,7 +112,7 @@ StatusView::~StatusView() {
|
||||
}
|
||||
|
||||
void StatusView::AddActions() {
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
QList<QAction*> actions = album_cover_choice_controller_->GetAllActions();
|
||||
@ -130,13 +130,13 @@ void StatusView::AddActions() {
|
||||
|
||||
menu_->addActions(actions);
|
||||
menu_->addSeparator();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void StatusView::CreateWidget() {
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
|
||||
setLayout(layout_);
|
||||
setStyleSheet("background-color: white;");
|
||||
|
||||
@ -162,7 +162,7 @@ void StatusView::CreateWidget() {
|
||||
}
|
||||
|
||||
void StatusView::SetApplication(Application *app) {
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
app_ = app;
|
||||
@ -263,7 +263,7 @@ void StatusView::SongWidget() {
|
||||
void StatusView::SwitchWidgets(WidgetState state) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
|
||||
if (widgetstate_ == None) NoSongWidget();
|
||||
|
||||
if ((state == Stopped) && (widgetstate_ != Stopped)) {
|
||||
@ -279,7 +279,7 @@ void StatusView::SwitchWidgets(WidgetState state) {
|
||||
void StatusView::UpdateSong(const Song &song) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
|
||||
SwitchWidgets(Playing);
|
||||
|
||||
const Song *song_ = &song;
|
||||
@ -331,7 +331,7 @@ void StatusView::UpdateSong(const Song &song) {
|
||||
}
|
||||
|
||||
void StatusView::NoSong() {
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
QString html;
|
||||
@ -368,7 +368,7 @@ void StatusView::NoSong() {
|
||||
void StatusView::SongChanged(const Song &song) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
|
||||
stopped_ = false;
|
||||
metadata_ = song;
|
||||
const Song *song_ = &song;
|
||||
@ -380,9 +380,9 @@ void StatusView::SongChanged(const Song &song) {
|
||||
}
|
||||
|
||||
void StatusView::SongFinished() {
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
|
||||
stopped_ = true;
|
||||
SetImage(image_blank_);
|
||||
|
||||
@ -391,7 +391,7 @@ void StatusView::SongFinished() {
|
||||
bool StatusView::eventFilter(QObject *object, QEvent *event) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
|
||||
switch(event->type()) {
|
||||
case QEvent::Paint:{
|
||||
handlePaintEvent(object, event);
|
||||
@ -406,7 +406,7 @@ bool StatusView::eventFilter(QObject *object, QEvent *event) {
|
||||
}
|
||||
|
||||
void StatusView::handlePaintEvent(QObject *object, QEvent *event) {
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__ << object->objectName();
|
||||
|
||||
if (object == label_playing_album_) {
|
||||
@ -420,7 +420,7 @@ void StatusView::handlePaintEvent(QObject *object, QEvent *event) {
|
||||
void StatusView::paintEvent_album(QEvent *event) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
|
||||
QPainter p(label_playing_album_);
|
||||
|
||||
DrawImage(&p);
|
||||
@ -433,7 +433,7 @@ void StatusView::paintEvent_album(QEvent *event) {
|
||||
}
|
||||
|
||||
void StatusView::DrawImage(QPainter *p) {
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
p->drawPixmap(0, 0, 300, 300, pixmap_current_);
|
||||
@ -444,9 +444,9 @@ void StatusView::DrawImage(QPainter *p) {
|
||||
}
|
||||
|
||||
void StatusView::FadePreviousTrack(qreal value) {
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
|
||||
pixmap_previous_opacity_ = value;
|
||||
if (qFuzzyCompare(pixmap_previous_opacity_, qreal(0.0))) {
|
||||
pixmap_previous_ = QPixmap();
|
||||
@ -464,17 +464,17 @@ void StatusView::FadePreviousTrack(qreal value) {
|
||||
void StatusView::contextMenuEvent(QContextMenuEvent *e) {
|
||||
|
||||
// show the menu
|
||||
menu_->popup(mapToGlobal(e->pos()));
|
||||
if (menu_ && widgetstate_ == Playing) menu_->popup(mapToGlobal(e->pos()));
|
||||
}
|
||||
|
||||
void StatusView::mouseReleaseEvent(QMouseEvent *) {
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
}
|
||||
|
||||
void StatusView::dragEnterEvent(QDragEnterEvent *e) {
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
QWidget::dragEnterEvent(e);
|
||||
@ -482,7 +482,7 @@ void StatusView::dragEnterEvent(QDragEnterEvent *e) {
|
||||
}
|
||||
|
||||
void StatusView::dropEvent(QDropEvent *e) {
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
QWidget::dropEvent(e);
|
||||
@ -541,9 +541,9 @@ void StatusView::SetImage(const QImage &image) {
|
||||
}
|
||||
|
||||
bool StatusView::GetCoverAutomatically() {
|
||||
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
|
||||
SwitchWidgets(Playing);
|
||||
|
||||
// Search for cover automatically?
|
||||
|
Loading…
x
Reference in New Issue
Block a user