Move gstfastspectrum to 3rdparty

This commit is contained in:
Jonas Kvinge
2024-09-12 19:42:03 +02:00
parent 9ae0afaaf7
commit e9684cd1a1
13 changed files with 640 additions and 626 deletions

View File

@@ -988,6 +988,7 @@ optional_source(HAVE_MOODBAR
moodbar/moodbarpipeline.cpp
moodbar/moodbarproxystyle.cpp
moodbar/moodbarrenderer.cpp
moodbar/gstfastspectrumplugin.cpp
settings/moodbarsettingspage.cpp
HEADERS
moodbar/moodbarcontroller.h
@@ -1154,7 +1155,8 @@ if(HAVE_GSTREAMER)
endif()
if(HAVE_MOODBAR)
target_link_libraries(strawberry_lib PRIVATE gstmoodbar)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/3rdparty/gstfastspectrum)
target_link_libraries(strawberry_lib PRIVATE gstfastspectrum)
endif()
if(HAVE_VLC)

View File

@@ -39,7 +39,7 @@
#include "utilities/envutils.h"
#ifdef HAVE_MOODBAR
# include "ext/gstmoodbar/gstmoodbarplugin.h"
# include "moodbar/gstfastspectrumplugin.h"
#endif
#include "gststartup.h"
@@ -83,7 +83,7 @@ void GstStartup::InitializeGStreamer() {
gst_pb_utils_init();
#ifdef HAVE_MOODBAR
gstfastspectrum_register_static();
gst_strawberry_fastspectrum_register_static();
#endif
#ifdef Q_OS_WIN32

View File

@@ -0,0 +1,54 @@
/*
* Strawberry Music Player
* Copyright 2024, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <glib.h>
#include <gst/gst.h>
#include "gstfastspectrum.h"
#include "gstfastspectrumplugin.h"
static gboolean gst_strawberry_fastspectrum_plugin_init(GstPlugin *plugin) {
GstRegistry *reg = gst_registry_get();
if (reg) {
GstPluginFeature *fastspectrum = gst_registry_lookup_feature(reg, "fastspectrum");
if (fastspectrum) {
gst_object_unref(fastspectrum);
return TRUE;
}
}
return gst_element_register(plugin, "fastspectrum", GST_RANK_NONE, GST_TYPE_STRAWBERRY_FASTSPECTRUM);
}
int gst_strawberry_fastspectrum_register_static() {
return gst_plugin_register_static(
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"fastspectrum",
"Fast spectrum analyzer for generating Moodbars",
gst_strawberry_fastspectrum_plugin_init,
"0.1",
"GPL",
"FastSpectrum",
"gst-strawberry-fastspectrum",
"https://www.strawberrymusicplayer.org");
}

View File

@@ -0,0 +1,27 @@
/*
* Strawberry Music Player
* Copyright 2024, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GST_STRAWBERRY_FASTSPECTRUM_PLUGIN_H
#define GST_STRAWBERRY_FASTSPECTRUM_PLUGIN_H
extern "C" {
int gst_strawberry_fastspectrum_register_static();
}
#endif // GST_STRAWBERRY_FASTSPECTRUM_PLUGIN_H

View File

@@ -37,7 +37,7 @@
#include "utilities/threadutils.h"
#include "moodbar/moodbarbuilder.h"
#include "ext/gstmoodbar/gstfastspectrum.h"
#include "gstfastspectrum.h"
using namespace Qt::StringLiterals;
using std::make_unique;
@@ -122,7 +122,7 @@ void MoodbarPipeline::Start() {
g_object_set(decodebin, "uri", gst_url.constData(), nullptr);
g_object_set(spectrum, "bands", kBands, nullptr);
GstFastSpectrum *fast_spectrum = reinterpret_cast<GstFastSpectrum*>(spectrum);
GstStrawberryFastSpectrum *fast_spectrum = reinterpret_cast<GstStrawberryFastSpectrum*>(spectrum);
fast_spectrum->output_callback = [this](double *magnitudes, int size) { builder_->AddFrame(magnitudes, size); };
// Connect signals