From ec75b9e317baf249d67295300bc5308b7c33f4ac Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 31 Mar 2020 17:07:38 +0200 Subject: Fix GStreamer input, rework ICY-Text write --- src/GSTInput.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/GSTInput.h') diff --git a/src/GSTInput.h b/src/GSTInput.h index 07cf62e..4bfae34 100644 --- a/src/GSTInput.h +++ b/src/GSTInput.h @@ -27,6 +27,8 @@ #if HAVE_GST #include +#include +#include #include #include #include @@ -36,10 +38,7 @@ #include "SampleQueue.h" #include "common.h" #include "InputInterface.h" - -extern "C" { #include "utils.h" -} struct GSTData { GSTData(SampleQueue& samplequeue); @@ -47,11 +46,11 @@ struct GSTData { GstElement *pipeline = nullptr; GstElement *uridecodebin = nullptr; GstElement *audio_convert = nullptr; + GstElement *audio_resample = nullptr; GstElement *caps_filter = nullptr; GstElement *app_sink = nullptr; GstBus *bus = nullptr; - GMainLoop *main_loop = nullptr; SampleQueue& samplequeue; }; @@ -72,9 +71,11 @@ class GSTInput : public InputInterface virtual bool read_source(size_t num_bytes) override; + ICY_TEXT_t get_icy_text() const; + int getRate() { return m_rate; } - virtual bool fault_detected(void) const override { return false; }; + virtual bool fault_detected(void) const override { return m_fault; }; private: std::string m_uri; unsigned m_channels; @@ -82,7 +83,13 @@ class GSTInput : public InputInterface GSTData m_gst_data; - SampleQueue& m_samplequeue; + mutable std::mutex m_nowplaying_mutex; + ICY_TEXT_t m_nowplaying; + + void process(); + std::atomic m_fault = ATOMIC_VAR_INIT(false); + std::atomic m_running; + std::thread m_thread; }; #endif // HAVE_GST -- cgit v1.2.3