Ocean
Loading...
Searching...
No Matches
MediaFoundation.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_MF_MEDIA_FOUNDATION_H
9#define META_OCEAN_MEDIA_MF_MEDIA_FOUNDATION_H
10
11#include "ocean/media/Media.h"
12
14
15#ifndef OCEAN_PLATFORM_BUILD_WINDOWS
16 #error This library is available on windows platforms only!
17#endif // OCEAN_PLATFORM_BUILD_WINDOWS
18
19// The DISABLE_WARNINGS_BEGIN macro allows to disable any warnings, needs to be balanced with DISABLE_WARNINGS_END
20#ifndef DISABLE_WARNINGS_BEGIN
21 #if defined(_MSC_VER)
22 #define DISABLE_WARNINGS_BEGIN _Pragma("warning(push, 0)")
23 #define DISABLE_WARNINGS_END _Pragma("warning(pop)")
24 #else
25 #define DISABLE_WARNINGS_BEGIN
26 #define DISABLE_WARNINGS_END
27 #endif
28#endif
29
30DISABLE_WARNINGS_BEGIN
31 #include <devicetopology.h>
32 #include <ks.h>
33 #include <ksproxy.h>
34 #include <mfapi.h>
35 #include <mfidl.h>
36 #include <mftransform.h>
37DISABLE_WARNINGS_END
38
39namespace Ocean
40{
41
42namespace Media
43{
44
45namespace MediaFoundation
46{
47
48/**
49 * @ingroup media
50 * @defgroup mediamf Ocean Media MediaFoundation Library
51 * @{
52 * The Ocean Media MediaFoundation Library provides MediaFoundation media functionalities.
53 * The library is available on windows platforms only.
54 * @}
55 */
56
57/**
58 * @namespace Ocean::Media::MediaFoundation Namespace of the Media MediaFoundation library.<p>
59 * The Namespace Ocean::Media::MediaFoundation is used in the entire Ocean Media MediaFoundation Library.
60 */
61
62// Defines OCEAN_MEDIA_MF_EXPORT for dll export and import.
63#if defined(_WINDOWS) && defined(OCEAN_RUNTIME_SHARED)
64 #ifdef USE_OCEAN_MEDIA_MF_EXPORT
65 #define OCEAN_MEDIA_MF_EXPORT __declspec(dllexport)
66 #else
67 #define OCEAN_MEDIA_MF_EXPORT __declspec(dllimport)
68 #endif
69#else
70 #define OCEAN_MEDIA_MF_EXPORT
71#endif
72
73/**
74 * Returns the name of this media MediaFoundation library.
75 * @ingroup mediamf
76 */
77OCEAN_MEDIA_MF_EXPORT std::string nameMediaFoundationLibrary();
78
79#ifdef OCEAN_RUNTIME_STATIC
80
81/**
82 * Registers this media library at the global library manager.
83 * This function calls MFLibrary::registerLibrary() only.
84 * @ingroup mediamf
85 */
87
88/**
89 * Unregisters this media library at the global library manager.
90 * This function calls MFLibrary::unregisterLibrary() only.
91 * @return True, if succeeded
92 * @ingroup mediamf
93 */
95
96#endif // OCEAN_RUNTIME_STATIC
97
98/**
99 * This functions allows to release a media foundation object if it does exist.
100 * @param object Media Foundation object to be released
101 * @ingroup mediamf
102 */
103template <class T> void release(T *object);
104
105/**
106 * Template specialization for ScopedObjectCompileTimeVoid using the release() function to release media foundation objects.
107 * @tparam T The data type of the wrapped object
108 * @ingroup mediamf
109 */
110template <typename T>
112
113/**
114 * Definition of a scoped object holding a IKsControl object.
115 * The wrapped IKsControl object will be released automatically once the scoped object does not exist anymore.
116 * @ingroup mediamf
117 */
119
120/**
121 * Definition of a scoped object holding a IMFActivate object.
122 * The wrapped IMFActivate object will be released automatically once the scoped object does not exist anymore.
123 * @ingroup mediamf
124 */
126
127/**
128 * Definition of a scoped object holding a IMFAudioStreamVolume object.
129 * The wrapped IMFAudioStreamVolume object will be released automatically once the scoped object does not exist anymore.
130 * @ingroup mediamf
131 */
133
134/**
135 * Definition of a scoped object holding a IMFAttributes object.
136 * The wrapped IMFAttributes object will be released automatically once the scoped object does not exist anymore.
137 * @ingroup mediamf
138 */
140
141/**
142 * Definition of a scoped object holding a IMFMediaBuffer object.
143 * The wrapped IMFMediaBuffer object will be released automatically once the scoped object does not exist anymore.
144 * @ingroup mediamf
145 */
147
148/**
149 * Definition of a scoped object holding a IMFMediaEvent object.
150 * The wrapped IMFMediaEvent object will be released automatically once the scoped object does not exist anymore.
151 * @ingroup mediamf
152 */
154
155/**
156 * Definition of a scoped object holding a IMFMediaEventGenerator object.
157 * The wrapped IMFMediaEventGenerator object will be released automatically once the scoped object does not exist anymore.
158 * @ingroup mediamf
159 */
161
162/**
163 * Definition of a scoped object holding a IMFMediaSession object.
164 * The wrapped IMFMediaSession object will be released automatically once the scoped object does not exist anymore.
165 * @ingroup mediamf
166 */
168
169/**
170 * Definition of a scoped object holding a ScopedIMFMediaSource object.
171 * The wrapped ScopedIMFMediaSource object will be released automatically once the scoped object does not exist anymore.
172 * @ingroup mediamf
173 */
175
176/**
177 * Definition of a scoped object holding a IMFMediaType object.
178 * The wrapped IMFMediaType object will be released automatically once the scoped object does not exist anymore.
179 * @ingroup mediamf
180 */
182
183/**
184 * Definition of a scoped object holding a IMFMediaTypeHandler object.
185 * The wrapped IMFMediaTypeHandler object will be released automatically once the scoped object does not exist anymore.
186 * @ingroup mediamf
187 */
189
190/**
191 * Definition of a scoped object holding a IMFSample object.
192 * The wrapped IMFSample object will be released automatically once the scoped object does not exist anymore.
193 * @ingroup mediamf
194 */
196
197/**
198 * Definition of a scoped object holding a IMFStreamSink object.
199 * The wrapped IMFStreamSink object will be released automatically once the scoped object does not exist anymore.
200 * @ingroup mediamf
201 */
203
204/**
205 * Definition of a scoped object holding a IMFTopology object.
206 * The wrapped IMFTopology object will be released automatically once the scoped object does not exist anymore.
207 * @ingroup mediamf
208 */
210
211/**
212 * Definition of a scoped object holding a IMFTopologyNode object.
213 * The wrapped IMFTopologyNode object will be released automatically once the scoped object does not exist anymore.
214 * @ingroup mediamf
215 */
217
218/**
219 * Definition of a scoped object holding a IMFTransform object.
220 * The wrapped IMFTransform object will be released automatically once the scoped object does not exist anymore.
221 * @ingroup mediamf
222 */
224
225template <class T>
226void release(T *object)
227{
228 if (object != nullptr)
229 {
230 object->Release();
231 }
232}
233
234} // namespace MediaFoundation
235
236} // namespace Media
237
238} // namespace Ocean
239
240#endif // META_OCEAN_MEDIA_MF_MEDIA_FOUNDATION_H
This class wraps an unmanaged object (or reference) which needs to be released after usage.
Definition ScopedObject.h:166
void release(T *object)
This functions allows to release a media foundation object if it does exist.
Definition MediaFoundation.h:226
bool unregisterMediaFoundationLibrary()
Unregisters this media library at the global library manager.
OCEAN_MEDIA_MF_EXPORT std::string nameMediaFoundationLibrary()
Returns the name of this media MediaFoundation library.
void registerMediaFoundationLibrary()
Registers this media library at the global library manager.
The namespace covering the entire Ocean framework.
Definition Accessor.h:15