Ocean
Ocean::CV::FrameProviderInterface Class Referenceabstract

This class defines an abstract interface allowing to request frames from any kind of frame provider. More...

Inheritance diagram for Ocean::CV::FrameProviderInterface:

Public Types

typedef Callback< void, FrameRef, const unsigned int > FrameCallback
 Definition of a frame request callback function. More...
 
typedef Callback< void, unsigned int > FrameNumberCallback
 Definition of a frame number request callback function. More...
 
typedef Callback< void, const FrameType & > FrameTypeCallback
 Definition of a frame type request callback function. More...
 

Public Member Functions

virtual bool isInitialized ()=0
 Returns whether the internal information of this interface has been initialized already and whether request functions can be handled. More...
 
virtual bool synchronInitializationRequest (const double timeout=120.0, bool *abort=nullptr)
 Waits until this interface has been initialized. More...
 
virtual bool setPreferredFrameType (const FrameType::PixelFormat pixelFormat, const FrameType::PixelOrigin pixelOrigin)=0
 Sets a preferred frame type pixel format and pixel origin for this interface. More...
 
virtual void asynchronFrameRequest (const unsigned int index, const bool priority=false)=0
 Invokes an asynchronous frame request. More...
 
virtual FrameRef synchronFrameRequest (const unsigned int index, const double timeout=10.0, bool *abort=nullptr)=0
 Invokes a synchronous frame request. More...
 
virtual void frameCacheRequest (const unsigned int index, const int range)
 Invokes a suggestion to pre-load or to cache some frames that might be requested soon. More...
 
virtual void asynchronFrameNumberRequest ()=0
 Invokes an asynchronous frame number request. More...
 
virtual unsigned int synchronFrameNumberRequest (const double timeout=10.0, bool *abort=nullptr)=0
 Invokes a synchronous frame number request. More...
 
virtual void asynchronFrameTypeRequest ()=0
 Invokes an asynchronous frame type request. More...
 
virtual FrameType synchronFrameTypeRequest (const double timeout=10.0, bool *abort=nullptr)=0
 Invokes a synchronous frame type request. More...
 
void registerFrameCallback (const FrameCallback &callback)
 Registers a new callback function for asynchronous frame requests. More...
 
void unregisterFrameCallback (const FrameCallback &callback)
 Unregisters an already registered callback function for frame requests. More...
 
void registerFrameNumberCallback (const FrameNumberCallback &callback)
 Registers a new callback function for asynchronous frame number requests. More...
 
void unregisterFrameNumberCallback (const FrameNumberCallback &callback)
 Unregisters an already registered callback function for frame number requests. More...
 
void registerFrameTypeCallback (const FrameTypeCallback &callback)
 Registers a new callback function for asynchronous frame type requests. More...
 
void unregisterFrameTypeCallback (const FrameTypeCallback &callback)
 Unregisters an already registered callback function for frame type requests. More...
 
virtual void release ()
 Releases all associated resources. More...
 

Protected Types

typedef ConcurrentCallbacks< FrameCallbackFrameCallbacks
 Definition of a list that stores frame request callbacks. More...
 
typedef ConcurrentCallbacks< FrameNumberCallbackFrameNumberCallbacks
 Definition of a list that stores frame number request callbacks. More...
 
typedef ConcurrentCallbacks< FrameTypeCallbackFrameTypeCallbacks
 Definition of a list that stores frame type request callbacks. More...
 

Protected Member Functions

 FrameProviderInterface ()=default
 Protected default constructor. More...
 
 FrameProviderInterface (const FrameProviderInterface &frameProviderInterface)=delete
 Disabled copy constructor. More...
 
virtual ~FrameProviderInterface ()
 Releases the interface. More...
 
FrameProviderInterfaceoperator= (const FrameProviderInterface &frameProviderInterface)=delete
 Disabled copy constructor. More...
 

Protected Attributes

FrameCallbacks frameCallbacks_
 A list of frame request callbacks. More...
 
