Ocean
Ocean::Media::ImageFileSequence Class Referenceabstract
Inheritance diagram for Ocean::Media::ImageFileSequence:

Public Member Functions

double duration () const override
 Returns the duration of the finite medium. More...
 
double normalDuration () const override
 Returns the duration without speed consideration. More...
 
double position () const override
 Returns the recent position of the finite medium. More...
 
float speed () const override
 Returns the speed of the finite medium. More...
 
std::string currentUrl () const override
 Returns the url of the current image. More...
 
unsigned int images () const override
 Returns the number of images part of the sequence. More...
 
bool start () override
 Starts the medium. More...
 
bool pause () override
 Pauses the medium. More...
 
bool stop () override
 Stops the medium. More...
 
bool isStarted () const override
 Returns whether the medium is started currently. More...
 
Timestamp startTimestamp () const override
 Returns the start timestamp. More...
 
Timestamp pauseTimestamp () const override
 Returns the pause timestamp. More...
 
Timestamp stopTimestamp () const override
 Returns the stop timestamp. More...
 
bool setPosition (const double position) override
 Sets the recent position of the finit medium. More...
 
bool setSpeed (const float speed) override
 Sets the speed of the finite medium. More...
 
bool forceNextFrame () override
 Forces the loading of the next image in the sequence. More...
 
- Public Member Functions inherited from Ocean::Media::ImageSequence
virtual SequenceMode mode () const
 Returns the mode of this image sequence object. More...
 
virtual unsigned int index () const
 Returns the index of the current image. More...
 
virtual bool setMode (const SequenceMode mode)
 Sets the sequence mode of this image sequence. More...
 
bool setPreferredFramePixelFormat (const FrameType::PixelFormat format) override
 Sets the preferred frame pixel format. More...
 
bool setPreferredFrameFrequency (const FrameFrequency frequency) override
 Sets the preferred frame frequency in Hz. More...
 
- Public Member Functions inherited from Ocean::Media::FiniteMedium
bool loop () const
 Returns whether the medium is played in a loop. More...
 
virtual bool setLoop (const bool value)
 Sets whether the medium has to be played in a loop. More...
 
virtual bool taskFinished () const
 Returns whether a previous task has been finished. More...
 
- Public Member Functions inherited from Ocean::Media::Medium
const std::string & url () const
 Returns the url of the medium. More...
 
bool isValid () const
 Returns whether the medium is valid. More...
 
const std::string & library () const
 Returns the name of the owner library. More...
 
Type type () const
 Returns the type of the medium. More...
 
bool isType (const Type type) const
 Returns whether a medium has a given type. More...
 
bool isExclusive () const
 Returns whether this medium can be use exclusively. More...
 
virtual MediumRef clone () const
 Clones this medium and returns a new independent instance of this medium. More...
 
- Public Member Functions inherited from Ocean::Media::FrameMedium
 ~FrameMedium () override
 Destructs a frame object. More...
 
bool hasFrame () const
 Returns whether the object holds a frame. More...
 
FrameFrequency frameFrequency () const
 Returns the frequency of the frame in Hz. More...
 
virtual FrameRef frame (SharedAnyCamera *anyCamera=nullptr) const
 Returns the most recent frame. More...
 
virtual FrameRef frame (const Timestamp timestamp, SharedAnyCamera *anyCamera=nullptr) const
 Returns the frame with a specific timestamp. More...
 
virtual FrameRef frameTimeout (const double timeout, SharedAnyCamera *anyCamera=nullptr) const
 Waits until the first frame is available. More...
 
virtual bool hasFrame (const Timestamp timestamp) const
 Returns whether this media object currently holds a frame with specified timestamp. More...
 
unsigned int preferredFrameWidth () const
 Returns the preferred width of the frame in pixel. More...
 
unsigned int preferredFrameHeight () const
 Returns the preferred height of the frame in pixel. More...
 
FrameType::PixelFormat preferredFramePixelFormat () const
 Returns the preferred frame pixel format. More...
 
FrameFrequency preferredFrameFrequency () const
 Returns the preferred frame frequency in Hz. More...
 
virtual HomogenousMatrixD4 device_T_camera () const
 Returns the transformation between the camera and device. More...
 
