moodbar: Formatting
This commit is contained in:
parent
0919d5d3de
commit
28a29d219e
@ -1,19 +1,23 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2014, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2014, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
*/
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@ -22,6 +26,7 @@
|
|||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
|
||||||
#include "moodbarbuilder.h"
|
#include "moodbarbuilder.h"
|
||||||
|
#include "core/logging.h"
|
||||||
#include "core/arraysize.h"
|
#include "core/arraysize.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -33,11 +38,11 @@ constexpr int sBarkBandCount = arraysize(sBarkBands);
|
|||||||
|
|
||||||
MoodbarBuilder::MoodbarBuilder() : bands_(0), rate_hz_(0) {}
|
MoodbarBuilder::MoodbarBuilder() : bands_(0), rate_hz_(0) {}
|
||||||
|
|
||||||
int MoodbarBuilder::BandFrequency(int band) const {
|
int MoodbarBuilder::BandFrequency(const int band) const {
|
||||||
return ((rate_hz_ / 2) * band + rate_hz_ / 4) / bands_;
|
return ((rate_hz_ / 2) * band + rate_hz_ / 4) / bands_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoodbarBuilder::Init(int bands, int rate_hz) {
|
void MoodbarBuilder::Init(const int bands, const int rate_hz) {
|
||||||
|
|
||||||
bands_ = bands;
|
bands_ = bands;
|
||||||
rate_hz_ = rate_hz;
|
rate_hz_ = rate_hz;
|
||||||
@ -56,18 +61,14 @@ void MoodbarBuilder::Init(int bands, int rate_hz) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoodbarBuilder::AddFrame(const double *magnitudes, int size) {
|
void MoodbarBuilder::AddFrame(const double *magnitudes, const int size) {
|
||||||
|
|
||||||
if (size > barkband_table_.length()) {
|
if (size > barkband_table_.length()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate total magnitudes for different bark bands.
|
// Calculate total magnitudes for different bark bands.
|
||||||
double bands[sBarkBandCount];
|
double bands[sBarkBandCount]{};
|
||||||
for (int i = 0; i < sBarkBandCount; ++i) {
|
|
||||||
bands[i] = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
bands[barkband_table_[i]] += magnitudes[i];
|
bands[barkband_table_[i]] += magnitudes[i];
|
||||||
}
|
}
|
||||||
@ -160,7 +161,7 @@ void MoodbarBuilder::Normalize(QList<Rgb> *vals, double Rgb::*member) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray MoodbarBuilder::Finish(int width) {
|
QByteArray MoodbarBuilder::Finish(const int width) {
|
||||||
|
|
||||||
QByteArray ret;
|
QByteArray ret;
|
||||||
ret.resize(width * 3);
|
ret.resize(width * 3);
|
||||||
@ -191,6 +192,7 @@ QByteArray MoodbarBuilder::Finish(int width) {
|
|||||||
*(data++) = static_cast<char>(rgb.b / n);
|
*(data++) = static_cast<char>(rgb.b / n);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2014, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2014, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
*/
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef MOODBARBUILDER_H
|
#ifndef MOODBARBUILDER_H
|
||||||
#define MOODBARBUILDER_H
|
#define MOODBARBUILDER_H
|
||||||
@ -26,19 +30,19 @@ class MoodbarBuilder {
|
|||||||
public:
|
public:
|
||||||
explicit MoodbarBuilder();
|
explicit MoodbarBuilder();
|
||||||
|
|
||||||
void Init(int bands, int rate_hz);
|
void Init(const int bands, const int rate_hz);
|
||||||
void AddFrame(const double *magnitudes, int size);
|
void AddFrame(const double *magnitudes, const int size);
|
||||||
QByteArray Finish(int width);
|
QByteArray Finish(const int width);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Rgb {
|
struct Rgb {
|
||||||
Rgb() : r(0), g(0), b(0) {}
|
Rgb() : r(0), g(0), b(0) {}
|
||||||
Rgb(double r_, double g_, double b_) : r(r_), g(g_), b(b_) {}
|
Rgb(const double r_, const double g_, const double b_) : r(r_), g(g_), b(b_) {}
|
||||||
|
|
||||||
double r, g, b;
|
double r, g, b;
|
||||||
};
|
};
|
||||||
|
|
||||||
int BandFrequency(int band) const;
|
int BandFrequency(const int band) const;
|
||||||
static void Normalize(QList<Rgb> *vals, double Rgb::*member);
|
static void Normalize(QList<Rgb> *vals, double Rgb::*member);
|
||||||
|
|
||||||
QList<uint> barkband_table_;
|
QList<uint> barkband_table_;
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2012, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2012, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
*/
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
@ -81,9 +85,11 @@ void MoodbarController::CurrentSongChanged(const Song &song) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MoodbarController::PlaybackStopped() {
|
void MoodbarController::PlaybackStopped() {
|
||||||
|
|
||||||
if (enabled_) {
|
if (enabled_) {
|
||||||
Q_EMIT CurrentMoodbarDataChanged(QByteArray());
|
Q_EMIT CurrentMoodbarDataChanged(QByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoodbarController::AsyncLoadComplete(MoodbarPipeline *pipeline, const QUrl &url) {
|
void MoodbarController::AsyncLoadComplete(MoodbarPipeline *pipeline, const QUrl &url) {
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2012, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2012, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
*/
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef MOODBARCONTROLLER_H
|
#ifndef MOODBARCONTROLLER_H
|
||||||
#define MOODBARCONTROLLER_H
|
#define MOODBARCONTROLLER_H
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2012, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2012, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
*/
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
/* This file is part of Clementine.
|
/*
|
||||||
Copyright 2012, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2012, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
*/
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef MOODBARITEMDELEGATE_H
|
#ifndef MOODBARITEMDELEGATE_H
|
||||||
#define MOODBARITEMDELEGATE_H
|
#define MOODBARITEMDELEGATE_H
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2012, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2012, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
*/
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include "moodbarloader.h"
|
#include "moodbarloader.h"
|
||||||
|
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2012, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2012, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
*/
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef MOODBARLOADER_H
|
#ifndef MOODBARLOADER_H
|
||||||
#define MOODBARLOADER_H
|
#define MOODBARLOADER_H
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2012, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2012, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
*/
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include "moodbarpipeline.h"
|
#include "moodbarpipeline.h"
|
||||||
|
|
||||||
@ -122,8 +126,8 @@ void MoodbarPipeline::Start() {
|
|||||||
g_object_set(decodebin, "uri", gst_url.constData(), nullptr);
|
g_object_set(decodebin, "uri", gst_url.constData(), nullptr);
|
||||||
g_object_set(spectrum, "bands", kBands, nullptr);
|
g_object_set(spectrum, "bands", kBands, nullptr);
|
||||||
|
|
||||||
GstStrawberryFastSpectrum *fast_spectrum = reinterpret_cast<GstStrawberryFastSpectrum*>(spectrum);
|
GstStrawberryFastSpectrum *fastspectrum = reinterpret_cast<GstStrawberryFastSpectrum*>(spectrum);
|
||||||
fast_spectrum->output_callback = [this](double *magnitudes, int size) { builder_->AddFrame(magnitudes, size); };
|
fastspectrum->output_callback = [this](double *magnitudes, const int size) { builder_->AddFrame(magnitudes, size); };
|
||||||
|
|
||||||
// Connect signals
|
// Connect signals
|
||||||
CHECKED_GCONNECT(decodebin, "pad-added", &NewPadCallback, this);
|
CHECKED_GCONNECT(decodebin, "pad-added", &NewPadCallback, this);
|
||||||
@ -154,7 +158,9 @@ void MoodbarPipeline::ReportError(GstMessage *msg) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoodbarPipeline::NewPadCallback(GstElement*, GstPad *pad, gpointer data) {
|
void MoodbarPipeline::NewPadCallback(GstElement *element, GstPad *pad, gpointer data) {
|
||||||
|
|
||||||
|
Q_UNUSED(element)
|
||||||
|
|
||||||
MoodbarPipeline *self = reinterpret_cast<MoodbarPipeline*>(data);
|
MoodbarPipeline *self = reinterpret_cast<MoodbarPipeline*>(data);
|
||||||
|
|
||||||
@ -193,23 +199,26 @@ void MoodbarPipeline::NewPadCallback(GstElement*, GstPad *pad, gpointer data) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GstBusSyncReply MoodbarPipeline::BusCallbackSync(GstBus*, GstMessage *msg, gpointer data) {
|
GstBusSyncReply MoodbarPipeline::BusCallbackSync(GstBus *bus, GstMessage *message, gpointer data) {
|
||||||
|
|
||||||
|
Q_UNUSED(bus)
|
||||||
|
|
||||||
MoodbarPipeline *self = reinterpret_cast<MoodbarPipeline*>(data);
|
MoodbarPipeline *self = reinterpret_cast<MoodbarPipeline*>(data);
|
||||||
|
|
||||||
switch (GST_MESSAGE_TYPE(msg)) {
|
switch (GST_MESSAGE_TYPE(message)) {
|
||||||
case GST_MESSAGE_EOS:
|
case GST_MESSAGE_EOS:
|
||||||
self->Stop(true);
|
self->Stop(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_MESSAGE_ERROR:
|
case GST_MESSAGE_ERROR:
|
||||||
self->ReportError(msg);
|
self->ReportError(message);
|
||||||
self->Stop(false);
|
self->Stop(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GST_BUS_PASS;
|
return GST_BUS_PASS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2012, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2012, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
*/
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef MOODBARPIPELINE_H
|
#ifndef MOODBARPIPELINE_H
|
||||||
#define MOODBARPIPELINE_H
|
#define MOODBARPIPELINE_H
|
||||||
@ -57,10 +61,9 @@ class MoodbarPipeline : public QObject {
|
|||||||
void Stop(const bool success);
|
void Stop(const bool success);
|
||||||
void Cleanup();
|
void Cleanup();
|
||||||
|
|
||||||
static void NewPadCallback(GstElement*, GstPad *pad, gpointer data);
|
static void NewPadCallback(GstElement *element, GstPad *pad, gpointer data);
|
||||||
static GstFlowReturn NewBufferCallback(GstAppSink *app_sink, gpointer self);
|
static GstFlowReturn NewBufferCallback(GstAppSink *app_sink, gpointer self);
|
||||||
static gboolean BusCallback(GstBus*, GstMessage *msg, gpointer data);
|
static GstBusSyncReply BusCallbackSync(GstBus *bus, GstMessage *message, gpointer data);
|
||||||
static GstBusSyncReply BusCallbackSync(GstBus*, GstMessage *msg, gpointer data);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QUrl url_;
|
QUrl url_;
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2012, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2012, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
*/
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <QProxyStyle>
|
#include <QProxyStyle>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2012, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2012, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
*/
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef MOODBARPROXYSTYLE_H
|
#ifndef MOODBARPROXYSTYLE_H
|
||||||
#define MOODBARPROXYSTYLE_H
|
#define MOODBARPROXYSTYLE_H
|
||||||
|
@ -1,19 +1,22 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2012, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2012, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
*
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
(at your option) any later version.
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* (at your option) any later version.
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
*
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
GNU General Public License for more details.
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
You should have received a copy of the GNU General Public License
|
* GNU General Public License for more details.
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
*
|
||||||
*/
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
@ -1,19 +1,22 @@
|
|||||||
/* This file was part of Clementine.
|
/*
|
||||||
Copyright 2012, David Sansome <me@davidsansome.com>
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
Strawberry is free software: you can redistribute it and/or modify
|
* Copyright 2012, David Sansome <me@davidsansome.com>
|
||||||
it under the terms of the GNU General Public License as published by
|
*
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
(at your option) any later version.
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
Strawberry is distributed in the hope that it will be useful,
|
* (at your option) any later version.
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
*
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
GNU General Public License for more details.
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
You should have received a copy of the GNU General Public License
|
* GNU General Public License for more details.
|
||||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
*
|
||||||
*/
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef MOODBARRENDERER_H
|
#ifndef MOODBARRENDERER_H
|
||||||
#define MOODBARRENDERER_H
|
#define MOODBARRENDERER_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user