Ocean
Ocean::Media::ImageSequence Class Referenceabstract

This class is the base class for all image sequences. More...

Inheritance diagram for Ocean::Media::ImageSequence:

Public Types

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...
 

Public Member Functions

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 std::string currentUrl () const =0
 Returns the url of the current image. More...
 
virtual bool setMode (const SequenceMode mode)
 Sets the sequence mode of this image sequence. More...
 
virtual unsigned int images () const =0
 Returns the number of images part of the 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...
 
virtual bool forceNextFrame ()=0
 Forces the loading of the next image in the sequence. More...
 
- Public Member Functions inherited from Ocean::Media::FiniteMedium
virtual double duration () const =0
 Returns the duration of the finite medium. More...
 
virtual double normalDuration () const =0
 Returns the duration without speed consideration. More...
 
virtual double position () const =0
 Returns the recent position of the finite medium. More...
 
virtual float speed () const =0
 Returns the speed of the finite medium. More...
 
bool loop () const
 Returns whether the medium is played in a loop. More...
 
virtual bool setPosition (const double position)
 Sets the recent position of the finite medium. More...
 
virtual bool setSpeed (const float speed)
 Sets the speed of the finite medium. 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...
 
virtual bool isStarted () const =0
 Returns whether the medium is started currently. More...
 
bool isExclusive () const
 Returns whether this medium can be use exclusively. More...
 
virtual bool start ()=0
 Starts the medium. More...
 
virtual bool pause ()=0
 Pauses the medium. More...
 
virtual bool stop ()=0
 Stops the medium. More...
 
virtual Timestamp startTimestamp () const =0
 Returns the start timestamp. More...
 
virtual Timestamp pauseTimestamp () const =0
 Returns the pause timestamp. More...
 
virtual Timestamp stopTimestamp () const =0
 Returns the stop timestamp. 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

 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 Attributes

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

- 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...
 

Detailed Description

This class is the base class for all image sequences.

An image sequence provides a sequence of several images.
This media object will provide all images that are part of the entire image sequence.
Two individual modes exist to receive the images: automatic and explicit.

The automatic mode (default) delivers frames automatically.
By default the image sequence will deliver one frame per second (default fps = 1).
Change the preferred frame rate as desired but be aware the actual frame rate can be lower.
If a frame rate of 0 fps is specified, the medium will pause after each new frame and will need to be restarted afterwards.

The explicit mode does not deliver frames based on a specified frame rate (fps) but provides a new frame each time forceNextFrame() is called.
Thus, the explicit mode allows to receive frames as fast as possible (based on the system performance) or can deliver frames very uneven - whatever is needed.

See also
Image, PixelImage, mode(), setMode(), forceFrame().

Member Enumeration Documentation

◆ SequenceMode

Defines different sequence modes.

Enumerator
SM_INVALID 

Invalid sequence mode.

SM_AUTOMATIC 

Automatic sequence mode, frames will be delivered regarding the preferred fps.

SM_EXPLICIT 

Explicit sequence mode, frames will be delivered by explicit request.

Constructor & Destructor Documentation

◆ ImageSequence()

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

Creates a new image sequence by a given url.

Parameters
urlUrl of the image

◆ ~ImageSequence()

Ocean::Media::ImageSequence::~ImageSequence ( )
overrideprotected

Destructs an image sequence object.

Member Function Documentation

◆ currentUrl()

virtual std::string Ocean::Media::ImageSequence::currentUrl ( ) const
pure virtual

Returns the url of the current image.

Returns
Current image url

Implemented in Ocean::Media::ImageFileSequence.

◆ forceNextFrame()

virtual bool Ocean::Media::ImageSequence::forceNextFrame ( )
pure virtual

Forces the loading of the next image in the sequence.

This function must be called whenever a new frame should be delivered.
Beware: Do not call this function unless the sequence mode is SM_EXPLICIT.

Returns
True, if a new frame will be delivered; False, if the end of the image sequence has been reached or if this medium is invalid

Implemented in Ocean::Media::ImageFileSequence.

◆ images()

virtual unsigned int Ocean::Media::ImageSequence::images ( ) const
pure virtual

Returns the number of images part of the sequence.

Returns
Number of images, with range [0, infinity)
See also
index().

Implemented in Ocean::Media::ImageFileSequence.

◆ index()

virtual unsigned int Ocean::Media::ImageSequence::index ( ) const
virtual

Returns the index of the current image.

The index of the frame may not be related with the digits within the corresponding filename,
as the first available frame of this sequence has index 0.

Returns
Current image index, with range [0, images())
See also
images().

◆ mode()

virtual SequenceMode Ocean::Media::ImageSequence::mode ( ) const
virtual

Returns the mode of this image sequence object.

Returns
Sequence mode, SM_AUTOMATIC by default
See also
forceNextFrame().

◆ setMode()

virtual bool Ocean::Media::ImageSequence::setMode ( const SequenceMode  mode)
virtual

Sets the sequence mode of this image sequence.

The explicit loading is allowed for explicit sequence mode only.

See also
mode(), forceNextFrame().
Returns
True, if succeeded

◆ setPreferredFrameFrequency()

bool Ocean::Media::ImageSequence::setPreferredFrameFrequency ( const FrameFrequency  frequency)
overridevirtual

Sets the preferred frame frequency in Hz.

See also
FrameMedium::setPreferredFrameFrequency().

Reimplemented from Ocean::Media::FrameMedium.

◆ setPreferredFramePixelFormat()

bool Ocean::Media::ImageSequence::setPreferredFramePixelFormat ( const FrameType::PixelFormat  format)
overridevirtual

Sets the preferred frame pixel format.

See also
FrameMedium::setPreferredFramePixelFormat().

Reimplemented from Ocean::Media::FrameMedium.

Field Documentation

◆ mediumExplicitSequenceModeStarted

bool Ocean::Media::ImageSequence::mediumExplicitSequenceModeStarted
protected

State determining whether the explicit sequence mode has been started.

◆ mediumFilenameIndexLength

unsigned int Ocean::Media::ImageSequence::mediumFilenameIndexLength
protected

State determining whether the sequence filenames have a constant length.

◆ mediumFrameIndex

unsigned int Ocean::Media::ImageSequence::mediumFrameIndex
protected

Index of the recent frame.

◆ mediumFrameStartIndex

unsigned int Ocean::Media::ImageSequence::mediumFrameStartIndex
protected

Index of the first frame.

◆ mediumImages

unsigned int Ocean::Media::ImageSequence::mediumImages
mutableprotected

Number of sequence frames.

◆ mediumSequenceMode

SequenceMode Ocean::Media::ImageSequence::mediumSequenceMode
protected

Sequence mode of this image sequence object.


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