virtual bool setPreferredFrameDimension (const unsigned int width, const unsigned int height)
 Sets the preferred frame dimension. More...
 
size_t capacity () const
 Returns the capacity of the frame history of this frame medium object. More...
 
bool setCapacity (const size_t capacity)
 Sets or changes the capacity of the frame history of this frame medium object. More...
 
FrameCallbackScopedSubscription addFrameCallback (FrameCallbackFunction &&frameCallbackFunction)
 Adds a callback function which is called whenever a new frame arrives. More...
 

Protected Member Functions

 ImageFileSequence (const std::string &url)
 Creates a new image file sequence by a given url. More...
 
 ~ImageFileSequence () override
 Destructs an image file sequence object. More...
 
void threadRun () override
 Thread run function. More...
 
bool determineSequence ()
 Determines the image sequence parameters. More...
 
std::string imageFilename (const unsigned int index) const
 Returns the filename of a specific sequence image. More...
 
virtual bool loadImage (const std::string &filename, const Timestamp timestamp, Frame *frame=nullptr)=0
 Loads a new image specified by the filename. More...
 
- Protected Member Functions inherited from Ocean::Media::ImageSequence
 ImageSequence (const std::string &url)
 Creates a new image sequence by a given url. More...
 
 ~ImageSequence () override
 Destructs an image sequence object. More...
 
- Protected Member Functions inherited from Ocean::Media::FiniteMedium
 FiniteMedium (const std::string &url)
 Creates a new finite medium by a given url. More...
 
- Protected Member Functions inherited from Ocean::Media::Medium
 Medium (const Medium &medium)=delete
 Disabled copy constructor. More...
 
 Medium (const std::string &url)
 Creates a new medium by a given url. More...
 
virtual ~Medium ()
 Destructs a medium. More...
 
Mediumoperator= (const Medium &medium)=delete
 Disabled copy operator. More...
 
- Protected Member Functions inherited from Ocean::Media::FrameMedium
 FrameMedium (const std::string &url)
 Creates a new frame medium by a given url. More...
 
virtual bool deliverNewFrame (Frame &&frame, SharedAnyCamera &&anyCamera=SharedAnyCamera())
 Delivers a new frame to this FrameMedium. More...
 
- Protected Member Functions inherited from Ocean::Thread
 Thread (const Thread &thread)=delete
 Disabled copy constructor. More...
 
void createThread ()
 Creates the thread itself. More...
 
void destroyThread ()
 Destroys the thread itself. More...
 
void stopThreadExplicitly (const unsigned int timeout=5000u)
 Tries to stop the thread gracefully. More...
 
Threadoperator= (const Thread &thread)=delete
 The disabled assign operator. More...
 
 Thread (const std::string &name=std::string())
 Creates a new thread object. More...
 
 Thread (const unsigned int randomNumberSeedValue, const std::string &name=std::string())
 Creates a new thread object. More...
 
virtual ~Thread ()
 Destructs a thread object. More...
 
bool startThread ()
 Starts the thread. More...
 
void stopThread ()
 Informs the thread to stop. More...
 
bool terminateThread ()
 Terminates the thread. More...
 
bool joinThread (const unsigned int timeout=(unsigned int)(-1))
 Waits until this thread has been stopped. More...
 
bool shouldThreadStop () const
 Returns whether this thread should stop. More...
 
bool isThreadInvokedToStart () const
 Returns whether this thread has been invoked to start immediately. More...
 
bool isThreadActive () const
 Returns whether this thread is active. More...
 

Protected Attributes

Timestamp mediumStartTimestamp
 Start timestamp. More...
 
Timestamp mediumPauseTimestamp
 Pause timestamp. More...
 
Timestamp mediumStopTimestamp
 Stop timestamp. More...
 
std::string mediumFilenamePrefix
 Image sequence prefix filename. More...
 
std::string mediumFilenameType
 Image sequence filename type. More...
 
Frame mediumNextFrame
 Next frame in the sequence. More...
 
- Protected Attributes inherited from Ocean::Media::ImageSequence
unsigned int mediumFrameStartIndex
 Index of the first frame. More...
 
unsigned int mediumFrameIndex
 Index of the recent frame. More...
 
unsigned int mediumImages
 Number of sequence frames. More...
 
