libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
mediaiosource.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_PROAV
13#include <promeki/namespace.h>
14#include <promeki/error.h>
15#include <promeki/frame.h>
16#include <promeki/framenumber.h>
17#include <promeki/framecount.h>
18#include <promeki/mediadesc.h>
19#include <promeki/mediaioport.h>
20#include <promeki/mediaio.h>
22
23PROMEKI_NAMESPACE_BEGIN
24
25class MediaIO;
26class MediaIOPortGroup;
27class MediaIOCommand;
28class MediaIORequest;
29
61class MediaIOSource : public MediaIOPort {
62 PROMEKI_OBJECT(MediaIOSource, MediaIOPort)
63 friend class MediaIO;
64 friend class MediaIOPortGroup;
65 public:
76 MediaIOSource(MediaIOPortGroup *group, int index, const String &name = String());
77
79 ~MediaIOSource() override;
80
82 Role role() const override { return MediaIOPort::Source; }
83
84 // ---- Capacity / status ----
85
94 bool frameAvailable() const;
95
97 int readyReads() const;
98
108 int pendingReads() const;
109
117 int prefetchDepth() const { return _readCache.depth(); }
118
127 void setPrefetchDepth(int n);
128
129 // ---- Format negotiation ----
130
141 Error proposeOutput(const MediaDesc &requested, MediaDesc *achievable,
142 MediaConfig *configDelta = nullptr) const;
143
144 // ---- Read API ----
145
188 MediaIORequest readFrame();
189
200 size_t cancelPending();
201
202 // ---- Navigation (forwards to the port group) ----
203
205 double rate() const;
206
208 void setRate(double r);
209
211 FrameNumber currentFrame() const;
212
214 MediaIORequest seekToFrame(const FrameNumber &frameNumber,
215 MediaIOSeekMode mode = MediaIO_SeekDefault);
216
217 // ---- Signal ----
218
242 PROMEKI_SIGNAL(frameReady);
243
244 private:
245 MediaIOReadCache _readCache{this};
246 // True once a caller has explicitly set the prefetch
247 // depth via @ref setPrefetchDepth — silences the
248 // post-open re-apply of the backend's
249 // @c defaultPrefetchDepth so the user override sticks.
250 bool _prefetchDepthExplicit = false;
251};
252
253PROMEKI_NAMESPACE_END
254
255#endif // PROMEKI_ENABLE_PROAV