Ocean
|
This class defines an abstract interface allowing to request frames from any kind of frame provider. More...
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< FrameCallback > | FrameCallbacks |
Definition of a list that stores frame request callbacks. More... | |
typedef ConcurrentCallbacks< FrameNumberCallback > | FrameNumberCallbacks |
Definition of a list that stores frame number request callbacks. More... | |
typedef ConcurrentCallbacks< FrameTypeCallback > | FrameTypeCallbacks |
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... | |
FrameProviderInterface & | operator= (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 > |
This class defines an abstract interface allowing to request frames from any kind of frame provider.
typedef Callback<void, FrameRef, const unsigned int> Ocean::CV::FrameProviderInterface::FrameCallback |
Definition of a frame request callback function.
A frame request callback is invoked by the interface whenever a requested frame arrives.
|
protected |
Definition of a list that stores frame request callbacks.
typedef Callback<void, unsigned int> Ocean::CV::FrameProviderInterface::FrameNumberCallback |
Definition of a frame number request callback function.
|
protected |
Definition of a list that stores frame number request callbacks.
typedef Callback<void, const FrameType&> Ocean::CV::FrameProviderInterface::FrameTypeCallback |
Definition of a frame type request callback function.
|
protected |
Definition of a list that stores frame type request callbacks.
|
protecteddefault |
Protected default constructor.
|
protecteddelete |
Disabled copy constructor.
frameProviderInterface | Object which would be copied |
|
protectedvirtual |
Releases the interface.
At the moment this interface is released all registered resources (callback functions) must be unregistered.
|
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.
Implemented in Ocean::Media::MovieFrameProviderInterface, and Ocean::Media::ImageSequenceFrameProviderInterface.
|
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.
index | The index of the requested frame, should be in the range [0, synchronFrameNumberRequest()) |
priority | True, to request the frame with highest priority |
Implemented in Ocean::Media::ImageSequenceFrameProviderInterface, and Ocean::Media::MovieFrameProviderInterface.
|
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.
Implemented in Ocean::Media::MovieFrameProviderInterface, and Ocean::Media::ImageSequenceFrameProviderInterface.
|
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.
index | The index of the next frame that is suggested, with range [0, asynchronFrameNumberRequest()) |
range | The 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.
|
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.
Implemented in Ocean::Media::MovieFrameProviderInterface, and Ocean::Media::ImageSequenceFrameProviderInterface.
|
protecteddelete |
Disabled copy constructor.
frameProviderInterface | Object which would be copied |
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.
callback | Frame request callback function that will be registered |
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.
callback | Frame request callback function that will be registered |
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.
callback | Frame type request callback function that will be registered |
|
virtual |
Releases all associated resources.
Beware: The registered callback functions are not released.
Reimplemented in Ocean::Media::MovieFrameProviderInterface.
|
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.
pixelFormat | The preferred pixel format |
pixelOrigin | The preferred pixel origin |
Implemented in Ocean::Media::MovieFrameProviderInterface, and Ocean::Media::ImageSequenceFrameProviderInterface.
|
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.
timeout | The time this functions waits at most for the requested frame number, in seconds, with range [0, infinity) |
abort | Optional abort statement allowing to abort the frame number request at any time; set the value True to abort the request |
Implemented in Ocean::Media::ImageSequenceFrameProviderInterface, and Ocean::Media::MovieFrameProviderInterface.
|
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.
index | The index of the requested frame, should be in the range [0, synchronFrameNumberRequest()) |
timeout | The time this functions waits at most for a requested frame, in seconds, with range [0, infinity) |
abort | Optional abort statement allowing to abort the frame request at any time; set the value True to abort the request |
Implemented in Ocean::Media::ImageSequenceFrameProviderInterface, and Ocean::Media::MovieFrameProviderInterface.
|
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.
timeout | The time this functions waits at most for the requested frame type, in seconds, with range [0, infinity) |
abort | Optional abort statement allowing to abort the frame type request at any time; set the value True to abort the request |
Implemented in Ocean::Media::ImageSequenceFrameProviderInterface, and Ocean::Media::MovieFrameProviderInterface.
|
virtual |
Waits until this interface has been initialized.
timeout | The time this functions waits at most for the initialization, in seconds, with range [0, infinity) |
abort | Optional abort statement allowing to abort the frame type request at any time; set the value True to abort the request |
void Ocean::CV::FrameProviderInterface::unregisterFrameCallback | ( | const FrameCallback & | callback | ) |
Unregisters an already registered callback function for frame requests.
callback | The callback function that will be unregistered |
void Ocean::CV::FrameProviderInterface::unregisterFrameNumberCallback | ( | const FrameNumberCallback & | callback | ) |
Unregisters an already registered callback function for frame number requests.
callback | The callback function that will be unregistered |
void Ocean::CV::FrameProviderInterface::unregisterFrameTypeCallback | ( | const FrameTypeCallback & | callback | ) |
Unregisters an already registered callback function for frame type requests.
callback | The callback function that will be unregistered |
|
friend |
|
protected |
A list of frame request callbacks.
|
protected |
A list of frame number request callbacks.
|
protected |
A list of frame type request callbacks.