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