summaryrefslogtreecommitdiffstats
path: root/src/GSTInput.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-03-31 17:07:38 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-03-31 17:07:38 +0200
commitec75b9e317baf249d67295300bc5308b7c33f4ac (patch)
tree6f43693530b463fc913f7c7153a3f54a43ebd04b /src/GSTInput.h
parenta1eb6cf861d3c1cbd4e6c016be3cbd2a1e3d797d (diff)
downloadODR-AudioEnc-ec75b9e317baf249d67295300bc5308b7c33f4ac.tar.gz
ODR-AudioEnc-ec75b9e317baf249d67295300bc5308b7c33f4ac.tar.bz2
ODR-AudioEnc-ec75b9e317baf249d67295300bc5308b7c33f4ac.zip
Fix GStreamer input, rework ICY-Text write
Diffstat (limited to 'src/GSTInput.h')
-rw-r--r--src/GSTInput.h19
1 files changed, 13 insertions, 6 deletions
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 <string>
+#include <atomic>
+#include <thread>
#include <vector>
#include <cstddef>
#include <cstdint>
@@ -36,10 +38,7 @@
#include "SampleQueue.h"
#include "common.h"
#include "InputInterface.h"
-
-extern "C" {
#include "utils.h"
-}
struct GSTData {
GSTData(SampleQueue<uint8_t>& 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<uint8_t>& 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<uint8_t>& m_samplequeue;
+ mutable std::mutex m_nowplaying_mutex;
+ ICY_TEXT_t m_nowplaying;
+
+ void process();
+ std::atomic<bool> m_fault = ATOMIC_VAR_INIT(false);
+ std::atomic<bool> m_running;
+ std::thread m_thread;
};
#endif // HAVE_GST