libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
mediapipeline.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <atomic>
13#include <promeki/core/error.h>
16
18
29class MediaPipeline : public ObjectBase {
30 PROMEKI_OBJECT(MediaPipeline, ObjectBase)
31 public:
41
47
49 virtual ~MediaPipeline();
50
52 MediaGraph *graph() { return &_graph; }
53
55 const MediaGraph *graph() const { return &_graph; }
56
58 ThreadPool *threadPool() { return _threadPool; }
59
64 void setThreadPool(ThreadPool *pool) { _threadPool = pool; return; }
65
71
77
83
89
91 State state() const { return _state; }
92
95
98
101
104
105 private:
106 MediaGraph _graph;
107 ThreadPool *_threadPool = nullptr;
108 ThreadPool *_ownedPool = nullptr;
109 std::atomic<State> _state{Stopped};
110 std::atomic<bool> _running{false};
111 std::atomic<bool> _paused{false};
112
113 void setState(State state);
114};
115
Lightweight error code wrapper for the promeki library.
Definition error.h:39
Dynamic array container wrapping std::vector.
Definition list.h:40
Directed acyclic graph of MediaNodes connected by MediaLinks.
Definition mediagraph.h:32
Owns a MediaGraph and orchestrates pipeline processing.
Definition mediapipeline.h:29
ThreadPool * threadPool()
Returns the thread pool used for processing.
Definition mediapipeline.h:58
virtual ~MediaPipeline()
Destructor. Stops the pipeline if running.
Error stop()
Stops all nodes and waits for processing to complete.
MediaGraph * graph()
Returns the managed graph.
Definition mediapipeline.h:52
Error start()
Validates the graph, configures all nodes, and starts processing.
MediaPipeline(ObjectBase *parent=nullptr)
Constructs a MediaPipeline.
State
Pipeline lifecycle state.
Definition mediapipeline.h:33
@ Starting
Pipeline is starting up (configuring nodes).
Definition mediapipeline.h:35
@ Stopped
Pipeline is not running.
Definition mediapipeline.h:34
@ Running
Pipeline is actively processing.
Definition mediapipeline.h:36
@ Paused
Pipeline is paused.
Definition mediapipeline.h:37
@ ErrorState
An error has occurred.
Definition mediapipeline.h:39
@ Stopping
Pipeline is shutting down.
Definition mediapipeline.h:38
PROMEKI_SIGNAL(errorOccurred, Error)
Emitted when an error occurs in the pipeline.
Error pause()
Pauses processing.
PROMEKI_SIGNAL(stateChanged, State)
Emitted when the pipeline state changes.
PROMEKI_SIGNAL(stopped)
Emitted when the pipeline has stopped.
State state() const
Returns the current pipeline state.
Definition mediapipeline.h:91
Error resume()
Resumes processing from a paused state.
void setThreadPool(ThreadPool *pool)
Sets an external thread pool to use instead of the internal one.
Definition mediapipeline.h:64
PROMEKI_SIGNAL(started)
Emitted when the pipeline has started.
const MediaGraph * graph() const
Returns the managed graph (const).
Definition mediapipeline.h:55
Base object for promeki.
Definition objectbase.h:129
ObjectBase * parent() const
Returns the parent object, if one. nullptr if none.
Definition objectbase.h:258
General-purpose thread pool for submitting callable tasks.
Definition threadpool.h:44
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19