Ocean
Ocean::Media::MovieFrameProvider Class Reference

This class implements a frame provider for movie mediums. More...

Inheritance diagram for Ocean::Media::MovieFrameProvider:

Public Types

enum  EventType {
  ET_INVALID , ET_NEW_MEDIA , ET_PREVIEW_COMPLETED , ET_FRAME_SIZE_CHANGED ,
  ET_REQUESTED_FRAME_FAILED
}
 Definition of individual event types. More...
 
typedef Callback< void, const unsigned int, const bool > FrameCallback
 Definition of frame callback function. More...
 
typedef Callback< void, const unsigned int > PreviewFrameCallback
 Definition of a preview frame callback function. More...
 
typedef Callback< void, const EventType, const unsigned long long > EventCallback
 Definition of an event callback function. More...
 
typedef IndexPair32 Dimension
 Definition of a pair of sizes. More...
 

Public Member Functions

 MovieFrameProvider (const bool enabled=true, const unsigned int maximalFrameStorage=150u, const unsigned int maximalQueueStorage=50u)
 Creates a new movie frame provider. More...
 
 ~MovieFrameProvider () override
 Destructs the movie frame provider. More...
 
bool isEnabled () const
 Returns whether the provider is enabled. More...
 
bool setEnabled (const bool state)
 Enables or disables the provider. More...
 
std::string url () const
 Returns the url of the media. More...
 
bool setMovie (const MovieRef &movie)
 Sets the movie providing the frames. More...
 
bool setPreferredFrameType (const FrameType::PixelFormat pixelFormat, const FrameType::PixelOrigin pixelOrigin)
 Sets the preferred frame type of the frames of this provider. More...
 
bool setPreferredPreviewDimension (const unsigned int width, const unsigned int height)
 Sets the dimension of the preview frames. More...
 
double duration () const
 Returns the current duration of the media in seconds. More...
 
Dimension frameDimension () const
 Returns the frame dimension of the frames of this provider. More...
 
const FrameTypeframeType () const
 Returns the frame type of the frames of this provider. More...
 
Dimension preferredPreviewDimension () const
 Returns the preferred frame dimension of the preview frames. More...
 
size_t frameCapacity () const
 Returns the capacity of frames that can be stored concurrently. More...
 
bool setFrameCapacity (const size_t capacity)
 Sets or changes the capacity of the frames to be stored concurrently. More...
 
void addFrameCallback (const FrameCallback &callback)
 Adds a new frame callback event function. More...
 
void addPreviewFrameCallback (const PreviewFrameCallback &callback)
 Adds a new preview frame callback event function. More...
 
void addEventCallback (const EventCallback &callback)
 Adds a new event callback event function. More...
 
void removeFrameCallback (const FrameCallback &callback)
 Removes a frame callback event function. More...
 
void removePreviewFrameCallback (const PreviewFrameCallback &callback)
 Removes a preview frame callback event function. More...
 
void removeEventCallback (const EventCallback &callback)
 Removes an event callback event function. More...
 
unsigned int actualFrameNumber ()
 Returns the number of frames the media actually provides. More...
 
unsigned int estimatedFrameNumber ()
 Returns the estimated number of frames that can be provided. More...
 
unsigned int currentFrameNumber ()
 Returns the current number of frames that can be provided. More...
 
unsigned int frameNumber ()
 Returns the best guess of the number of frames of this provider. More...
 
FrameRef synchronFrameRequest (const unsigned int index, const double timeout=10.0, bool *abort=nullptr)
 Requests a frame synchronously. More...
 
void asynchronFrameRequest (const unsigned int index, const bool priority=true)
 Requests a frame asynchronously. More...
 
FrameRef frame (const unsigned index)
 Returns a frame directly if the frame is currently available. More...
 
FrameRef frameRequest (const unsigned int index)
 Returns a frame directly if the frame is currently available, otherwise the frame will be requested asynchronously (by internally calling asynchronously). More...
 
FrameRef previewFrame (const unsigned int index)
 Returns a preview frame. More...
 
FrameRefs previewFrames (const unsigned int index, const unsigned int size, const unsigned int zoom=1u)
 Returns several preview frames. More...
 
