Signals

Signals are the return channel from a thread backend to the frontend (main thread). The base class is Limef::signal::Signal.

namespace signal

Signalling threads and filterchains.

Typedefs

using SignalClass = std::type_index

Identifies the signal subclass.

Backed by std::type_index, so every concrete Signal subclass gets a unique identity for free (via SIGNAL_CLASS) — no central registry to edit. This means plugins can define their own Signal subclasses (for their own Threads) without ever touching this file.

class BasicSignal : public Limef::signal::Signal
#include <signal.h>

A thread intercom Signal.

A signal that is used by a Thread frontend to intercom with the Thread backend

Public Types

enum class Operation

Thread operation kind.

What kind of operation is required for the thread

Values:

enumerator null

a dummy/placeholder signal

enumerator exit

in-going: request termination

enumerator started

out-going: thread has been started

Public Functions

inline Operation getOperation() const

Return the Limef::BasicSignal::Operation type.

class FlowControlSignal : public Limef::signal::Signal
#include <signal.h>

Flow control signal for framefilter chains.

Used to send control commands (like flush) through framefilter chains. Producer threads send this signal downstream when stopping.

Public Types

enum class Command

Flow control command type.

Values:

enumerator Flush

Flush internal buffers and pass remaining data downstream.

class NullSignal : public Limef::signal::Signal
#include <signal.h>

A dummy/placeholder signal class & a minimal example of creating a new signal class.

class Signal
#include <signal.h>

Signal base class.

Signals are encapsulated into SignalFrames and they are used to inform Thread’s and downstream framefilters about actions and parameters they should do and use.

Use the SIGNAL_CLASS(ClassName) macro in every concrete subclass to implement getSignalClass(), clone(), and staticSignalClass() (used by Signal::as), for example:

class MySignal : public Signal {
    SIGNAL_CLASS(MySignal)
public:
    ...
};

Subclassed by Limef::rtsp::RTSPServerSignal, Limef::signal::BasicSignal, Limef::signal::FlowControlSignal, Limef::signal::NullSignal, Limef::thread::ExampleSignal, Limef::thread::MediaFileSignal, Limef::thread::USBCameraSignal, Limef::thread::WebSocketServerSignal, Limef::webrtc::WebRTCServerSignal

Public Functions

template<typename T>
inline T *as()

Test and cast signal type Tests if the signal is of desired type and if so, cast it to the desider type, otherwise return nullptr, i.e.:

const auto* exampleSignal = signalFrame->asSignal<ExampleSignal>()