unsigned int mediumFilenameIndexLength
 State determining whether the sequence filenames have a constant length. More...
 
SequenceMode mediumSequenceMode
 Sequence mode of this image sequence object. More...
 
bool mediumExplicitSequenceModeStarted
 State determining whether the explicit sequence mode has been started. More...
 
- Protected Attributes inherited from Ocean::Media::FiniteMedium
bool loop_ = false
 Determines whether the medium is played in a loop. More...
 
- Protected Attributes inherited from Ocean::Media::Medium
std::string url_
 Url of the medium. More...
 
std::string libraryName_
 Name of the owner library. More...
 
bool isValid_ = false
 Determines whether the medium is valid. More...
 
Type type_ = MEDIUM
 Type of the medium. More...
 
Lock lock_
 Medium lock. More...
 
- Protected Attributes inherited from Ocean::Media::FrameMedium
FrameCollection frameCollection_
 Frame collection storing several frames with different timestamps. More...
 
FrameCallbackHandler frameCallbackHandler_
 The handler for frame callback functions. More...
 
FrameFrequency recentFrameFrequency_ = FrameFrequency(0)
 Frame frequency. More...
 
MediaFrameType preferredFrameType_
 Preferred frame type of the medium. More...
 

Additional Inherited Members

- Public Types inherited from Ocean::Media::ImageSequence
enum  SequenceMode { SM_INVALID , SM_AUTOMATIC , SM_EXPLICIT }
 Defines different sequence modes. More...
 
- Public Types inherited from Ocean::Media::Medium
enum  Type : uint32_t {
  MEDIUM = 0u , FRAME_MEDIUM = 1u << 0u , SOUND_MEDIUM = 1u << 1u , FINITE_MEDIUM = 1u << 2u ,
  LIVE_MEDIUM = 1u << 3u , CONFIG_MEDIUM = 1u << 4u , AUDIO = (1u << 5u) | FINITE_MEDIUM | SOUND_MEDIUM , IMAGE = (1u << 6u) | FRAME_MEDIUM ,
  PIXEL_IMAGE = (1u << 7u) | FRAME_MEDIUM , BUFFER_IMAGE = (1u << 8u) | FRAME_MEDIUM , IMAGE_SEQUENCE = (1u << 9u) | FRAME_MEDIUM | FINITE_MEDIUM , LIVE_AUDIO = (1u << 10u) | LIVE_MEDIUM | SOUND_MEDIUM ,
  LIVE_VIDEO = (1u << 11u) | LIVE_MEDIUM | FRAME_MEDIUM , MICROPHONE = (1u << 12u) | LIVE_MEDIUM , MOVIE = (1u << 13u) | FINITE_MEDIUM | FRAME_MEDIUM | SOUND_MEDIUM
}
 Definition of different medium types. More...
 
- Public Types inherited from Ocean::Media::FrameMedium
typedef double FrameFrequency
 Definition of a frame frequency defined in Hz. More...
 
typedef std::function< void(const Frame &frame, const SharedAnyCamera &camera)> FrameCallbackFunction
 Definition of a callback function for frame events. More...
 
typedef ScopedSubscriptionHandler::ScopedSubscriptionType FrameCallbackScopedSubscription
 Definition of a subscription object for frame callback events. More...
 
- Static Public Member Functions inherited from Ocean::Media::Medium
static std::string convertType (const Type type)
 Converts a medium type to a unique string. More...
 
static Type convertType (const std::string &type)
 Converts a medium type string to a medium type. More...
 
- Static Public Member Functions inherited from Ocean::Media::FrameMedium
static bool syncedFrames (const FrameMediumRefs &frameMediums, const Timestamp lastTimestamp, FrameRefs &frames, SharedAnyCameras &cameras, const unsigned int waitTime=2u, bool *timedOut=nullptr, HomogenousMatricesD4 *device_T_cameras=nullptr)
 Extracts most recent frames from several frame medium objects and ensures that the timestamps of all frames are identical. More...
 
- Static Public Attributes inherited from Ocean::Media::FiniteMedium
static constexpr float AS_FAST_AS_POSSIBLE = 0.0f
 Definition of a speed value allowing to deliver the media content as fast as possible. More...
 
