Ocean
Loading...
Searching...
No Matches
ImageSequenceFrameProviderInterface.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_MEDIA_IMAGE_SEQUENCE_FRAME_PROVIDER_INTERFACE_H
9#define META_OCEAN_MEDIA_IMAGE_SEQUENCE_FRAME_PROVIDER_INTERFACE_H
10
11#include "ocean/media/Media.h"
13
15
16namespace Ocean
17{
18
19namespace Media
20{
21
22/**
23 * This class implements a frame provider interface specialization using an image sequence medium object.
24 * @see MovieFrameProviderInterface.
25 * @ingroup media
26 */
28{
29 public:
30
31 /**
32 * Creates a new image sequence provider interface.
33 * @param imageSequence Image seqeunce that is used as frame source
34 */
36
37 /**
38 * Destructs this image sequence provider and waits until all asynchronous requests have been processed.
39 */
41
42 /**
43 * Returns whether the internal information of this interface has been initialized already and whether request functions can be handled.
44 * @see CV::FrameProviderInterface::isInitialized().
45 */
46 bool isInitialized() override;
47
48 /**
49 * Sets a preferred frame type pixel format and pixel origin for this interface.
50 * @see CV::FrameProviderInterface::setPreferredFrameType().
51 */
52 bool setPreferredFrameType(const FrameType::PixelFormat pixelFormat, const FrameType::PixelOrigin pixelOrigin) override;
53
54 /**
55 * Invokes an asynchronous frame request.
56 * @see CV::FrameProviderInterface::asynchronFrameRequest().
57 */
58 void asynchronFrameRequest(const unsigned int index, const bool priority = false) override;
59
60 /**
61 * Invokes a synchronous frame request.
62 * @see CV::FrameProviderInterface::synchronFrameRequest().
63 */
64 FrameRef synchronFrameRequest(const unsigned int index, const double timeout = 10.0, bool* abort = nullptr) override;
65
66 /**
67 * Invokes an asynchronous frame number request.
68 * @see CV::FrameProviderInterface::asynchronFrameNumberRequest().
69 */
71
72 /**
73 * Invokes a synchronous frame number request.
74 * @see CV::FrameProviderInterface::synchronFrameNumberRequest().
75 */
76 unsigned int synchronFrameNumberRequest(const double timeout = 10.0, bool* abort = nullptr) override;
77
78 /**
79 * Invokes an asynchronous frame type request.
80 * @see CV::FrameProviderInterface::asynchronFrameTypeRequest().
81 */
83
84 /**
85 * Invokes a synchronous frame type request.
86 * @see CV::FrameProviderInterface::synchronFrameTypeRequest().
87 */
88 FrameType synchronFrameTypeRequest(const double timeout = 10.0, bool* abort = nullptr) override;
89
90 protected:
91
92 /**
93 * Internal function to handle asynchronous frame requests.
94 * @param index The index of the frame that has been requested
95 */
96 void handleAsynchronFrameRequest(const unsigned int index);
97
98 /**
99 * Internal function to handle asynchronous frame number requests.
100 */
102
103 /**
104 * Internal function to handle asynchronous frame type requests.
105 */
107
108 protected:
109
110 /// Image sequence used as frame source.
112
113 /// The number of pending asynchronous requests.
114 unsigned int pendingAsynchronousRequests_ = 0u;
115
116 /// The preferred pixel format of the resulting images, if any.
117 FrameType::PixelFormat preferredPixelFormat_ = FrameType::FORMAT_UNDEFINED;
118
119 /// The preferred pixel origin of the resulting images, if any.
120 FrameType::PixelOrigin preferredPixelOrigin_ = FrameType::ORIGIN_INVALID;
121
122 /// Interface lock.
124};
125
126}
127
128}
129
130#endif // META_OCEAN_MEDIA_IMAGE_SEQUENCE_FRAME_PROVIDER_INTERFACE_H
This class defines an abstract interface allowing to request frames from any kind of frame provider.
Definition FrameProviderInterface.h:38
Definition of a frame type composed by the frame dimension, pixel format and pixel origin.
Definition Frame.h:30
PixelFormat
Definition of all pixel formats available in the Ocean framework.
Definition Frame.h:183
PixelOrigin
Defines different types of frame origin positions.
Definition Frame.h:1046
This class implements a recursive lock object.
Definition Lock.h:31
This class implements a frame provider interface specialization using an image sequence medium object...
Definition ImageSequenceFrameProviderInterface.h:28
void asynchronFrameNumberRequest() override
Invokes an asynchronous frame number request.
void handleAsynchronFrameNumberRequest()
Internal function to handle asynchronous frame number requests.
FrameType synchronFrameTypeRequest(const double timeout=10.0, bool *abort=nullptr) override
Invokes a synchronous frame type request.
unsigned int synchronFrameNumberRequest(const double timeout=10.0, bool *abort=nullptr) override
Invokes a synchronous frame number request.
ImageSequenceRef imageSequence_
Image sequence used as frame source.
Definition ImageSequenceFrameProviderInterface.h:111
~ImageSequenceFrameProviderInterface() override
Destructs this image sequence provider and waits until all asynchronous requests have been processed.
ImageSequenceFrameProviderInterface(const ImageSequenceRef &imageSequence)
Creates a new image sequence provider interface.
Lock lock_
Interface lock.
Definition ImageSequenceFrameProviderInterface.h:123
bool setPreferredFrameType(const FrameType::PixelFormat pixelFormat, const FrameType::PixelOrigin pixelOrigin) override
Sets a preferred frame type pixel format and pixel origin for this interface.
bool isInitialized() override
Returns whether the internal information of this interface has been initialized already and whether r...
void asynchronFrameRequest(const unsigned int index, const bool priority=false) override
Invokes an asynchronous frame request.
void handleAsynchronFrameTypeRequest()
Internal function to handle asynchronous frame type requests.
void asynchronFrameTypeRequest() override
Invokes an asynchronous frame type request.
FrameRef synchronFrameRequest(const unsigned int index, const double timeout=10.0, bool *abort=nullptr) override
Invokes a synchronous frame request.
void handleAsynchronFrameRequest(const unsigned int index)
Internal function to handle asynchronous frame requests.
This template class implements a object reference with an internal reference counter.
Definition base/ObjectRef.h:58
The namespace covering the entire Ocean framework.
Definition Accessor.h:15