FrameNumberCallbacks frameNumberCallbacks_
 A list of frame number request callbacks. More...
 
FrameTypeCallbacks frameTypeCallbacks_
 A list of frame type request callbacks. More...
 

Friends

class ObjectRef< FrameProviderInterface >
 

Detailed Description

This class defines an abstract interface allowing to request frames from any kind of frame provider.

Member Typedef Documentation

◆ FrameCallback

Definition of a frame request callback function.

A frame request callback is invoked by the interface whenever a requested frame arrives.

◆ FrameCallbacks

Definition of a list that stores frame request callbacks.

◆ FrameNumberCallback

Definition of a frame number request callback function.

◆ FrameNumberCallbacks

Definition of a list that stores frame number request callbacks.

◆ FrameTypeCallback

Definition of a frame type request callback function.

◆ FrameTypeCallbacks

Definition of a list that stores frame type request callbacks.

Constructor & Destructor Documentation

◆ FrameProviderInterface() [1/2]

Ocean::CV::FrameProviderInterface::FrameProviderInterface ( )
protecteddefault

Protected default constructor.

◆ FrameProviderInterface() [2/2]

Ocean::CV::FrameProviderInterface::FrameProviderInterface ( const FrameProviderInterface frameProviderInterface)
protecteddelete

Disabled copy constructor.

Parameters
frameProviderInterfaceObject which would be copied

◆ ~FrameProviderInterface()

virtual Ocean::CV::FrameProviderInterface::~FrameProviderInterface ( )
protectedvirtual

Releases the interface.

At the moment this interface is released all registered resources (callback functions) must be unregistered.

Member Function Documentation

◆ asynchronFrameNumberRequest()

virtual void Ocean::CV::FrameProviderInterface::asynchronFrameNumberRequest ( )
pure virtual

Invokes an asynchronous frame number request.

An already registered frame number request callback function is necessary so that the requested frame number can be delivered eventually.
Beware: There is no guarantee that the requested frame number will be delivered eventually.

See also
synchronFrameNumberRequest().

Implemented in Ocean::Media::MovieFrameProviderInterface, and Ocean::Media::ImageSequenceFrameProviderInterface.

◆ asynchronFrameRequest()

virtual void Ocean::CV::FrameProviderInterface::asynchronFrameRequest ( const unsigned int  index,
const bool  priority = false 
)
pure virtual

Invokes an asynchronous frame request.

The requested frame is identified by the index of the frame.
Even if not frame request callback has been registered, this function can be used to cache the requested frame inside the interface (this might speed up the synchronous frame request).
Beware: There is no guarantee that the requested frame will be delivered eventually, e.g. the requested frame might not exist.

Parameters
indexThe index of the requested frame, should be in the range [0, synchronFrameNumberRequest())
priorityTrue, to request the frame with highest priority
See also
synchronFrameRequest().

Implemented in Ocean::Media::ImageSequenceFrameProviderInterface, and Ocean::Media::MovieFrameProviderInterface.

◆ asynchronFrameTypeRequest()

virtual void Ocean::CV::FrameProviderInterface::asynchronFrameTypeRequest ( )
pure virtual

Invokes an asynchronous frame type request.

An already registered frame type request callback function is necessary so that the requested frame type can be delivered eventually.
Beware: There is no guarantee that the requested frame type will be delivered eventually.

See also
synchronFrameTypeRequest().

Implemented in Ocean::Media::MovieFrameProviderInterface, and Ocean::Media::ImageSequenceFrameProviderInterface.

◆ frameCacheRequest()

virtual void Ocean::CV::FrameProviderInterface::frameCacheRequest ( const unsigned int  index,
const int  range 
)
virtual

Invokes a suggestion to pre-load or to cache some frames that might be requested soon.

However, there is no guarantee that the requested frames will be pre-loaded.
Every provider is responsible to support the frame suggestions as best as possible regarding the overall system performance.

