spotifyaudiosrc usage
Jonas Kvinge
jonaski at opensuse.org
Fri Jun 3 18:23:23 UTC 2022
Hi,
I'm trying to use spotifyaudiosrc.
I use playbin in a music player with a custom audio sink setup using a
bin. The basic pipeline is: queue2 ! audioconvert ! audiosink where I
add the queue to the bin using a ghost pad then set the bin on the
playbin pipeline. I assume I can not use playbin with spotifyaudiosrc so
I have to set up a different pipeline when playing spotify songs?
I tried the following code:
gst_init(nullptr, nullptr); GstElement *spotifyaudiosrc =
gst_element_factory_make("spotifyaudiosrc", "spotifyaudiosrc0");
g_object_set(G_OBJECT(spotifyaudiosrc), "track",
"spotify:track:3i3P1mGpV9eRlfKccjDjwi", nullptr);
g_object_set(G_OBJECT(spotifyaudiosrc), "username", "user", nullptr);
g_object_set(G_OBJECT(spotifyaudiosrc), "password", "pass", nullptr);
GstElement *oggdemux = gst_element_factory_make("oggdemux",
"oggdemux0"); g_signal_connect(G_OBJECT(oggdemux), "pad-added",
G_CALLBACK(&PadAdded), this); GstElement *vorbisdec =
gst_element_factory_make("vorbisdec", "vorbisdec0"); GstElement
*audioconverter = gst_element_factory_make("audioconvert",
"audioconvert0"); vorbisdec_ = vorbisdec; GstElement *audiosink =
gst_element_factory_make("alsasink", "alsasink");
g_object_set(G_OBJECT(audiosink), "device", "hw:1,0", nullptr);
gst_element_link(spotifyaudiosrc, oggdemux); gst_element_link(oggdemux,
vorbisdec); gst_element_link(vorbisdec, audioconverter);
gst_element_link(audioconverter, audiosink);
gst_element_set_state(spotifyaudiosrc, GST_STATE_PLAYING);
I'm getting the following error:
0:00:24.458653596 15953 0x670b60 INFO GST_ELEMENT_PADS
gstelement.c:1013:gst_element_get_static_pad: no such pad 'sink' in
element "spotifyaudiosrc0"
The pad-added signal is never emitted.
The following works:
pipeline_ = gst_parse_launch("spotifyaudiosrc username= password=
track=spotify:track:3i3P1mGpV9eRlfKccjDjwi ! oggdemux ! vorbisdec !
audioconvert ! alsasink device=hw:1,0", &gst_error);
Jonas
More information about the gstreamer-devel
mailing list