GstEnginePipeline: Set Spotify bitrate to 320

This commit is contained in:
Jonas Kvinge 2024-08-01 23:22:19 +02:00
parent c2a7509e0e
commit d3dd26c596
1 changed files with 11 additions and 7 deletions

View File

@ -1006,14 +1006,18 @@ void GstEnginePipeline::SourceSetupCallback(GstElement *playbin, GstElement *sou
} }
#ifdef HAVE_SPOTIFY #ifdef HAVE_SPOTIFY
if (instance->media_url_.scheme() == QStringLiteral("spotify") && if (instance->media_url_.scheme() == QStringLiteral("spotify")) {
!instance->spotify_username_.isEmpty() && if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "bitrate")) {
g_object_set(source, "bitrate", 2, nullptr);
}
if (!instance->spotify_username_.isEmpty() &&
!instance->spotify_password_.isEmpty() && !instance->spotify_password_.isEmpty() &&
g_object_class_find_property(G_OBJECT_GET_CLASS(source), "username") && g_object_class_find_property(G_OBJECT_GET_CLASS(source), "username") &&
g_object_class_find_property(G_OBJECT_GET_CLASS(source), "password")) { g_object_class_find_property(G_OBJECT_GET_CLASS(source), "password")) {
g_object_set(source, "username", instance->spotify_username_.toUtf8().constData(), nullptr); g_object_set(source, "username", instance->spotify_username_.toUtf8().constData(), nullptr);
g_object_set(source, "password", instance->spotify_password_.toUtf8().constData(), nullptr); g_object_set(source, "password", instance->spotify_password_.toUtf8().constData(), nullptr);
} }
}
#endif #endif
// If the pipeline was buffering we stop that now. // If the pipeline was buffering we stop that now.