Parameters
indexThe index of the next frame that is suggested, with range [0, asynchronFrameNumberRequest())
rangeThe positive or negative range of frames that are suggested; use a positive range to cache frame with increasing indices, use a negative range to cache frames with decreasing indices

Reimplemented in Ocean::Media::MovieFrameProviderInterface.

◆ isInitialized()

virtual bool Ocean::CV::FrameProviderInterface::isInitialized ( )
pure virtual

Returns whether the internal information of this interface has been initialized already and whether request functions can be handled.

No request function of this interface should be invoked before this interface has been initialized successfully.

Returns
True, if so
See also
synchronInitializationRequest(), setPreferredFrameType().

Implemented in Ocean::Media::MovieFrameProviderInterface, and Ocean::Media::ImageSequenceFrameProviderInterface.

◆ operator=()

FrameProviderInterface& Ocean::CV::FrameProviderInterface::operator= ( const FrameProviderInterface frameProviderInterface)
protecteddelete

Disabled copy constructor.

Parameters
frameProviderInterfaceObject which would be copied
Returns
Reference to this object

◆ registerFrameCallback()

void Ocean::CV::FrameProviderInterface::registerFrameCallback ( const FrameCallback callback)

Registers a new callback function for asynchronous frame requests.

All registered functions will be invoked whenever a requested frame arrives.
Each registered callback must be unregistered when it is not needed anymore or before the system is released.

Parameters
callbackFrame request callback function that will be registered
See also
unregisterFrameCallback().

◆ registerFrameNumberCallback()

void Ocean::CV::FrameProviderInterface::registerFrameNumberCallback ( const FrameNumberCallback callback)

Registers a new callback function for asynchronous frame number requests.

All registered functions will be invoked after a frame number request has been invoked.
Each registered callback must be unregistered when it is not needed anymore or before the system is released.

Parameters
callbackFrame request callback function that will be registered
See also
unregisterFrameCallback().

◆ registerFrameTypeCallback()

void Ocean::CV::FrameProviderInterface::registerFrameTypeCallback ( const FrameTypeCallback callback)

Registers a new callback function for asynchronous frame type requests.

All registered functions will be invoked after a frame type request has been invoked.
Each registered callback must be unregistered when it is not needed anymore or before the system is released.

Parameters
callbackFrame type request callback function that will be registered
See also
unregisterFrameTypeCallback().

◆ release()

virtual void Ocean::CV::FrameProviderInterface::release ( )
virtual

Releases all associated resources.

Beware: The registered callback functions are not released.

Reimplemented in Ocean::Media::MovieFrameProviderInterface.

◆ setPreferredFrameType()

virtual bool Ocean::CV::FrameProviderInterface::setPreferredFrameType ( const FrameType::PixelFormat  pixelFormat,
const FrameType::PixelOrigin  pixelOrigin 
)
pure virtual

Sets a preferred frame type pixel format and pixel origin for this interface.

If a preferred frame type is set and the native frame type can be converted into the requested frame type, all frames of this interface will have the requested type.
However, there is no guarantee that this interface will be able to provided the requested frame type.
Beware: Ensure that this interface has been initialized before calling this function.

Parameters
pixelFormatThe preferred pixel format
pixelOriginThe preferred pixel origin
Returns
True, if succeeded
See also
isInitialized().

Implemented in Ocean::Media::MovieFrameProviderInterface, and Ocean::Media::ImageSequenceFrameProviderInterface.

◆ synchronFrameNumberRequest()

virtual unsigned int Ocean::CV::FrameProviderInterface::synchronFrameNumberRequest ( const double  timeout = 10.0,
bool *  abort = nullptr 
)
pure virtual

Invokes a synchronous frame number request.

This function returns an invalid frame number if the requested frame number cannot be determined within a specified time frame or if the abort statement has been set.

Parameters
timeoutThe time this functions waits at most for the requested frame number, in seconds, with range [0, infinity)
abortOptional abort statement allowing to abort the frame number request at any time; set the value True to abort the request
Returns
Resulting number of frames, 0xFFFFFFFF if the frame number is invalid

