libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
MediaPipeline Class Reference

Owns a MediaGraph and orchestrates pipeline processing. More...

#include <mediapipeline.h>

Inheritance diagram for MediaPipeline:
Collaboration diagram for MediaPipeline:

Public Types

enum  State {
  Stopped , Starting , Running , Paused ,
  Stopping , ErrorState
}
 Pipeline lifecycle state. More...
 
- Public Types inherited from ObjectBase
using SlotVariantFunc = std::function< void(const VariantList &)>
 Function type for invoking a slot with a list of Variants.
 

Public Member Functions

 MediaPipeline (ObjectBase *parent=nullptr)
 Constructs a MediaPipeline.
 
virtual ~MediaPipeline ()
 Destructor. Stops the pipeline if running.
 
MediaGraphgraph ()
 Returns the managed graph.
 
const MediaGraphgraph () const
 Returns the managed graph (const).
 
ThreadPoolthreadPool ()
 Returns the thread pool used for processing.
 
void setThreadPool (ThreadPool *pool)
 Sets an external thread pool to use instead of the internal one.
 
Error start ()
 Validates the graph, configures all nodes, and starts processing.
 
Error stop ()
 Stops all nodes and waits for processing to complete.
 
Error pause ()
 Pauses processing.
 
Error resume ()
 Resumes processing from a paused state.
 
State state () const
 Returns the current pipeline state.
 
 PROMEKI_SIGNAL (stateChanged, State)
 Emitted when the pipeline state changes.
 
 PROMEKI_SIGNAL (errorOccurred, Error)
 Emitted when an error occurs in the pipeline.
 
 PROMEKI_SIGNAL (started)
 Emitted when the pipeline has started.
 
 PROMEKI_SIGNAL (stopped)
 Emitted when the pipeline has stopped.
 
- Public Member Functions inherited from ObjectBase
 ObjectBase (ObjectBase *p=nullptr)
 Default ObjectBase constructor.
 
virtual ~ObjectBase ()
 Destructor. Emits aboutToDestroy, detaches from parent, and destroys children.
 
ObjectBaseparent () const
 Returns the parent object, if one. nullptr if none.
 
void setParent (ObjectBase *p)
 Sets the parent of this object. If the object already has a parent, it will be removed as a child from the old parent and added as a child to the new one.
 
const ObjectBaseListchildList () const
 Returns a list of children of this object.
 
template<typename... Args>
int registerSlot (Slot< Args... > *slot)
 Registers a slot with this object and assigns it an ID.
 
EventLoopeventLoop () const
 Returns the EventLoop this object is affiliated with.
 
void moveToThread (EventLoop *loop)
 Changes the EventLoop affinity of this object.
 
int startTimer (unsigned int intervalMs, bool singleShot=false)
 Starts a timer on this object's EventLoop.
 
void stopTimer (int timerId)
 Stops a timer previously started with startTimer().
 
template<typename... Args>
PROMEKI_NAMESPACE_BEGIN void connect (Signal< Args... > *signal, Slot< Args... > *slot)
 

Additional Inherited Members

- Static Public Member Functions inherited from ObjectBase
static const MetaInfometaInfo ()
 Returns the MetaInfo for the ObjectBase class.
 
template<typename... Args>
static void connect (Signal< Args... > *signal, Slot< Args... > *slot)
 connects a signal and slot together. This function assumes both the signal and slot exist in a ObjectBase or derived object
 
- Public Attributes inherited from ObjectBase
Signal< ObjectBase * > aboutToDestroySignal = Signal< ObjectBase * >(this, aboutToDestroySignalName)
 
- Static Public Attributes inherited from ObjectBase
static constexpr const charaboutToDestroySignalName = PROMEKI_STRINGIFY( aboutToDestroy ) "(" PROMEKI_STRINGIFY_ARGS( ObjectBase * ) ")"
 
static SignalMeta aboutToDestroySignalMeta = SignalMeta(metaInfo(), aboutToDestroySignalName)
 
- Protected Member Functions inherited from ObjectBase
ObjectBasesignalSender ()
 Returns the ObjectBase that emitted the signal currently being handled.
 
virtual void event (Event *e)
 Called by EventLoop to deliver events to this object.
 
virtual void timerEvent (TimerEvent *e)
 Called when a timer fires for this object.
 

Detailed Description

Owns a MediaGraph and orchestrates pipeline processing.

MediaPipeline manages the execution of a media processing graph. It validates the graph, configures all nodes, and schedules processing using a thread pool. The processing model is back-pressure driven: source nodes run continuously gated by downstream queue depth, and only timing-aware sink nodes manage real-time pacing.

Member Enumeration Documentation

◆ State

Pipeline lifecycle state.

Enumerator
Stopped 

Pipeline is not running.

Starting 

Pipeline is starting up (configuring nodes).

Running 

Pipeline is actively processing.

Paused 

Pipeline is paused.

Stopping 

Pipeline is shutting down.

ErrorState 

An error has occurred.

Constructor & Destructor Documentation

◆ MediaPipeline()

MediaPipeline::MediaPipeline ( ObjectBase parent = nullptr)

Constructs a MediaPipeline.

Parameters
parentOptional parent object.

Member Function Documentation

◆ pause()

Error MediaPipeline::pause ( )

Pauses processing.

Returns
Error::Ok on success.

◆ resume()

Error MediaPipeline::resume ( )

Resumes processing from a paused state.

Returns
Error::Ok on success.

◆ setThreadPool()

void MediaPipeline::setThreadPool ( ThreadPool pool)
inline

Sets an external thread pool to use instead of the internal one.

Parameters
poolThe thread pool. Ownership is not transferred.

◆ start()

Error MediaPipeline::start ( )

Validates the graph, configures all nodes, and starts processing.

Returns
Error::Ok on success, or an error describing the failure.

◆ stop()

Error MediaPipeline::stop ( )

Stops all nodes and waits for processing to complete.

Returns
Error::Ok on success.

The documentation for this class was generated from the following file: