Ocean
IIOImage.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_IMAGEIO_IIO_IMAGE_H
9 #define META_OCEAN_MEDIA_IMAGEIO_IIO_IMAGE_H
10 
13 
14 #include "ocean/media/Image.h"
15 
16 namespace Ocean
17 {
18 
19 namespace Media
20 {
21 
22 namespace ImageIO
23 {
24 
25 /**
26  * This class implements an image class for ImageIO.
27  * @ingroup mediaiio
28  */
29 class OCEAN_MEDIA_IIO_EXPORT IIOImage :
30  virtual public IIOObject,
31  virtual public Image
32 {
33  friend class IIOLibrary;
34 
35  public:
36 
37  /**
38  * Returns whether the medium is started currently.
39  * @see Medium::isStarted().
40  */
41  bool isStarted() const override;
42 
43  /**
44  * Returns the start timestamp.
45  * @see FiniteMedium::startTimestamp().
46  */
47  Timestamp startTimestamp() const override;
48 
49  /**
50  * Returns the pause timestamp.
51  * @see FiniteMedium::pauseTimestamp().
52  */
53  Timestamp pauseTimestamp() const override;
54 
55  /**
56  * Returns the stop timestamp.
57  * @see FiniteMedium::stopTimestamp().
58  */
59  Timestamp stopTimestamp() const override;
60 
61  /**
62  * Clones this medium and returns a new independent instance of this medium.
63  * @see Medium::clone().
64  */
65  MediumRef clone() const override;
66 
67  protected:
68 
69  /**
70  * Creates a new medium by a given url.
71  * @param url Url of the medium
72  */
73  explicit IIOImage(const std::string& url);
74 
75  /**
76  * Destructs an image object.
77  */
78  ~IIOImage() override;
79 
80  /**
81  * Starts the medium.
82  * @see Medium::start().
83  */
84  bool start() override;
85 
86  /**
87  * Pauses the medium.
88  * @see Medium::pause():
89  */
90  bool pause() override;
91 
92  /**
93  * Stops the medium.
94  * @see Medium::stop().
95  */
96  bool stop() override;
97 
98  /**
99  * Sets the preferred frame pixel format.
100  * @see FrameMedium::setPreferredFramePixelFormat().
101  */
103 
104  protected:
105 
106  /**
107  * (Re-)loads the image.
108  * @return True, if succeeded
109  */
110  bool loadImage();
111 
112  /**
113  * Releases the image.
114  */
115  void release();
116 
117  protected:
118 
119  /// Recent frame type.
121 
122  /// Start timestamp.
124 
125  /// Pause timestamp.
127 
128  /// Stop timestamp.
130 
131  /// Determining whether this image is 'started' and holds valid image data.
133 };
134 
135 }
136 
137 }
138 
139 }
140 
141 #endif // META_OCEAN_MEDIA_IMAGEIO_IIO_IMAGE_H
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
This class implements an image class for ImageIO.
Definition: IIOImage.h:32
Timestamp mediumStartTimestamp
Start timestamp.
Definition: IIOImage.h:123
void release()
Releases the image.
MediumRef clone() const override
Clones this medium and returns a new independent instance of this medium.
bool stop() override
Stops the medium.
IIOImage(const std::string &url)
Creates a new medium by a given url.
Timestamp mediumStopTimestamp
Stop timestamp.
Definition: IIOImage.h:129
Timestamp startTimestamp() const override
Returns the start timestamp.
Timestamp mediumPauseTimestamp
Pause timestamp.
Definition: IIOImage.h:126
Timestamp pauseTimestamp() const override
Returns the pause timestamp.
bool loadImage()
(Re-)loads the image.
bool imageStarted
Determining whether this image is 'started' and holds valid image data.
Definition: IIOImage.h:132
bool isStarted() const override
Returns whether the medium is started currently.
~IIOImage() override
Destructs an image object.
FrameType imageRecentFrameType
Recent frame type.
Definition: IIOImage.h:120
bool start() override
Starts the medium.
bool setPreferredFramePixelFormat(const FrameType::PixelFormat format) override
Sets the preferred frame pixel format.
bool pause() override
Pauses the medium.
Timestamp stopTimestamp() const override
Returns the stop timestamp.
This class implements the ImageIO library.
Definition: IIOLibrary.h:30
This class is the base class for all object inside this library.
Definition: IIOObject.h:35
This class implements read, write, decocde, and encode functions for all file formats supported by th...
Definition: media/imageio/Image.h:57
This template class implements a object reference with an internal reference counter.
Definition: base/ObjectRef.h:58
This class implements a timestamp.
Definition: Timestamp.h:36
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15