Implemented in Ocean::Media::ImageSequenceFrameProviderInterface, and Ocean::Media::MovieFrameProviderInterface.

◆ synchronFrameRequest()

virtual FrameRef Ocean::CV::FrameProviderInterface::synchronFrameRequest ( const unsigned int  index,
const double  timeout = 10.0,
bool *  abort = nullptr 
)
pure virtual

Invokes a synchronous frame request.

The requested frame is identified by the index of the frame.
This function returns an invalid frame if the requested frame cannot be delivered within a specified time frame or the abort statement has been set.

Parameters
indexThe index of the requested frame, should be in the range [0, synchronFrameNumberRequest())
timeoutThe time this functions waits at most for a requested frame, in seconds, with range [0, infinity)
abortOptional abort statement allowing to abort the frame request at any time; set the value True to abort the request
Returns
Resulting frame, if the frame can be delivered within the specified time frame

Implemented in Ocean::Media::ImageSequenceFrameProviderInterface, and Ocean::Media::MovieFrameProviderInterface.

◆ synchronFrameTypeRequest()

virtual FrameType Ocean::CV::FrameProviderInterface::synchronFrameTypeRequest ( const double  timeout = 10.0,
bool *  abort = nullptr 
)
pure virtual

Invokes a synchronous frame type request.

This function returns an invalid frame type if the requested frame type cannot be determined within a specified time frame or if the abort statement has been set.

Parameters
timeoutThe time this functions waits at most for the requested frame type, in seconds, with range [0, infinity)
abortOptional abort statement allowing to abort the frame type request at any time; set the value True to abort the request
Returns
Resulting frame type of this interface

Implemented in Ocean::Media::ImageSequenceFrameProviderInterface, and Ocean::Media::MovieFrameProviderInterface.

◆ synchronInitializationRequest()

virtual bool Ocean::CV::FrameProviderInterface::synchronInitializationRequest ( const double  timeout = 120.0,
bool *  abort = nullptr 
)
virtual

Waits until this interface has been initialized.

Parameters
timeoutThe time this functions waits at most for the initialization, in seconds, with range [0, infinity)
abortOptional abort statement allowing to abort the frame type request at any time; set the value True to abort the request
Returns
True, if the interface is initialized
See also
isInitialized().

◆ unregisterFrameCallback()

void Ocean::CV::FrameProviderInterface::unregisterFrameCallback ( const FrameCallback callback)

Unregisters an already registered callback function for frame requests.

Parameters
callbackThe callback function that will be unregistered
See also
registerFrameCallback().

◆ unregisterFrameNumberCallback()

void Ocean::CV::FrameProviderInterface::unregisterFrameNumberCallback ( const FrameNumberCallback callback)

Unregisters an already registered callback function for frame number requests.

Parameters
callbackThe callback function that will be unregistered
See also
registerFrameNumberCallback().

◆ unregisterFrameTypeCallback()

void Ocean::CV::FrameProviderInterface::unregisterFrameTypeCallback ( const FrameTypeCallback callback)

Unregisters an already registered callback function for frame type requests.

Parameters
callbackThe callback function that will be unregistered
See also
registerFrameTypeCallback().

Friends And Related Function Documentation

◆ ObjectRef< FrameProviderInterface >

friend class ObjectRef< FrameProviderInterface >
friend

Field Documentation

◆ frameCallbacks_

FrameCallbacks Ocean::CV::FrameProviderInterface::frameCallbacks_
protected

A list of frame request callbacks.

◆ frameNumberCallbacks_

FrameNumberCallbacks Ocean::CV::FrameProviderInterface::frameNumberCallbacks_
protected

A list of frame number request callbacks.

◆ frameTypeCallbacks_

FrameTypeCallbacks Ocean::CV::FrameProviderInterface::frameTypeCallbacks_
protected

A list of frame type request callbacks.


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