Ocean
WICImage.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_WIC_WIC_IMAGE_H
9 #define META_OCEAN_MEDIA_WIC_WIC_IMAGE_H
10 
11 #include "ocean/media/wic/WIC.h"
13 
14 #include "ocean/media/Image.h"
15 
16 namespace Ocean
17 {
18 
19 namespace Media
20 {
21 
22 namespace WIC
23 {
24 
25 /**
26  * This class implements an image class for WIC.
27  * @ingroup mediawic
28  */
29 class OCEAN_MEDIA_WIC_EXPORT WICImage :
30  virtual public WICObject,
31  virtual public Image
32 {
33  friend class WICLibrary;
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 WICImage(const std::string& url);
74 
75  /**
76  * Destructs an image object.
77  */
78  virtual ~WICImage();
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  /// Start timestamp.
121 
122  /// Pause timestamp.
124 
125  /// Stop timestamp.
127 
128  /// Determining whether this image is 'started' and holds valid image data.
129  bool imageStarted_ = false;
130 };
131 
132 }
133 
134 }
135 
136 }
137 
138 #endif // META_OCEAN_MEDIA_WIC_WIC_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 WIC media librar...
Definition: media/wic/Image.h:30
This class implements an image class for WIC.
Definition: WICImage.h:32
WICImage(const std::string &url)
Creates a new medium by a given url.
bool isStarted() const override
Returns whether the medium is started currently.
Timestamp stopTimestamp() const override
Returns the stop timestamp.
Timestamp mediumStartTimestamp
Start timestamp.
Definition: WICImage.h:120
bool pause() override
Pauses the medium.
Timestamp mediumPauseTimestamp
Pause timestamp.
Definition: WICImage.h:123
Timestamp mediumStopTimestamp
Stop timestamp.
Definition: WICImage.h:126
bool stop() override
Stops the medium.
MediumRef clone() const override
Clones this medium and returns a new independent instance of this medium.
Timestamp startTimestamp() const override
Returns the start timestamp.
void release()
Releases the image.
bool loadImage()
(Re-)loads the image.
bool start() override
Starts the medium.
virtual ~WICImage()
Destructs an image object.
Timestamp pauseTimestamp() const override
Returns the pause timestamp.
bool setPreferredFramePixelFormat(const FrameType::PixelFormat format) override
Sets the preferred frame pixel format.
This class implements the WIC library.
Definition: WICLibrary.h:32
This class is the base class for all object inside this library.
Definition: WICObject.h:31
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