Fix compilation errors when compiling without spotify
This commit is contained in:
parent
ac285eeeae
commit
5ee6064a50
@ -18,14 +18,18 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include "bufferconsumer.h"
|
#include "bufferconsumer.h"
|
||||||
|
#include "config.h"
|
||||||
#include "gstelementdeleter.h"
|
#include "gstelementdeleter.h"
|
||||||
#include "gstengine.h"
|
#include "gstengine.h"
|
||||||
#include "gstenginepipeline.h"
|
#include "gstenginepipeline.h"
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "core/utilities.h"
|
#include "core/utilities.h"
|
||||||
#include "internet/internetmodel.h"
|
#include "internet/internetmodel.h"
|
||||||
#include "internet/spotifyserver.h"
|
|
||||||
#include "internet/spotifyservice.h"
|
#ifdef HAVE_SPOTIFY
|
||||||
|
# include "internet/spotifyserver.h"
|
||||||
|
# include "internet/spotifyservice.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
|
|
||||||
@ -128,29 +132,34 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) {
|
|||||||
GstElement* new_bin = NULL;
|
GstElement* new_bin = NULL;
|
||||||
|
|
||||||
if (url.scheme() == "spotify") {
|
if (url.scheme() == "spotify") {
|
||||||
new_bin = gst_bin_new("spotify_bin");
|
#ifdef HAVE_SPOTIFY
|
||||||
|
new_bin = gst_bin_new("spotify_bin");
|
||||||
|
|
||||||
// Create elements
|
// Create elements
|
||||||
GstElement* src = engine_->CreateElement("tcpserversrc", new_bin);
|
GstElement* src = engine_->CreateElement("tcpserversrc", new_bin);
|
||||||
GstElement* gdp = engine_->CreateElement("gdpdepay", new_bin);
|
GstElement* gdp = engine_->CreateElement("gdpdepay", new_bin);
|
||||||
if (!src || !gdp)
|
if (!src || !gdp)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Pick a port number
|
||||||
|
const int port = Utilities::PickUnusedPort();
|
||||||
|
g_object_set(G_OBJECT(src), "host", "127.0.0.1", NULL);
|
||||||
|
g_object_set(G_OBJECT(src), "port", port, NULL);
|
||||||
|
|
||||||
|
// Link the elements
|
||||||
|
gst_element_link(src, gdp);
|
||||||
|
|
||||||
|
// Add a ghost pad
|
||||||
|
GstPad* pad = gst_element_get_static_pad(gdp, "src");
|
||||||
|
gst_element_add_pad(GST_ELEMENT(new_bin), gst_ghost_pad_new("src", pad));
|
||||||
|
gst_object_unref(GST_OBJECT(pad));
|
||||||
|
|
||||||
|
// Tell spotify to start sending data to us.
|
||||||
|
InternetModel::Service<SpotifyService>()->server()->StartPlaybackLater(url.toString(), port);
|
||||||
|
#else // HAVE_SPOTIFY
|
||||||
|
qLog(Error) << "Tried to play a spotify:// url, but spotify support is not compiled in";
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
// Pick a port number
|
|
||||||
const int port = Utilities::PickUnusedPort();
|
|
||||||
g_object_set(G_OBJECT(src), "host", "127.0.0.1", NULL);
|
|
||||||
g_object_set(G_OBJECT(src), "port", port, NULL);
|
|
||||||
|
|
||||||
// Link the elements
|
|
||||||
gst_element_link(src, gdp);
|
|
||||||
|
|
||||||
// Add a ghost pad
|
|
||||||
GstPad* pad = gst_element_get_static_pad(gdp, "src");
|
|
||||||
gst_element_add_pad(GST_ELEMENT(new_bin), gst_ghost_pad_new("src", pad));
|
|
||||||
gst_object_unref(GST_OBJECT(pad));
|
|
||||||
|
|
||||||
// Tell spotify to start sending data to us.
|
|
||||||
InternetModel::Service<SpotifyService>()->server()->StartPlaybackLater(url.toString(), port);
|
|
||||||
} else {
|
} else {
|
||||||
new_bin = engine_->CreateElement("uridecodebin");
|
new_bin = engine_->CreateElement("uridecodebin");
|
||||||
g_object_set(G_OBJECT(new_bin), "uri", url.toEncoded().constData(), NULL);
|
g_object_set(G_OBJECT(new_bin), "uri", url.toEncoded().constData(), NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user