Compare commits

..

1 Commits

Author SHA1 Message Date
Jonas Kvinge
6102679496 Change GuiPrivate to XcbQpaPrivate 2025-12-29 00:48:46 +01:00
7 changed files with 14 additions and 85 deletions

View File

@@ -218,16 +218,16 @@ set(QT_VERSION_MAJOR 6)
set(QT_MIN_VERSION 6.4.0)
set(QT_DEFAULT_MAJOR_VERSION ${QT_VERSION_MAJOR})
set(QT_COMPONENTS Core Concurrent Gui Widgets Network Sql)
set(QT_OPTIONAL_COMPONENTS GuiPrivate LinguistTools Test)
set(QT_OPTIONAL_COMPONENTS LinguistTools Test)
if(UNIX AND NOT APPLE)
list(APPEND QT_OPTIONAL_COMPONENTS DBus)
list(APPEND QT_OPTIONAL_COMPONENTS DBus XcbQpaPrivate)
endif()
set(QT_NO_PRIVATE_MODULE_WARNING ON)
find_package(Qt${QT_VERSION_MAJOR} ${QT_MIN_VERSION} COMPONENTS ${QT_COMPONENTS} REQUIRED OPTIONAL_COMPONENTS ${QT_OPTIONAL_COMPONENTS})
if(TARGET "Qt${QT_VERSION_MAJOR}::GuiPrivate")
set(QT_GUI_PRIVATE_FOUND ON)
if(TARGET "Qt${QT_VERSION_MAJOR}::XcbQpaPrivate")
set(QT_XCB_QPA_PRIVATE_FOUND ON)
endif()
if(Qt${QT_VERSION_MAJOR}DBus_FOUND)
@@ -369,8 +369,8 @@ if(APPLE OR WIN32)
)
endif()
optional_component(QPA_QPLATFORMNATIVEINTERFACE ON "QPA Platform Native Interface"
DEPENDS "Qt Gui Private" QT_GUI_PRIVATE_FOUND
optional_component(QT_XCB_QPA_PRIVATE ON "XCB QPA Platform Native Interface"
DEPENDS "Qt XCB QPA Private" QT_XCB_QPA_PRIVATE_FOUND
)
optional_component(STREAMTAGREADER ON "Stream tagreader"
@@ -1549,7 +1549,7 @@ target_link_libraries(strawberry_lib PUBLIC
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Sql
$<$<BOOL:${HAVE_DBUS}>:Qt${QT_VERSION_MAJOR}::DBus>
$<$<BOOL:${HAVE_QPA_QPLATFORMNATIVEINTERFACE}>:Qt${QT_VERSION_MAJOR}::GuiPrivate>
$<$<BOOL:${HAVE_QT_XCB_QPA_PRIVATE}>:Qt${QT_VERSION_MAJOR}::XcbQpaPrivate>
ICU::uc
ICU::i18n
$<$<BOOL:${HAVE_STREAMTAGREADER}>:PkgConfig::LIBSPARSEHASH>

View File

@@ -43,7 +43,7 @@
#cmakedefine INSTALL_TRANSLATIONS
#define TRANSLATIONS_DIR "${CMAKE_INSTALL_PREFIX}/share/strawberry/translations"
#cmakedefine HAVE_QPA_QPLATFORMNATIVEINTERFACE
#cmakedefine HAVE_QT_XCB_QPA_PRIVATE
#cmakedefine HAVE_QX11APPLICATION
#cmakedefine ENABLE_WIN32_CONSOLE

View File

@@ -22,9 +22,6 @@
#include <algorithm>
#include <cmath>
#include <glib-object.h>
#include <gst/gst.h>
#include <QList>
#include <QByteArray>
@@ -64,29 +61,6 @@ void MoodbarBuilder::Init(const int bands, const int rate_hz) {
}
void MoodbarBuilder::AddFrame(const GValue *magnitudes, const int size) {
if (size > barkband_table_.length()) {
return;
}
// Calculate total magnitudes for different bark bands.
double bands[sBarkBandCount]{};
for (int i = 0; i < size; ++i) {
const GValue *magnitude = gst_value_list_get_value(magnitudes, i);
bands[barkband_table_[i]] += g_value_get_float(magnitude);
}
// Now divide the bark bands into thirds and compute their total amplitudes.
double rgb[] = { 0, 0, 0 };
for (int i = 0; i < sBarkBandCount; ++i) {
rgb[(i * 3) / sBarkBandCount] += bands[i] * bands[i];
}
frames_.append(Rgb(sqrt(rgb[0]), sqrt(rgb[1]), sqrt(rgb[2])));
}
void MoodbarBuilder::AddFrame(const double *magnitudes, const int size) {
if (size > barkband_table_.length()) {

View File

@@ -22,8 +22,6 @@
#ifndef MOODBARBUILDER_H
#define MOODBARBUILDER_H
#include <glib-object.h>
#include <QtGlobal>
#include <QList>
#include <QByteArray>
@@ -33,7 +31,6 @@ class MoodbarBuilder {
explicit MoodbarBuilder();
void Init(const int bands, const int rate_hz);
void AddFrame(const GValue *magnitudes, const int size);
void AddFrame(const double *magnitudes, const int size);
QByteArray Finish(const int width);

View File

@@ -103,7 +103,7 @@ void MoodbarPipeline::Start() {
GstElement *decodebin = CreateElement("uridecodebin");
convert_element_ = CreateElement("audioconvert");
GstElement *spectrum = CreateElement("spectrum");
GstElement *spectrum = CreateElement("strawberry-fastspectrum");
GstElement *fakesink = CreateElement("fakesink");
if (!decodebin || !convert_element_ || !spectrum || !fakesink) {
@@ -122,7 +122,7 @@ void MoodbarPipeline::Start() {
return;
}
//builder_ = make_unique<MoodbarBuilder>();
builder_ = make_unique<MoodbarBuilder>();
// Set properties
@@ -130,16 +130,8 @@ void MoodbarPipeline::Start() {
g_object_set(decodebin, "uri", gst_url.constData(), nullptr);
g_object_set(spectrum, "bands", kBands, nullptr);
//GstStrawberryFastSpectrum *fastspectrum = reinterpret_cast<GstStrawberryFastSpectrum*>(spectrum);
//fastspectrum->output_callback = [this](double *magnitudes, const int size) { builder_->AddFrame(magnitudes, size); };
{
GstPad *pad = gst_element_get_static_pad(fakesink, "src");
if (pad) {
buffer_probe_cb_id_ = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, BufferProbeCallback, this, nullptr);
gst_object_unref(pad);
}
}
GstStrawberryFastSpectrum *fastspectrum = reinterpret_cast<GstStrawberryFastSpectrum*>(spectrum);
fastspectrum->output_callback = [this](double *magnitudes, const int size) { builder_->AddFrame(magnitudes, size); };
// Connect signals
CHECKED_GCONNECT(decodebin, "pad-added", &NewPadCallback, this);
@@ -220,20 +212,6 @@ GstBusSyncReply MoodbarPipeline::BusCallbackSync(GstBus *bus, GstMessage *messag
if (!instance->running_) return GST_BUS_PASS;
switch (GST_MESSAGE_TYPE(message)) {
#if 0
case GST_MESSAGE_ELEMENT:{
const GstStructure *structure = gst_message_get_structure(message);
const gchar *name = gst_structure_get_name(structure);
if (strcmp(name, "spectrum") == 0) {
const GValue *magnitudes = gst_structure_get_value(structure, "magnitude");
if (instance->builder_) {
instance->builder_->AddFrame(magnitudes, kBands);
}
}
break;
}
#endif
case GST_MESSAGE_EOS:
instance->Stop(true);
break;
@@ -251,24 +229,6 @@ GstBusSyncReply MoodbarPipeline::BusCallbackSync(GstBus *bus, GstMessage *messag
}
GstPadProbeReturn MoodbarPipeline::BufferProbeCallback(GstPad *pad, GstPadProbeInfo *info, gpointer self) {
Q_UNUSED(pad)
MoodbarPipeline *instance = reinterpret_cast<MoodbarPipeline*>(self);
GstBuffer *buffer = gst_pad_probe_info_get_buffer(info);
GstMapInfo map;
gst_buffer_map(buffer, &map, GST_MAP_READ);
instance->data_.append(reinterpret_cast<const char*>(map.data), map.size);
gst_buffer_unmap(buffer, &map);
gst_buffer_unref(buffer);
return GST_PAD_PROBE_OK;
}
void MoodbarPipeline::Stop(const bool success) {
running_ = false;

View File

@@ -63,7 +63,6 @@ class MoodbarPipeline : public QObject {
static void NewPadCallback(GstElement *element, GstPad *pad, gpointer self);
static GstBusSyncReply BusCallbackSync(GstBus *bus, GstMessage *message, gpointer self);
static GstPadProbeReturn BufferProbeCallback(GstPad *pad, GstPadProbeInfo *info, gpointer self);
private:
QUrl url_;
@@ -75,7 +74,6 @@ class MoodbarPipeline : public QObject {
bool success_;
bool running_;
QByteArray data_;
gint buffer_probe_cb_id_;
};
using MoodbarPipelinePtr = QSharedPointer<MoodbarPipeline>;

View File

@@ -51,7 +51,7 @@
#include <QFlags>
#include <QtEvents>
#ifdef HAVE_QPA_QPLATFORMNATIVEINTERFACE
#ifdef HAVE_QT_XCB_QPA_PRIVATE
# include <qpa/qplatformnativeinterface.h>
#endif
@@ -215,7 +215,7 @@ void OSDPretty::ScreenRemoved(QScreen *screen) {
bool OSDPretty::IsTransparencyAvailable() {
#ifdef HAVE_QPA_QPLATFORMNATIVEINTERFACE
#ifdef HAVE_QT_XCB_QPA_PRIVATE
if (qApp && QGuiApplication::platformName() == "xcb"_L1) {
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
QScreen *screen = popup_screen_ == nullptr ? QGuiApplication::primaryScreen() : popup_screen_;