- Protected Types inherited from Ocean::Media::FrameMedium
typedef ScopedSubscriptionCallbackHandlerT< FrameCallbackFunction, FrameMedium, true > FrameCallbackHandler
 Definition of a thread-safe subscription handler for frame callback functions. More...
 
typedef std::vector< MediaFrameTypeFrameTypes
 Definition of a vector holding frame types. More...
 
- Protected Types inherited from Ocean::Thread
typedef std::pair< pthread_t, bool > TimedJoinPair
 Definition of a pair holding a thread id and a boolean state. More...
 
enum  ThreadPriority {
  PRIORITY_IDLE , PRIORTY_BELOW_NORMAL , PRIORTY_NORMAL , PRIORTY_ABOVE_NORMAL ,
  PRIORTY_HIGH , PRIORTY_REALTIME
}
 Definition of different thread priority values. More...
 
- Static Protected Member Functions inherited from Ocean::Thread
static void sleep (unsigned int ms)
 Sleeps the calling thread for a given time. More...
 
static void giveUp ()
 Gives up the remaining thread time. More...
 
static ThreadId currentThreadId ()
 Returns the thread id of the current (calling) thread. More...
 
static ThreadPriority threadPriority ()
 Returns the priority of the current thread. More...
 
static bool setThreadPriority (const ThreadPriority priority)
 Sets the priority of the current thread. More...
 
template<typename TObject , typename TExpectedValue >
static bool waitForValue (TObject &object, const TExpectedValue &expectedValue, const double timeout=-1.0)
 Waits until an object/variable has an expected value. More...
 
template<typename TObject , typename TExpectedValue >
static bool waitForValue (TObject &object, const TExpectedValue &expectedValue, TemporaryScopedLock &temporaryScopedLock, const double timeout=-1.0)
 Waits until an object/variable has an expected value. More...
 
static int pthread_timedjoin_np (pthread_t thread, void **retval, const struct timespec *abstime)
 Implements a thread join function with timeout value. More...
 

Constructor & Destructor Documentation

◆ ImageFileSequence()

Ocean::Media::ImageFileSequence::ImageFileSequence ( const std::string &  url)
explicitprotected

Creates a new image file sequence by a given url.

Parameters
urlUrl of the image

◆ ~ImageFileSequence()

Ocean::Media::ImageFileSequence::~ImageFileSequence ( )
overrideprotected

Destructs an image file sequence object.

Member Function Documentation

◆ currentUrl()

std::string Ocean::Media::ImageFileSequence::currentUrl ( ) const
overridevirtual

Returns the url of the current image.

See also
ImageSequence::currentUrl().

Implements Ocean::Media::ImageSequence.

◆ determineSequence()

bool Ocean::Media::ImageFileSequence::determineSequence ( )
protected

Determines the image sequence parameters.

Returns
True, if succeeded

◆ duration()

double Ocean::Media::ImageFileSequence::duration ( ) const
overridevirtual

Returns the duration of the finite medium.

See also
FiniteMedium::duration().

Implements Ocean::Media::FiniteMedium.

◆ forceNextFrame()

bool Ocean::Media::ImageFileSequence::forceNextFrame ( )
overridevirtual

Forces the loading of the next image in the sequence.

See also
ImageSequence::forceNextFrame().

Implements Ocean::Media::ImageSequence.

◆ imageFilename()

std::string Ocean::Media::ImageFileSequence::imageFilename ( const unsigned int  index) const
protected

Returns the filename of a specific sequence image.

Parameters
indexIndex of the sequence image to create the filename for
Returns
Sequence image filename

◆ images()

unsigned int Ocean::Media::ImageFileSequence::images ( ) const
overridevirtual

Returns the number of images part of the sequence.

See also
ImageSequence::images().

Implements Ocean::Media::ImageSequence.

◆ isStarted()

bool Ocean::Media::ImageFileSequence::isStarted ( ) const
overridevirtual

Returns whether the medium is started currently.

See also
Medium::isStarted().

Implements Ocean::Media::Medium.

◆ loadImage()

virtual bool Ocean::Media::ImageFileSequence::loadImage ( const std::string &  filename,
const Timestamp  timestamp,
Frame frame = nullptr 
)
protectedpure virtual

Loads a new image specified by the filename.

