Ocean
WICBufferImage.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_BUFFER_IMAGE_H
9 #define META_OCEAN_MEDIA_WIC_WIC_BUFFER_IMAGE_H
10 
11 #include "ocean/media/wic/WIC.h"
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Media
20 {
21 
22 namespace WIC
23 {
24 
25 /**
26  * This class implements a buffer image class for WIC.
27  * @ingroup mediawic
28  */
29 class OCEAN_MEDIA_WIC_EXPORT WICBufferImage :
30  virtual public WICObject,
31  virtual public BufferImage
32 {
33  friend class WICLibrary;
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 WICBufferImage(const std::string& url);
68 
69  /**
70  * Destructs an image object.
71  */
72  virtual ~WICBufferImage();
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  protected:
94 
95  /// Recent frame type.
97 };
98 
99 }
100 
101 }
102 
103 }
104 
105 #endif // META_OCEAN_MEDIA_WIC_WIC_BUFFER_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 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 WIC.
Definition: WICBufferImage.h:32
MediumRef clone() const override
Clones this medium and returns a new independent instance of this medium.
bool setPreferredFramePixelFormat(const FrameType::PixelFormat format) override
Sets the preferred frame pixel format.
WICBufferImage(const std::string &url)
Creates a new medium by a given url.
bool loadImage()
(Re-)loads the image.
bool pause() override
Pauses the medium.
FrameType imageRecentFrameType
Recent frame type.
Definition: WICBufferImage.h:96
bool stop() override
Stops the medium.
virtual ~WICBufferImage()
Destructs an image object.
bool start() override
Starts the medium.
void release()
Releases the image.
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
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15