Ocean
OILImage.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_OPEN_IMAGE_LIBRARIES_OL_IMAGE_H
9 #define META_OCEAN_MEDIA_OPEN_IMAGE_LIBRARIES_OL_IMAGE_H
10 
12 
13 #include "ocean/media/Image.h"
14 
15 namespace Ocean
16 {
17 
18 namespace Media
19 {
20 
21 namespace OpenImageLibraries
22 {
23 
24 /**
25  * This class implements an image class for OpenImageLibraries.
26  * @ingroup mediaoil
27  */
28 class OCEAN_MEDIA_OIL_EXPORT OILImage : virtual public Image
29 {
30  friend class OILLibrary;
31 
32  public:
33 
34  /**
35  * Returns whether the medium is started currently.
36  * @see Medium::isStarted().
37  */
38  bool isStarted() const override;
39 
40  /**
41  * Returns the start timestamp.
42  * @see FiniteMedium::startTimestamp().
43  */
44  Timestamp startTimestamp() const override;
45 
46  /**
47  * Returns the pause timestamp.
48  * @see FiniteMedium::pauseTimestamp().
49  */
50  Timestamp pauseTimestamp() const override;
51 
52  /**
53  * Returns the stop timestamp.
54  * @see FiniteMedium::stopTimestamp().
55  */
56  Timestamp stopTimestamp() const override;
57 
58  /**
59  * Clones this medium and returns a new independent instance of this medium.
60  * @see Medium::clone().
61  */
62  MediumRef clone() const override;
63 
64  protected:
65 
66  /**
67  * Creates a new medium by a given url.
68  * @param url Url of the medium
69  */
70  explicit OILImage(const std::string& url);
71 
72  /**
73  * Destructs an image object.
74  */
75  ~OILImage() override;
76 
77  /**
78  * Starts the medium.
79  * @see Medium::start().
80  */
81  bool start() override;
82 
83  /**
84  * Pauses the medium.
85  * @see Medium::pause():
86  */
87  bool pause() override;
88 
89  /**
90  * Stops the medium.
91  * @see Medium::stop().
92  */
93  bool stop() override;
94 
95  /**
96  * Sets the preferred frame pixel format.
97  * @see FrameMedium::setPreferredFramePixelFormat().
98  */
100 
101  /**
102  * (Re-)loads the image.
103  * @return True, if succeeded
104  */
105  bool loadImage();
106 
107  /**
108  * Releases the image.
109  */
110  void release();
111 
112  protected:
113 
114  /// Start timestamp.
116 
117  /// Pause timestamp.
119 
120  /// Stop timestamp.
122 };
123 
124 }
125 
126 }
127 
128 }
129 
130 #endif // META_OCEAN_MEDIA_OPEN_IMAGE_LIBRARIES_OL_IMAGE_H
PixelFormat
Definition of all pixel formats available in the Ocean framework.
Definition: Frame.h:183
This class implements read and write functions for all file formats supported by the OpenImageLibrari...
Definition: media/openimagelibraries/Image.h:57
This class implements an image class for OpenImageLibraries.
Definition: OILImage.h:29
Timestamp pauseTimestamp() const override
Returns the pause timestamp.
Timestamp pauseTimestamp_
Pause timestamp.
Definition: OILImage.h:118
bool start() override
Starts the medium.
Timestamp startTimestamp() const override
Returns the start timestamp.
~OILImage() override
Destructs an image object.
OILImage(const std::string &url)
Creates a new medium by a given url.
bool isStarted() const override
Returns whether the medium is started currently.
bool stop() override
Stops the medium.
Timestamp stopTimestamp_
Stop timestamp.
Definition: OILImage.h:121
Timestamp startTimestamp_
Start timestamp.
Definition: OILImage.h:115
bool setPreferredFramePixelFormat(const FrameType::PixelFormat format) override
Sets the preferred frame pixel format.
bool loadImage()
(Re-)loads the image.
Timestamp stopTimestamp() const override
Returns the stop timestamp.
MediumRef clone() const override
Clones this medium and returns a new independent instance of this medium.
bool pause() override
Pauses the medium.
This class implements the OpenImageLibraries library.
Definition: OILLibrary.h:30
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