Make Spotify work with gstreamer-1.0.
This commit is contained in:
parent
a2408f7c0e
commit
3f0dc01b06
@ -1,3 +1,3 @@
|
|||||||
# Increment this whenever the user needs to download a new blob
|
# Increment this whenever the user needs to download a new blob
|
||||||
# Remember to upload and sign the new version of the blob.
|
# Remember to upload and sign the new version of the blob.
|
||||||
set(SPOTIFY_BLOB_VERSION 14)
|
set(SPOTIFY_BLOB_VERSION 15)
|
||||||
|
@ -111,6 +111,7 @@ bool MediaPipeline::Init(int sample_rate, int channels) {
|
|||||||
"format", G_TYPE_STRING, format,
|
"format", G_TYPE_STRING, format,
|
||||||
"rate", G_TYPE_INT, sample_rate,
|
"rate", G_TYPE_INT, sample_rate,
|
||||||
"channels", G_TYPE_INT, channels,
|
"channels", G_TYPE_INT, channels,
|
||||||
|
"layout", G_TYPE_STRING, "interleaved",
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
gst_app_src_set_caps(appsrc_, caps);
|
gst_app_src_set_caps(appsrc_, caps);
|
||||||
@ -129,7 +130,7 @@ bool MediaPipeline::Init(int sample_rate, int channels) {
|
|||||||
void MediaPipeline::WriteData(const char* data, qint64 length) {
|
void MediaPipeline::WriteData(const char* data, qint64 length) {
|
||||||
if (!is_initialised()) return;
|
if (!is_initialised()) return;
|
||||||
|
|
||||||
GstBuffer* buffer = gst_buffer_new_and_alloc(length);
|
GstBuffer* buffer = gst_buffer_new_allocate(nullptr, length, nullptr);
|
||||||
GstMapInfo map_info;
|
GstMapInfo map_info;
|
||||||
gst_buffer_map(buffer, &map_info, GST_MAP_WRITE);
|
gst_buffer_map(buffer, &map_info, GST_MAP_WRITE);
|
||||||
|
|
||||||
@ -137,12 +138,10 @@ void MediaPipeline::WriteData(const char* data, qint64 length) {
|
|||||||
|
|
||||||
gst_buffer_unmap(buffer, &map_info);
|
gst_buffer_unmap(buffer, &map_info);
|
||||||
|
|
||||||
GST_BUFFER_OFFSET(buffer) = offset_bytes_;
|
GST_BUFFER_PTS(buffer) = offset_bytes_ * kNsecPerSec / byte_rate_;
|
||||||
GST_BUFFER_TIMESTAMP(buffer) = offset_bytes_ * kNsecPerSec / byte_rate_;
|
|
||||||
GST_BUFFER_DURATION(buffer) = length * kNsecPerSec / byte_rate_;
|
GST_BUFFER_DURATION(buffer) = length * kNsecPerSec / byte_rate_;
|
||||||
|
|
||||||
offset_bytes_ += length;
|
offset_bytes_ += length;
|
||||||
GST_BUFFER_OFFSET_END(buffer) = offset_bytes_;
|
|
||||||
|
|
||||||
gst_app_src_push_buffer(appsrc_, buffer);
|
gst_app_src_push_buffer(appsrc_, buffer);
|
||||||
}
|
}
|
||||||
|
@ -367,27 +367,15 @@ bool GstEnginePipeline::Init() {
|
|||||||
g_object_set(G_OBJECT(queue_), "use-buffering", true, nullptr);
|
g_object_set(G_OBJECT(queue_), "use-buffering", true, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_element_link(queue_, audioconvert_);
|
gst_element_link_many(queue_, audioconvert_, convert_sink, nullptr);
|
||||||
|
|
||||||
// Create the caps to put in each path in the tee. The scope path gets 16-bit
|
// Link the elements with special caps
|
||||||
// ints and the audiosink path gets float32.
|
// The scope path through the tee gets 16-bit ints.
|
||||||
GstCaps* caps16 = gst_caps_new_simple ("audio/x-raw",
|
GstCaps* caps16 = gst_caps_new_simple ("audio/x-raw",
|
||||||
"format", G_TYPE_STRING, "S16LE",
|
"format", G_TYPE_STRING, "S16LE",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
GstCaps* caps32 = gst_caps_new_simple ("audio/x-raw",
|
|
||||||
"format", G_TYPE_STRING, "F32LE",
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (mono_playback_) {
|
|
||||||
gst_caps_set_simple(caps32, "channels", G_TYPE_INT, 1, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Link the elements with special caps
|
|
||||||
gst_element_link_filtered(probe_converter, probe_sink, caps16);
|
gst_element_link_filtered(probe_converter, probe_sink, caps16);
|
||||||
gst_element_link_filtered(audioconvert_, convert_sink, caps32);
|
|
||||||
gst_caps_unref(caps16);
|
gst_caps_unref(caps16);
|
||||||
gst_caps_unref(caps32);
|
|
||||||
|
|
||||||
// Link the outputs of tee to the queues on each path.
|
// Link the outputs of tee to the queues on each path.
|
||||||
gst_pad_link(gst_element_get_request_pad(tee, "src_%u"),
|
gst_pad_link(gst_element_get_request_pad(tee, "src_%u"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user