Dimension determinePreviewDimensions () const
 Determines the current preview dimension for the current frame size and specified preferred preview dimension. More...
 
unsigned int previewProgress () const
 Returns the preview progress of this frame provider. More...
 

Protected Member Functions

void release ()
 Releases the frame provider. More...
 
void threadRun () override
 Thread run function. More...
 
void onPreviewFrame (const Frame &frame, const SharedAnyCamera &camera)
 Internal event function for new preview frames. More...
 
void onFrame (const Frame &frame, const SharedAnyCamera &camera)
 Internal event function for new frames. More...
 
bool handlePreviewFrame (const Frame &frame, unsigned int index, const unsigned int previewWidth, const unsigned int previewHeight)
 Creates a new preview frame by a given original frame. More...
 
unsigned int timestamp2index (const double timestamp, const bool lookup=false)
 Determines the frame index for a given timestamp. More...
 
double index2timestamp (const unsigned int index)
 Converts the index of a frame into the corresponding timestamp. 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

bool enabled_ = false
 Provider enabled state. More...
 
bool released_ = false
 State that is set directly if the provider has been invoked to be disposed. More...
 
MovieRef moviePreview_
 Movie providing the preview frames. More...
 
MovieRef movie_
 Movie providing the frames. More...
 
FrameMedium::FrameCallbackScopedSubscription scopedSubscriptionPreviewFrames_
 The subscription objects for previewing frame callback events. More...
 
FrameMedium::FrameCallbackScopedSubscription scopedSubscriptionFrames_
 The subscription objects for frame callback events. More...
 
double mediaDuration_ = 0.0
 Duration of the media in seconds. More...
 
double mediaFrameFrequency_ = 0.0
 Frequency of the media in Hz. More...
 
double mediaFrameTime_ = 0.0
 Average time for one frame in the media. More...
 
unsigned int actualFrameNumber_ = 0u
 Actual number of frames that the provider organizes. More...
 
unsigned int estimatedFrameNumber_ = 0u
 Estimated number of frames that the provider will organize. More...
 
unsigned int currentFrameNumber_ = 0u
 Number of frames that the provider currently organizes. More...
 
unsigned int maximalQueueSize_ = 0u
 Maximal size of the internal intermediate frame queues. More...
 
FrameType::PixelFormat preferredPixelFormat_ = FrameType::FORMAT_UNDEFINED
 The preferred pixel format of the provider's frames. More...
 
FrameType::PixelOrigin preferredPixelOrigin_ = FrameType::ORIGIN_INVALID
 The preferred pixel origin of the provider's frames. More...
 
FrameQueue previewFrameQueue_
 Intermediate queue for preview frames. More...
 
FrameQueue frameQueue_
 Intermediate queue for frames. More...
 
FrameDatabase frames_
 Database holding the media frames. More...
 
PreviewFrames previewFrames_
 Vector holding the preview frames. More...
 
RequestList requestList_
 List of frames that are explicitly requested. More...
 
FrameType frameType_
 Frame type of the media frames. More...
 
unsigned int preferredPreviewWidth_ = 0u
 Preferred width of the preview frames in pixel. More...
 
unsigned int preferredPreviewHeight_ = 100u
 Preferred height of the preview frames in pixel. More...
 
FrameCallbacks frameCallbacks_
 Frame event callback functions. More...
 
PreviewFrameCallbacks previewFrameCallbacks_
 Preview frame event callback functions. More...
 
EventCallbacks eventCallbacks_
 Event callback functions. More...
 
unsigned int frameRequestIndex_ = (unsigned int)(-1)
 Index of the currently requested frame. More...
 
Timestamp lastFrameEventTimestamp_
 Timestamp as the last frame has been arrived. More...
 
Timestamp movieStopTimestamp_
 Timestamp that stops the standard frame medium. More...
 
double frameRequestTimeout_ = 1.0
 Time period that may exceed until a frame is expected to be unavailable, in seconds, with range (0, infinity) More...
 
Lock lock_
 Provider lock. More...
 
Lock frameLock_
 Frame lock. More...
 

Private Types

typedef RingMapT< unsigned int, FrameRef, false > FrameDatabase
 Definition of a non-thread-safe ring map mapping frame indices to frame references. More...
 
