Ocean
Loading...
Searching...
No Matches
WICLibrary.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_LIBRARY_H
9#define META_OCEAN_MEDIA_WIC_WIC_LIBRARY_H
10
11#include "ocean/media/wic/WIC.h"
12
14
15#include "ocean/media/Library.h"
16#include "ocean/media/Manager.h"
17
18namespace Ocean
19{
20
21namespace Media
22{
23
24namespace WIC
25{
26
27/**
28 * This class implements the WIC library.
29 * @ingroup mediawic
30 */
31class OCEAN_MEDIA_WIC_EXPORT WICLibrary : public Library
32{
33 friend class Media::Manager;
34 friend class WICBufferImage;
35 friend class WICImage;
36 friend class WICImageSequence;
37
38 public:
39
40 /**
41 * This manager handles the COM initialization.
42 */
43 class ComInitializer : public Singleton<ComInitializer>
44 {
45 friend class Singleton<ComInitializer>;
46
47 public:
48
49 /**
50 * Initializes the COM or increases the internal reference counter if already initialized.
51 */
52 void initialize();
53
54 protected:
55
56 /**
57 * Creates a new initializer object.
58 */
60
61 protected:
62
63 /// True, if the COM is already initialized.
64 bool initialized_ = false;
65
66 /// The lock for the singleton.
68 };
69
70 public:
71
72 /**
73 * Creates a new medium by a given url.
74 * @see Library::newMedium().
75 */
76 MediumRef newMedium(const std::string& url, bool useExclusive = false) override;
77
78 /**
79 * Creates a new medium by a given url and an expected type.
80 * @see Library::newMedium().
81 */
82 MediumRef newMedium(const std::string& url, const Medium::Type type, bool useExclusive = false) override;
83
84 /**
85 * Creates a new recorder specified by the recorder type.
86 * @see Library::newRecorder().
87 */
89
90 /**
91 * Returns the supported medium types.
92 * @see Library::supportedTypes().
93 */
94 Medium::Type supportedTypes() const override;
95
96 /**
97 * Registers this library at the global media manager.
98 * With each register call, the reference counter for a specific library will be incremented.
99 * Each call to registerLibrary() needs to be balanced with a corresponding call of unregisterLibrary() before shutting down.
100 * @return True, if the library has not been registered before
101 * @see Manager, unregisterLibrary()
102 */
103 static bool registerLibrary();
104
105 /**
106 * Unregisters this library at the global media manager.
107 * With each unregister call, the reference counter for a specific library will be decremented and removed from the system if the counter reaches zero.
108 * Each call to registerLibrary() needs to be balanced with a corresponding call of unregisterLibrary() before shutting down.
109 * @return True, if the library was actually removed from the system (as the reference counter reached zero); False, if the library is still used by someone else
110 * @see registerLibrary().
111 */
112 static bool unregisterLibrary();
113
114 protected:
115
116 /**
117 * Creates a new WICLibrary object.
118 */
120
121 /**
122 * Destructs an WICLibrary object.
123 */
124 ~WICLibrary() override;
125
126 /**
127 * Creates this library and returns it an object reference.
128 * @return The new library object
129 */
131
132 /**
133 * Creates a new buffer image medium.
134 * @param url Url of the image medium to create
135 * @param useExclusive Determines whether the caller would like to use this medium exclusively
136 * @return Reference of the new medium
137 */
138 static MediumRef newBufferImage(const std::string& url, bool useExclusive);
139
140 /**
141 * Creates a new image medium.
142 * @param url Url of the image medium to create
143 * @param useExclusive Determines whether the caller would like to use this medium exclusively
144 * @return Reference of the new medium
145 */
146 static MediumRef newImage(const std::string& url, bool useExclusive);
147
148 /**
149 * Creates a new image sequence medium.
150 * @param url Url of the image sequence medium to create
151 * @param useExclusive Determines whether the caller would like to use this medium exclusively
152 * @return Reference of the new medium
153 */
154 static MediumRef newImageSequence(const std::string& url, bool useExclusive);
155};
156
157}
158
159}
160
161}
162
163#endif // META_OCEAN_MEDIA_WIC_WIC_LIBRARY_H
This class implements a recursive lock object.
Definition Lock.h:31
This class is the base class for all media libraries.
Definition media/Library.h:42
This class is the manager for all media objects.
Definition media/Manager.h:34
Type
Definition of different medium types.
Definition Medium.h:57
Type
Definition of different recorder types.
Definition Recorder.h:46
This class implements a buffer image class for WIC.
Definition WICBufferImage.h:32
This class implements an image class for WIC.
Definition WICImage.h:32
This class implements an image sequence for WIC.
Definition WICImageSequence.h:32
This manager handles the COM initialization.
Definition WICLibrary.h:44
void initialize()
Initializes the COM or increases the internal reference counter if already initialized.
ComInitializer()
Creates a new initializer object.
Lock lock_
The lock for the singleton.
Definition WICLibrary.h:67
This class implements the WIC library.
Definition WICLibrary.h:32
WICLibrary()
Creates a new WICLibrary object.
static LibraryRef create()
Creates this library and returns it an object reference.
static MediumRef newImageSequence(const std::string &url, bool useExclusive)
Creates a new image sequence medium.
MediumRef newMedium(const std::string &url, const Medium::Type type, bool useExclusive=false) override
Creates a new medium by a given url and an expected type.
static bool unregisterLibrary()
Unregisters this library at the global media manager.
MediumRef newMedium(const std::string &url, bool useExclusive=false) override
Creates a new medium by a given url.
Medium::Type supportedTypes() const override
Returns the supported medium types.
static bool registerLibrary()
Registers this library at the global media manager.
RecorderRef newRecorder(const Recorder::Type type) override
Creates a new recorder specified by the recorder type.
static MediumRef newBufferImage(const std::string &url, bool useExclusive)
Creates a new buffer image medium.
static MediumRef newImage(const std::string &url, bool useExclusive)
Creates a new image medium.
~WICLibrary() override
Destructs an WICLibrary object.
This template class is the base class for all singleton objects.
Definition Singleton.h:71
The namespace covering the entire Ocean framework.
Definition Accessor.h:15