17#ifndef AGXDATA_TRACK_H
18#define AGXDATA_TRACK_H
28#include <condition_variable>
143 agx::UInt getAccumulatedNumBytes()
const;
148 agx::UInt getAccumulatedNumFrames()
const;
174 bool isInputEOF()
const;
189 bool getEnableLooping()
const;
214 bool hasJumped()
const;
258 FrameRef _popFrame();
259 void finalizePop(Frame *frame);
260 void flush(
bool force,
bool needLock);
264 void updateDataRate(Frame *frame);
280 bool waitForFreeSlot();
287 typedef std::pair<FrameRef, FrameList::iterator> FrameEntry;
295 FrameCache(
const FrameCache& other);
297 FrameCache& operator= (
const FrameCache& other);
299 void addFrame(Frame *frame);
302 void evictFrame(Frame *frame);
327 FrameCache m_frameCache;
328 FrameList m_frameQueue;
333 ExceptionHandler m_exceptionHandler;
335 mutable std::mutex m_mutex;
336 std::mutex m_outputVectorMutex;
337 std::mutex m_jumpMutex;
339 std::condition_variable_any m_hasFramesCondition;
340 std::atomic<bool> m_hasFramesForceOpen;
341 std::condition_variable_any m_hasFreeSlotsCondition;
342 std::atomic<bool> m_hasFreeSlotsForceOpen;
344 InputThreadRef m_inputThread;
345 OutputThreadRef m_outputThread;
351 bool m_enableLooping;
362 ThreadRef m_exceptionThread;
365 FrameRef m_expandedFrame;
418 std::atomic<bool> m_running;
419 std::atomic<bool> m_active;
472 std::lock_guard<std::mutex> lock(m_mutex);
#define AGX_DECLARE_POINTER_TYPES(type)
The FrameReader reads frames from an external source.
The FrameWriter writes frames to an external target.
OutputThread(Track *track)
Thread(Track *track, agx::Callback entryPoint, const agx::Name &="Thread")
void deactivate()
Deactivate the thread.
void start(bool activate=true)
Start the thread, and optionally activate it.
void stop()
Stop the thread.
void activate()
Activate the thread.
void loadCache(Track *other)
Load cached frames from another track.
agx::Real getActiveTimeRangeStart() const
agx::RealModeEnum getRealMode() const
agx::UInt getFrameStride() const
Track(const agx::Name &name="Track")
void pushFrame(Frame *frame)
agx::UInt getNumCachedBytes() const
void setOutput(FrameWriter *output)
Specify the output stream.
agx::UInt getAccumulatedNumFrames() const
void flush(bool force=false)
Flush all frames to the registered outputs.
FrameRef popFrame(bool blocking=true)
static agx::Model * ClassModel()
bool jumpToTime(agx::Real time)
bool getExpandFrames() const
FrameWriter * getOutput()
bool isQueueEmpty() const
Determine if the track is empty.
agx::Real setFrameFrequency(agx::Real frequency)
Set the frame stride using a frequency, which is converted to a stride.
void setFrameStride(agx::UInt stride)
Set frame stride.
void start()
Start the track, producing frames from the input and consuming frames at the outputs.
bool jumpToFrame(agx::UInt frameIndex)
Select which frame that should be returned by the next call to 'readFrame'.
agx::Real getDataRate() const
agx::UInt getNumCachedFrames() const
agx::UInt getNumQueuedFrames() const
void setInput(FrameReader *input)
Set the input stream.
FrameEvent pushFrameEvent
agx::Real getActiveTimeRangeEnd() const
void setEnableLooping(bool flag)
Set to true to enable looping from the input.
void stop()
Stop frame production.
agx::Event1< Frame * > FrameEvent
agx::UInt getNumQueuedBytes() const
void setActiveTimeRangeStart(agx::Real time)
void setActiveTimeRangeEnd(agx::Real time)
agx::UInt getAccumulatedNumBytes() const
agx::UInt getMaxNumBytes() const
void setRealMode(agx::RealModeEnum mode)
Set the real mode.
agx::Callback2< Track *, std::exception & > ExceptionHandler
void setExceptionHandler(const ExceptionHandler &handler)
Specify an exception handler.
void setExpandFrames(bool flag)
Set to true to expand all partial frames to keyframes.
Track(FrameReader *input, FrameWriter *output)
const ExceptionHandler & getExceptionHandler() const
void setMaxNumBytes(agx::UInt numBytes)
Set the maximum number of bytes in the frame cache.
bool getEnableLooping() const
Basic wrapper class aroud std::thread.
Block synchronization primitive.
Templated callback with two arguments.
Generalized callback, using std::function.
A component is an object containing other objects, enabling hierarchical structuring.
An event with one argument.
Inheritance with partial specialization due to bug with ref_ptr containers.
A model is an abstract representation of the class of an agx::Object.
Representation of a name string.
agx::Object is a refcounted object with a name.
The Timer class permits timing execution speed with the same refinement as the built in hardware cloc...
Contains classes for low level data storage for AGX.
RealModeEnum
The data type for basic floating point representation.