typedef std::pair< bool, FrameRefPreviewFrame
 Definition of a preview frame composed of a finished-state and the frame data. More...
 
typedef std::vector< PreviewFramePreviewFrames
 Definition of a vector holding preview frames. More...
 
typedef std::queue< FrameRefFrameQueue
 Definition of a queue holding frames. More...
 
typedef std::list< unsigned int > RequestList
 Definition of a list holding frame indices. More...
 
typedef ConcurrentCallbacks< FrameCallbackFrameCallbacks
 Definition of a callback container storing frame callbacks. More...
 
typedef ConcurrentCallbacks< PreviewFrameCallbackPreviewFrameCallbacks
 Definition of a callback container storing preview frame callbacks. More...
 
typedef ConcurrentCallbacks< EventCallbackEventCallbacks
 Definition of a callback container storing event callbacks. More...
 

Additional Inherited Members

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

Detailed Description

This class implements a frame provider for movie mediums.

In addition to allowing access to the movie's frame, this provider also allows access to smaller preview frames.

Member Typedef Documentation

◆ Dimension

Definition of a pair of sizes.

◆ EventCallback

typedef Callback<void, const EventType, const unsigned long long> Ocean::Media::MovieFrameProvider::EventCallback

Definition of an event callback function.

The first parameter specifies the event type.
The second parameter holds an optional event parameter.

◆ EventCallbacks

Definition of a callback container storing event callbacks.

◆ FrameCallback

typedef Callback<void, const unsigned int, const bool> Ocean::Media::MovieFrameProvider::FrameCallback

Definition of frame callback function.

The first parameter defines the index of the frame.
The second parameter states whether the frames has been explicitly requested.

◆ FrameCallbacks

Definition of a callback container storing frame callbacks.

◆ FrameDatabase

typedef RingMapT<unsigned int, FrameRef, false> Ocean::Media::MovieFrameProvider::FrameDatabase
private

Definition of a non-thread-safe ring map mapping frame indices to frame references.

◆ FrameQueue

Definition of a queue holding frames.

◆ PreviewFrame

typedef std::pair<bool, FrameRef> Ocean::Media::MovieFrameProvider::PreviewFrame
private

Definition of a preview frame composed of a finished-state and the frame data.

◆ PreviewFrameCallback

Definition of a preview frame callback function.

The first parameter defines the index of the preview frame.

◆ PreviewFrameCallbacks

Definition of a callback container storing preview frame callbacks.

◆ PreviewFrames

Definition of a vector holding preview frames.

◆ RequestList

typedef std::list<unsigned int> Ocean::Media::MovieFrameProvider::RequestList
private

Definition of a list holding frame indices.

Member Enumeration Documentation

◆ EventType

Definition of individual event types.

Enumerator
ET_INVALID 

Invalid event type.

ET_NEW_MEDIA 

New media object assigned, the parameter is zero.

ET_PREVIEW_COMPLETED 

The determination of all preview frames has been completed, the parameter stores the number of frames.

ET_FRAME_SIZE_CHANGED 

The size of the frames has been changed, the parameters stores the width in the upper 32 bit and the height in the lower 32 bit.

ET_REQUESTED_FRAME_FAILED 

A requested frame cannot be delivered, the parameter stores the index of the frame.

Constructor & Destructor Documentation

◆ MovieFrameProvider()

Ocean::Media::MovieFrameProvider::MovieFrameProvider ( const bool  enabled = true,
const unsigned int  maximalFrameStorage = 150u,
const unsigned int  maximalQueueStorage = 50u 
)
explicit

Creates a new movie frame provider.

Parameters
enabledTrue, to enable the provider directly
maximalFrameStorageThe maximal number of frames that will be stored inside the frame provider concurrently
maximalQueueStorageThe maximal number of frames that will be queued inside the frame provider concurrently

◆ ~MovieFrameProvider()

Ocean::Media::MovieFrameProvider::~MovieFrameProvider ( )
override

Destructs the movie frame provider.

Member Function Documentation

◆ actualFrameNumber()

unsigned int Ocean::Media::MovieFrameProvider::actualFrameNumber ( )

Returns the number of frames the media actually provides.

The number of actual frames is unknown until all preview frames have been determined.

