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>
36DISABLE_WARNINGS_END
37
38namespace Ocean
39{
40
41namespace Media
42{
43
44namespace MediaFoundation
45{
46
47/**
48 * @ingroup media
49 * @defgroup mediamf Ocean Media MediaFoundation Library
50 * @{
51 * The Ocean Media MediaFoundation Library provides MediaFoundation media functionalities.
52 * The library is available on windows platforms only.
53 * @}
54 */
55
56/**
57 * @namespace Ocean::Media::MediaFoundation Namespace of the Media MediaFoundation library.<p>
58 * The Namespace Ocean::Media::MediaFoundation is used in the entire Ocean Media MediaFoundation Library.
59 */
60
61// Defines OCEAN_MEDIA_MF_EXPORT for dll export and import.
62#if defined(_WINDOWS) && defined(OCEAN_RUNTIME_SHARED)
63 #ifdef USE_OCEAN_MEDIA_MF_EXPORT
64 #define OCEAN_MEDIA_MF_EXPORT __declspec(dllexport)
65 #else
66 #define OCEAN_MEDIA_MF_EXPORT __declspec(dllimport)
67 #endif
68#else
69 #define OCEAN_MEDIA_MF_EXPORT
70#endif
71
72/**
73 * Returns the name of this media MediaFoundation library.
74 * @ingroup mediamf
75 */
76OCEAN_MEDIA_MF_EXPORT std::string nameMediaFoundationLibrary();
77
78#ifdef OCEAN_RUNTIME_STATIC
79
80/**
81 * Registers this media library at the global library manager.
82 * This function calls MFLibrary::registerLibrary() only.
83 * @ingroup mediamf
84 */
86
87/**
88 * Unregisters this media library at the global library manager.
89 * This function calls MFLibrary::unregisterLibrary() only.
90 * @return True, if succeeded
91 * @ingroup mediamf
92 */
94
95#endif // OCEAN_RUNTIME_STATIC
96
97/**
98 * This functions allows to release a media foundation object if it does exist.
99 * @param object Media Foundation object to be released
100 * @ingroup mediamf
101 */
102template <class T> void release(T *object);
103
104/**
105 * Template specialization for ScopedObjectCompileTimeVoid using the release() function to release media foundation objects.
106 * @tparam T The data type of the wrapped object
107 * @ingroup mediamf
108 */
109template <typename T>
111
112/**
113 * Definition of a scoped object holding a IKsControl object.
114 * The wrapped IKsControl object will be released automatically once the scoped object does not exist anymore.
115 * @ingroup mediamf
116 */
118
119/**
120 * Definition of a scoped object holding a IMFActivate object.
121 * The wrapped IMFActivate object will be released automatically once the scoped object does not exist anymore.
122 * @ingroup mediamf
123 */
125
126/**
127 * Definition of a scoped object holding a IMFAudioStreamVolume object.
128 * The wrapped IMFAudioStreamVolume object will be released automatically once the scoped object does not exist anymore.
129 * @ingroup mediamf
130 */
132
133/**
134 * Definition of a scoped object holding a IMFAttributes object.
135 * The wrapped IMFAttributes object will be released automatically once the scoped object does not exist anymore.
136 * @ingroup mediamf
137 */
139
140/**
141 * Definition of a scoped object holding a IMFMediaBuffer object.
142 * The wrapped IMFMediaBuffer object will be released automatically once the scoped object does not exist anymore.
143 * @ingroup mediamf
144 */
146
147/**
148 * Definition of a scoped object holding a IMFMediaEvent object.
149 * The wrapped IMFMediaEvent object will be released automatically once the scoped object does not exist anymore.
150 * @ingroup mediamf
151 */
153
154/**
155 * Definition of a scoped object holding a IMFMediaEventGenerator object.
156 * The wrapped IMFMediaEventGenerator object will be released automatically once the scoped object does not exist anymore.
157 * @ingroup mediamf
158 */
160
161/**
162 * Definition of a scoped object holding a IMFMediaSession object.
163 * The wrapped IMFMediaSession object will be released automatically once the scoped object does not exist anymore.
164 * @ingroup mediamf
165 */
167
168/**
169 * Definition of a scoped object holding a ScopedIMFMediaSource object.
170 * The wrapped ScopedIMFMediaSource object will be released automatically once the scoped object does not exist anymore.
171 * @ingroup mediamf
172 */
174
175/**
176 * Definition of a scoped object holding a IMFMediaType object.
177 * The wrapped IMFMediaType object will be released automatically once the scoped object does not exist anymore.
178 * @ingroup mediamf
179 */
181
182/**
183 * Definition of a scoped object holding a IMFMediaTypeHandler object.
184 * The wrapped IMFMediaTypeHandler object will be released automatically once the scoped object does not exist anymore.
185 * @ingroup mediamf
186 */
188
189/**
190 * Definition of a scoped object holding a IMFSample object.
191 * The wrapped IMFSample object will be released automatically once the scoped object does not exist anymore.
192 * @ingroup mediamf
193 */
195
196/**
197 * Definition of a scoped object holding a IMFStreamSink object.
198 * The wrapped IMFStreamSink object will be released automatically once the scoped object does not exist anymore.
199 * @ingroup mediamf
200 */
202
203/**
204 * Definition of a scoped object holding a IMFTopology object.
205 * The wrapped IMFTopology object will be released automatically once the scoped object does not exist anymore.
206 * @ingroup mediamf
207 */
209
210/**
211 * Definition of a scoped object holding a IMFTopologyNode object.
212 * The wrapped IMFTopologyNode object will be released automatically once the scoped object does not exist anymore.
213 * @ingroup mediamf
214 */
216
217template <class T>
218void release(T *object)
219{
220 if (object != nullptr)
221 {
222 object->Release();
223 }
224}
225
226} // namespace MediaFoundation
227
228} // namespace Media
229
230} // namespace Ocean
231
232#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:218
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