6#include <QtCore/QObject>
7#include <QtCore/QSemaphore>
25 using SyncHandler = std::function<GstBusSyncReply(GstMessage* message)>;
27 using Handler = std::function<void(GstMessage* message)>;
29 explicit GstBusPump(QObject* parent =
nullptr);
44 void pumpUntil(GstMessageType types,
const std::function<
bool()>& done,
const QDeadlineTimer& deadline);
51 static GstBusSyncReply _onSync(GstBus* bus, GstMessage* message, gpointer data);
56 QObject* _notifier =
nullptr;
57 bool _syncInstalled =
false;
59 QSemaphore _syncReleased;
struct _GstElement GstElement
void pumpUntil(GstMessageType types, const std::function< bool()> &done, const QDeadlineTimer &deadline)
void drain()
Handles the messages queued now, as the poll fd does.
std::function< void(GstMessage *message)> Handler
The pump's thread.
GstBusPump(QObject *parent=nullptr)
~GstBusPump() override
detach()es.
bool attach(GstElement *pipeline, SyncHandler syncHandler, Handler handler)
GStreamer::GstMessagePtr pop(GstMessageType type)
std::function< GstBusSyncReply(GstMessage *message)> SyncHandler
Posting threads. Returns GST_BUS_DROP for a message it took (and unreffed), GST_BUS_PASS to queue it.
std::unique_ptr< GstBus, GstObjectDeleter > GstBusPtr
std::unique_ptr< GstMessage, GstMessageDeleter > GstMessagePtr