Returns
Number of actual frames
See also
estimatedFrameNumber(), currentFrameNumber(), frameNumber().

◆ addEventCallback()

void Ocean::Media::MovieFrameProvider::addEventCallback ( const EventCallback callback)
inline

Adds a new event callback event function.

Each callback has to be removed before this frame provider is disposed.

Parameters
callbackThe callback function to be added
See also
removeEventCallback().

◆ addFrameCallback()

void Ocean::Media::MovieFrameProvider::addFrameCallback ( const FrameCallback callback)
inline

Adds a new frame callback event function.

Each callback has to be removed before this frame provider is disposed.

Parameters
callbackThe callback function to be added
See also
removeFrameCallback().

◆ addPreviewFrameCallback()

void Ocean::Media::MovieFrameProvider::addPreviewFrameCallback ( const PreviewFrameCallback callback)
inline

Adds a new preview frame callback event function.

Each callback has to be removed before this frame provider is disposed.

Parameters
callbackThe callback function to be added
See also
removePreviewFrameCallback().

◆ asynchronFrameRequest()

void Ocean::Media::MovieFrameProvider::asynchronFrameRequest ( const unsigned int  index,
const bool  priority = true 
)

Requests a frame asynchronously.

If the frame is available the frame can be accessed by e.g. the frame() or frameRequest() function.
If a frame event callback has been defined, an event will occur if the requested frame is available.

Parameters
indexThe index of the frame that is requested
priorityTrue, to receive the frame as fast as possible
See also
frame(), frameRequest(), synchronFrameRequest().

◆ currentFrameNumber()

unsigned int Ocean::Media::MovieFrameProvider::currentFrameNumber ( )

Returns the current number of frames that can be provided.

This number is identical to the number of existing preview frames.

Returns
Number of current frames
See also
actualFrameNumber(), estimatedFrameNumber(), frameNumber().

◆ determinePreviewDimensions()

Dimension Ocean::Media::MovieFrameProvider::determinePreviewDimensions ( ) const

Determines the current preview dimension for the current frame size and specified preferred preview dimension.

Returns
Resulting preview dimension, zero if invalid

◆ duration()

double Ocean::Media::MovieFrameProvider::duration ( ) const
inline

Returns the current duration of the media in seconds.

Returns
Duration time in seconds

◆ estimatedFrameNumber()

unsigned int Ocean::Media::MovieFrameProvider::estimatedFrameNumber ( )

Returns the estimated number of frames that can be provided.

This number is an estimation due to the media information and may be an approximation only.

Returns
Number of estimated frames
See also
actualFrameNumber(), currentFrameNumber(), frameNumber().

◆ frame()

FrameRef Ocean::Media::MovieFrameProvider::frame ( const unsigned  index)

Returns a frame directly if the frame is currently available.

If the frame does not exist, nothing happens.

Parameters
indexThe index of the frame that is requested
Returns
Resulting frame, if it currently exists
See also
frameRequest()

◆ frameCapacity()

size_t Ocean::Media::MovieFrameProvider::frameCapacity ( ) const
inline

Returns the capacity of frames that can be stored concurrently.

The capacity does not reflect the preview frames.

Returns
Number of frames
See also
setFrameCapacity().

◆ frameDimension()

MovieFrameProvider::Dimension Ocean::Media::MovieFrameProvider::frameDimension ( ) const
inline

Returns the frame dimension of the frames of this provider.

Returns
Frame dimension, width and height in pixel

◆ frameNumber()

unsigned int Ocean::Media::MovieFrameProvider::frameNumber ( )

Returns the best guess of the number of frames of this provider.

If the actual number of frames is known, this number is returned.
Otherwise the highest value of estimatedFrameNumber() and currentFrameNumber() is returned.

Returns
Number of frames
See also
actualFrameNumber(), estimatedFrameNumber(), currentFrameNumber().

◆ frameRequest()

FrameRef Ocean::Media::MovieFrameProvider::frameRequest ( const unsigned int  index)

Returns a frame directly if the frame is currently available, otherwise the frame will be requested asynchronously (by internally calling asynchronously).

If the frame is requested asynchronously the frame will be provided after this function returns.
If the frame is provided asynchronously, the an event will occur if the requested frame is available.

