Ocean
IIOBufferImage.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_BUFFER_IMAGE_H
9 #define META_OCEAN_MEDIA_IMAGEIO_IIO_BUFFER_IMAGE_H
10 
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Media
20 {
21 
22 namespace ImageIO
23 {
24 
25 /**
26  * This class implements a buffer image class for ImageIO.
27  * @ingroup mediaiio
28  */
29 class OCEAN_MEDIA_IIO_EXPORT IIOBufferImage :
30  virtual public IIOObject,
31  virtual public BufferImage
32 {
33  friend class IIOLibrary;
34 
35  public:
36 
37  /**
38  * Starts the medium.
39  * @see Medium::start().
40  */
41  bool start() override;
42 
43  /**
44  * Pauses the medium.
45  * @see Medium::pause():
46  */
47  bool pause() override;
48 
49  /**
50  * Stops the medium.
51  * @see Medium::stop().
52  */
53  bool stop() override;
54 
55  /**
56  * Clones this medium and returns a new independent instance of this medium.
57  * @see Medium::clone().
58  */
59  MediumRef clone() const override;
60 
61  protected:
62 
63  /**
64  * Creates a new medium by a given url.
65  * @param url Url of the medium
66  */
67  explicit IIOBufferImage(const std::string& url);
68 
69  /**
70  * Destructs an image object.
71  */
72  ~IIOBufferImage() override;
73 
74  /**
75  * Sets the preferred frame pixel format.
76  * @see FrameMedium::setPreferredFramePixelFormat().
77  */
79 
80  protected:
81 
82  /**
83  * (Re-)loads the image.
84  * @return True, if succeeded
85  */
86  bool loadImage();
87 
88  /**
89  * Releases the image.
90  */
91  void release();
92 };
93 
94 }
95 
96 }
97 
98 }
99 
100 #endif // META_OCEAN_MEDIA_IMAGEIO_IIO_BUFFER_IMAGE_H
PixelFormat
Definition of all pixel formats available in the Ocean framework.
Definition: Frame.h:183
This class implements a frame medium object which is defined by a given buffer and image or frame typ...
Definition: BufferImage.h:38
This class implements a buffer image class for ImageIO.
Definition: IIOBufferImage.h:32
IIOBufferImage(const std::string &url)
Creates a new medium by a given url.
bool setPreferredFramePixelFormat(const FrameType::PixelFormat format) override
Sets the preferred frame pixel format.
bool stop() override
Stops the medium.
bool pause() override
Pauses the medium.
bool loadImage()
(Re-)loads the image.
~IIOBufferImage() override
Destructs an image object.
void release()
Releases the image.
MediumRef clone() const override
Clones this medium and returns a new independent instance of this medium.
bool start() override
Starts the medium.
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 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