Parameters
filenameFilename of the image to be loaded
timestampFrame timestamp to be used
frameOptional frame receiving the image data, otherwise the frame will be added to the frame container
Returns
True, if succeeded

Implemented in Ocean::Media::WIC::WICImageSequence, Ocean::Media::OpenImageLibraries::OILImageSequence, and Ocean::Media::ImageIO::IIOImageSequence.

◆ normalDuration()

double Ocean::Media::ImageFileSequence::normalDuration ( ) const
overridevirtual

Returns the duration without speed consideration.

See also
FiniteMedium::normalDuration().

Implements Ocean::Media::FiniteMedium.

◆ pause()

bool Ocean::Media::ImageFileSequence::pause ( )
overridevirtual

Pauses the medium.

See also
Medium::pause().

Implements Ocean::Media::Medium.

◆ pauseTimestamp()

Timestamp Ocean::Media::ImageFileSequence::pauseTimestamp ( ) const
overridevirtual

Returns the pause timestamp.

See also
FiniteMedium::pauseTimestamp().

Implements Ocean::Media::Medium.

◆ position()

double Ocean::Media::ImageFileSequence::position ( ) const
overridevirtual

Returns the recent position of the finite medium.

See also
FiniteMedium::position().

Implements Ocean::Media::FiniteMedium.

◆ setPosition()

bool Ocean::Media::ImageFileSequence::setPosition ( const double  position)
overridevirtual

Sets the recent position of the finit medium.

See also
FiniteMedium::setPosition().

Reimplemented from Ocean::Media::FiniteMedium.

◆ setSpeed()

bool Ocean::Media::ImageFileSequence::setSpeed ( const float  speed)
overridevirtual

Sets the speed of the finite medium.

The speed of an image sequence is identical with the preferred frame rate (fps).

Parameters
speedThe speed to be set in fps, with range [0, infinity)
See also
setPreferredFrameFrequency().

Reimplemented from Ocean::Media::FiniteMedium.

◆ speed()

float Ocean::Media::ImageFileSequence::speed ( ) const
overridevirtual

Returns the speed of the finite medium.

The speed of an image sequence is identical with the preferred frame rate (fps).

Returns
The current speed of this image sequence in fps, with range [0, infinity)

Implements Ocean::Media::FiniteMedium.

◆ start()

bool Ocean::Media::ImageFileSequence::start ( )
overridevirtual

Starts the medium.

See also
Medium::start().

Implements Ocean::Media::Medium.

◆ startTimestamp()

Timestamp Ocean::Media::ImageFileSequence::startTimestamp ( ) const
overridevirtual

Returns the start timestamp.

See also
FiniteMedium::startTimestamp().

Implements Ocean::Media::Medium.

◆ stop()

bool Ocean::Media::ImageFileSequence::stop ( )
overridevirtual

Stops the medium.

See also
Medium::stop().

Implements Ocean::Media::Medium.

◆ stopTimestamp()

Timestamp Ocean::Media::ImageFileSequence::stopTimestamp ( ) const
overridevirtual

Returns the stop timestamp.

See also
FiniteMedium::stopTimestamp().

Implements Ocean::Media::Medium.

◆ threadRun()

void Ocean::Media::ImageFileSequence::threadRun ( )
overrideprotectedvirtual

Thread run function.

See also
Thread::threadRun().

Implements Ocean::Thread.

Field Documentation

◆ mediumFilenamePrefix

std::string Ocean::Media::ImageFileSequence::mediumFilenamePrefix
protected

Image sequence prefix filename.

◆ mediumFilenameType

std::string Ocean::Media::ImageFileSequence::mediumFilenameType
protected

Image sequence filename type.

◆ mediumNextFrame

Frame Ocean::Media::ImageFileSequence::mediumNextFrame
protected

Next frame in the sequence.

◆ mediumPauseTimestamp

Timestamp Ocean::Media::ImageFileSequence::mediumPauseTimestamp
protected

Pause timestamp.

◆ mediumStartTimestamp

Timestamp Ocean::Media::ImageFileSequence::mediumStartTimestamp
protected

Start timestamp.

◆ mediumStopTimestamp

Timestamp Ocean::Media::ImageFileSequence::mediumStopTimestamp
protected

Stop timestamp.


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