Parameters
indexThe index of the frame that is requested
Returns
Resulting frame, if it currently exists
See also
frame(), asynchronFrameRequest().

◆ frameType()

const FrameType & Ocean::Media::MovieFrameProvider::frameType ( ) const
inline

Returns the frame type of the frames of this provider.

Returns
Frame type

◆ handlePreviewFrame()

bool Ocean::Media::MovieFrameProvider::handlePreviewFrame ( const Frame frame,
unsigned int  index,
const unsigned int  previewWidth,
const unsigned int  previewHeight 
)
protected

Creates a new preview frame by a given original frame.

Parameters
frameThe frame for that a preview frame has to be created
indexThe index of the given frame
previewWidthWidth of the resulting preview frame in pixel, with range [1, infinity)
previewHeightHeight of the resulting preview frame in pixel, with range [1, infinity)
Returns
True, if succeeded

◆ index2timestamp()

double Ocean::Media::MovieFrameProvider::index2timestamp ( const unsigned int  index)
protected

Converts the index of a frame into the corresponding timestamp.

Parameters
indexThe index for that the timestamp has to be found
Returns
Resulting timestamp, -1 if the index is invalid

◆ isEnabled()

bool Ocean::Media::MovieFrameProvider::isEnabled ( ) const
inline

Returns whether the provider is enabled.

Returns
True, if so

◆ onFrame()

void Ocean::Media::MovieFrameProvider::onFrame ( const Frame frame,
const SharedAnyCamera camera 
)
protected

Internal event function for new frames.

Parameters
frameThe new frame, will be valid
cameraThe camera profile associated with the frame, invalid if unknown

◆ onPreviewFrame()

void Ocean::Media::MovieFrameProvider::onPreviewFrame ( const Frame frame,
const SharedAnyCamera camera 
)
protected

Internal event function for new preview frames.

Parameters
frameThe new preview frame, will be valid
cameraThe camera profile associated with the frame, invalid if unknown

◆ preferredPreviewDimension()

Dimension Ocean::Media::MovieFrameProvider::preferredPreviewDimension ( ) const

Returns the preferred frame dimension of the preview frames.

Returns
Preferred frame dimension, width and high in pixel

◆ previewFrame()

FrameRef Ocean::Media::MovieFrameProvider::previewFrame ( const unsigned int  index)

Returns a preview frame.

The provided index should lie inside the number of expected media frame.

Parameters
indexThe index of the preview frame, with range [0, infinity)
Returns
Resulting preview frame, if it does exist already

◆ previewFrames()

FrameRefs Ocean::Media::MovieFrameProvider::previewFrames ( const unsigned int  index,
const unsigned int  size,
const unsigned int  zoom = 1u 
)

Returns several preview frames.

The provided index should lie inside the number of expected media frame.
A zooming factor may be used to return e.g. each 2nd, 3rd or each 10th preview frame (beginning at the specified index).

Parameters
indexThe index of the first preview frame to be returned
sizeNumber of preview frames to be returned
zoomThe zoom factor, with range [1, infinity)
Returns
Resulting preview frames

◆ previewProgress()

unsigned int Ocean::Media::MovieFrameProvider::previewProgress ( ) const

Returns the preview progress of this frame provider.

Returns
Preview progress in percent

◆ release()

void Ocean::Media::MovieFrameProvider::release ( )
protected

Releases the frame provider.

◆ removeEventCallback()

void Ocean::Media::MovieFrameProvider::removeEventCallback ( const EventCallback callback)
inline

Removes an event callback event function.

Parameters
callbackThe callback function to be removed
See also
addEventCallback().

◆ removeFrameCallback()

void Ocean::Media::MovieFrameProvider::removeFrameCallback ( const FrameCallback callback)
inline

Removes a frame callback event function.

Parameters
callbackThe callback function to be removed
See also
addFrameCallback().

◆ removePreviewFrameCallback()

void Ocean::Media::MovieFrameProvider::removePreviewFrameCallback ( const PreviewFrameCallback callback)
inline

Removes a preview frame callback event function.

Parameters
callbackThe callback function to be removed
See also
addPreviewFrameCallback().

◆ setEnabled()

bool Ocean::Media::MovieFrameProvider::setEnabled ( const bool  state)

Enables or disables the provider.

Parameters
stateTrue, to enable the provider
Returns
True, if succeeded

◆ setFrameCapacity()

bool Ocean::Media::MovieFrameProvider::setFrameCapacity ( const size_t  capacity)

Sets or changes the capacity of the frames to be stored concurrently.

The capacity does not reflect the preview frames.

Parameters
capacityThe capacity to be set, with range [1, infinity)
Returns
True, if succeeded
See also
frameCapacity().

◆ setMovie()

bool Ocean::Media::MovieFrameProvider::setMovie ( const MovieRef movie)

Sets the movie providing the frames.

The movie must be exclusive so that the frame provider can use the movie's resources alone.

Parameters
movieThe movie to set
Returns
True, if succeeded
See also
Medium::isExlusive(), Manager::newMedium().

◆ setPreferredFrameType()

bool Ocean::Media::MovieFrameProvider::setPreferredFrameType ( const FrameType::PixelFormat  pixelFormat,
const FrameType::PixelOrigin  pixelOrigin 
)

Sets the preferred frame type of the frames of this provider.

However, there is no guarantee that this interface will be able to provided the requested frame type.

Parameters
pixelFormatThe preferred pixel format
pixelOriginThe preferred pixel origin
Returns
True, if succeeded

◆ setPreferredPreviewDimension()

bool Ocean::Media::MovieFrameProvider::setPreferredPreviewDimension ( const unsigned int  width,
const unsigned int  height 
)

Sets the dimension of the preview frames.

Only one parameter has to be provided, either the width or the size.
The other parameter has to be zero.

Parameters
widthThe width of each preview frame in pixel, with range [0u, infinity)
heightthe height of each preview frame in pixel, with range [0u, infinity)
Returns
True, if succeeded

◆ synchronFrameRequest()

FrameRef Ocean::Media::MovieFrameProvider::synchronFrameRequest ( const unsigned int  index,
const double  timeout = 10.0,
bool *  abort = nullptr 
)

Requests a frame synchronously.

The function blocks until the requested frame can be provided.
If the frame cannot be provided, the function returns directly after the timeout has been reached or the abort statement has been set.

Parameters
indexThe index of the frame that is requested
timeoutTime period in that the function will wait if the requested frame cannot be provided directly, 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
Requested frame, if it can be provided within the specified timeout period
See also
asynchronFrameRequest().

◆ threadRun()

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

Thread run function.

Implements Ocean::Thread.

◆ timestamp2index()

unsigned int Ocean::Media::MovieFrameProvider::timestamp2index ( const double  timestamp,
const bool  lookup = false 
)
protected

Determines the frame index for a given timestamp.

If the frame preview creation has not been completed yet, the index is incremented with each new function call.

Parameters
timestampTimestamp for that the index has to be determined
lookupTrue, ensure that the index is returned only if a corresponding preview frame exists already
Returns
Resulting frame index

◆ url()

std::string Ocean::Media::MovieFrameProvider::url ( ) const

Returns the url of the media.

Returns
Media url of the media

Field Documentation

◆ actualFrameNumber_

unsigned int Ocean::Media::MovieFrameProvider::actualFrameNumber_ = 0u
protected

Actual number of frames that the provider organizes.

◆ currentFrameNumber_

unsigned int Ocean::Media::MovieFrameProvider::currentFrameNumber_ = 0u
protected

Number of frames that the provider currently organizes.

◆ enabled_

bool Ocean::Media::MovieFrameProvider::enabled_ = false
protected

Provider enabled state.

◆ estimatedFrameNumber_

unsigned int Ocean::Media::MovieFrameProvider::estimatedFrameNumber_ = 0u
protected

Estimated number of frames that the provider will organize.

◆ eventCallbacks_

EventCallbacks Ocean::Media::MovieFrameProvider::eventCallbacks_
protected

Event callback functions.

◆ frameCallbacks_

FrameCallbacks Ocean::Media::MovieFrameProvider::frameCallbacks_
protected

Frame event callback functions.

◆ frameLock_

Lock Ocean::Media::MovieFrameProvider::frameLock_
protected

Frame lock.

◆ frameQueue_

FrameQueue Ocean::Media::MovieFrameProvider::frameQueue_
protected

Intermediate queue for frames.

◆ frameRequestIndex_

unsigned int Ocean::Media::MovieFrameProvider::frameRequestIndex_ = (unsigned int)(-1)
protected

Index of the currently requested frame.

◆ frameRequestTimeout_

double Ocean::Media::MovieFrameProvider::frameRequestTimeout_ = 1.0
protected

Time period that may exceed until a frame is expected to be unavailable, in seconds, with range (0, infinity)

◆ frames_

FrameDatabase Ocean::Media::MovieFrameProvider::frames_
protected

Database holding the media frames.

◆ frameType_

FrameType Ocean::Media::MovieFrameProvider::frameType_
protected

Frame type of the media frames.

◆ lastFrameEventTimestamp_

Timestamp Ocean::Media::MovieFrameProvider::lastFrameEventTimestamp_
protected

Timestamp as the last frame has been arrived.

◆ lock_

Lock Ocean::Media::MovieFrameProvider::lock_
mutableprotected

Provider lock.

◆ maximalQueueSize_

unsigned int Ocean::Media::MovieFrameProvider::maximalQueueSize_ = 0u
protected

Maximal size of the internal intermediate frame queues.

◆ mediaDuration_

double Ocean::Media::MovieFrameProvider::mediaDuration_ = 0.0
protected

Duration of the media in seconds.

◆ mediaFrameFrequency_

double Ocean::Media::MovieFrameProvider::mediaFrameFrequency_ = 0.0
protected

Frequency of the media in Hz.

◆ mediaFrameTime_

double Ocean::Media::MovieFrameProvider::mediaFrameTime_ = 0.0
protected

Average time for one frame in the media.

◆ movie_

MovieRef Ocean::Media::MovieFrameProvider::movie_
protected

Movie providing the frames.

◆ moviePreview_

MovieRef Ocean::Media::MovieFrameProvider::moviePreview_
protected

Movie providing the preview frames.

◆ movieStopTimestamp_

Timestamp Ocean::Media::MovieFrameProvider::movieStopTimestamp_
protected

Timestamp that stops the standard frame medium.

◆ preferredPixelFormat_

FrameType::PixelFormat Ocean::Media::MovieFrameProvider::preferredPixelFormat_ = FrameType::FORMAT_UNDEFINED
protected

The preferred pixel format of the provider's frames.

◆ preferredPixelOrigin_

FrameType::PixelOrigin Ocean::Media::MovieFrameProvider::preferredPixelOrigin_ = FrameType::ORIGIN_INVALID
protected

The preferred pixel origin of the provider's frames.

◆ preferredPreviewHeight_

unsigned int Ocean::Media::MovieFrameProvider::preferredPreviewHeight_ = 100u
protected

Preferred height of the preview frames in pixel.

◆ preferredPreviewWidth_

unsigned int Ocean::Media::MovieFrameProvider::preferredPreviewWidth_ = 0u
protected

Preferred width of the preview frames in pixel.

◆ previewFrameCallbacks_

PreviewFrameCallbacks Ocean::Media::MovieFrameProvider::previewFrameCallbacks_
protected

Preview frame event callback functions.

◆ previewFrameQueue_

FrameQueue Ocean::Media::MovieFrameProvider::previewFrameQueue_
protected

Intermediate queue for preview frames.

◆ previewFrames_

PreviewFrames Ocean::Media::MovieFrameProvider::previewFrames_
protected

Vector holding the preview frames.

◆ released_

bool Ocean::Media::MovieFrameProvider::released_ = false
protected

State that is set directly if the provider has been invoked to be disposed.

◆ requestList_

RequestList Ocean::Media::MovieFrameProvider::requestList_
protected

List of frames that are explicitly requested.

◆ scopedSubscriptionFrames_

FrameMedium::FrameCallbackScopedSubscription Ocean::Media::MovieFrameProvider::scopedSubscriptionFrames_
protected

The subscription objects for frame callback events.

◆ scopedSubscriptionPreviewFrames_

FrameMedium::FrameCallbackScopedSubscription Ocean::Media::MovieFrameProvider::scopedSubscriptionPreviewFrames_
protected

The subscription objects for previewing frame callback events.


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