1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef DOM_MEDIA_PLATFORM_WMF_MFCDMEXTRA_H
6 #define DOM_MEDIA_PLATFORM_WMF_MFCDMEXTRA_H
8 // Currently, we build with WINVER=0x601 (Win7), which means the declarations in
9 // mfcontentdecryptionmodule.h will not be visible, which is only available on
10 // Win10 (0x0A00). Also, we don't yet have the Fall Creators Update SDK
11 // available on build machines, so even with updated WINVER, some of the
12 // interfaces we need would not be present. To work around this, until the build
13 // environment is updated, we include copies of the relevant classes/interfaces
15 #if defined(WINVER) && WINVER >= 0x0A00
16 # include <mfcontentdecryptionmodule.h>
19 // https://github.com/microsoft/media-foundation/issues/37#issuecomment-1198317488
20 EXTERN_GUID(GUID_ObjectStream
, 0x3e73735c, 0xe6c0, 0x481d, 0x82, 0x60, 0xee,
21 0x5d, 0xb1, 0x34, 0x3b, 0x5f);
22 EXTERN_GUID(GUID_ClassName
, 0x77631a31, 0xe5e7, 0x4785, 0xbf, 0x17, 0x20, 0xf5,
23 0x7b, 0x22, 0x48, 0x02);
24 EXTERN_GUID(CLSID_EMEStoreActivate
, 0x2df7b51e, 0x797b, 0x4d06, 0xbe, 0x71,
25 0xd1, 0x4a, 0x52, 0xcf, 0x84, 0x21);
27 // For `IMFCdmSuspendNotify`
28 # include "MFMediaEngineExtra.h"
30 typedef enum MF_MEDIAKEYS_REQUIREMENT
{
31 MF_MEDIAKEYS_REQUIREMENT_REQUIRED
= 1,
32 MF_MEDIAKEYS_REQUIREMENT_OPTIONAL
= 2,
33 MF_MEDIAKEYS_REQUIREMENT_NOT_ALLOWED
= 3
34 } MF_MEDIAKEYS_REQUIREMENT
;
36 EXTERN_C
const DECLSPEC_SELECTANY PROPERTYKEY
37 MF_CONTENTDECRYPTIONMODULE_STOREPATH
= {
41 {0x92, 0xc6, 0x18, 0xc8, 0x6a, 0x18, 0x9c, 0x06}},
43 EXTERN_C
const DECLSPEC_SELECTANY PROPERTYKEY MF_EME_INITDATATYPES
= {
47 {0xb4, 0x74, 0xb9, 0xaf, 0xeb, 0x0a, 0xdf, 0x38}},
48 PID_FIRST_USABLE
+ 0x00000001};
49 EXTERN_C
const DECLSPEC_SELECTANY PROPERTYKEY MF_EME_DISTINCTIVEID
= {
53 {0x8b, 0xff, 0x9b, 0x60, 0xb2, 0xdc, 0x58, 0x45}},
54 PID_FIRST_USABLE
+ 0x00000002};
55 EXTERN_C
const DECLSPEC_SELECTANY PROPERTYKEY MF_EME_PERSISTEDSTATE
= {
59 {0x95, 0x5b, 0x0e, 0x4b, 0xd2, 0x2f, 0xed, 0xf0}},
60 PID_FIRST_USABLE
+ 0x00000003};
61 EXTERN_C
const DECLSPEC_SELECTANY PROPERTYKEY MF_EME_AUDIOCAPABILITIES
= {
65 {0x89, 0x5f, 0xbc, 0xf2, 0x8a, 0x46, 0x28, 0x81}},
66 PID_FIRST_USABLE
+ 0x00000004};
67 EXTERN_C
const DECLSPEC_SELECTANY PROPERTYKEY MF_EME_VIDEOCAPABILITIES
= {
71 {0x80, 0x06, 0xed, 0x53, 0xda, 0x4d, 0x3b, 0xdb}},
72 PID_FIRST_USABLE
+ 0x00000005};
73 EXTERN_C
const DECLSPEC_SELECTANY PROPERTYKEY MF_EME_ROBUSTNESS
= {
77 {0xa8, 0xf5, 0xec, 0xca, 0x52, 0xa4, 0x69, 0x90}},
78 PID_FIRST_USABLE
+ 0x00000001};
79 EXTERN_C
const DECLSPEC_SELECTANY PROPERTYKEY MF_EME_CONTENTTYPE
= {
83 {0xb2, 0xbe, 0x97, 0x2b, 0x0e, 0x9b, 0x28, 0x3a}},
84 PID_FIRST_USABLE
+ 0x00000002};
86 typedef enum MF_MEDIAKEYSESSION_TYPE
{
87 MF_MEDIAKEYSESSION_TYPE_TEMPORARY
= 0,
88 MF_MEDIAKEYSESSION_TYPE_PERSISTENT_LICENSE
=
89 (MF_MEDIAKEYSESSION_TYPE_TEMPORARY
+ 1),
90 MF_MEDIAKEYSESSION_TYPE_PERSISTENT_RELEASE_MESSAGE
=
91 (MF_MEDIAKEYSESSION_TYPE_PERSISTENT_LICENSE
+ 1),
92 MF_MEDIAKEYSESSION_TYPE_PERSISTENT_USAGE_RECORD
=
93 (MF_MEDIAKEYSESSION_TYPE_PERSISTENT_RELEASE_MESSAGE
+ 1)
94 } MF_MEDIAKEYSESSION_TYPE
;
96 typedef enum MF_MEDIAKEYSESSION_MESSAGETYPE
{
97 MF_MEDIAKEYSESSION_MESSAGETYPE_LICENSE_REQUEST
= 0,
98 MF_MEDIAKEYSESSION_MESSAGETYPE_LICENSE_RENEWAL
= 1,
99 MF_MEDIAKEYSESSION_MESSAGETYPE_LICENSE_RELEASE
= 2,
100 MF_MEDIAKEYSESSION_MESSAGETYPE_INDIVIDUALIZATION_REQUEST
= 3
101 } MF_MEDIAKEYSESSION_MESSAGETYPE
;
103 typedef enum MF_MEDIAKEY_STATUS
{
104 MF_MEDIAKEY_STATUS_USABLE
= 0,
105 MF_MEDIAKEY_STATUS_EXPIRED
= (MF_MEDIAKEY_STATUS_USABLE
+ 1),
106 MF_MEDIAKEY_STATUS_OUTPUT_DOWNSCALED
= (MF_MEDIAKEY_STATUS_EXPIRED
+ 1),
107 MF_MEDIAKEY_STATUS_OUTPUT_NOT_ALLOWED
=
108 (MF_MEDIAKEY_STATUS_OUTPUT_DOWNSCALED
+ 1),
109 MF_MEDIAKEY_STATUS_STATUS_PENDING
=
110 (MF_MEDIAKEY_STATUS_OUTPUT_NOT_ALLOWED
+ 1),
111 MF_MEDIAKEY_STATUS_INTERNAL_ERROR
= (MF_MEDIAKEY_STATUS_STATUS_PENDING
+ 1),
112 MF_MEDIAKEY_STATUS_RELEASED
= (MF_MEDIAKEY_STATUS_INTERNAL_ERROR
+ 1),
113 MF_MEDIAKEY_STATUS_OUTPUT_RESTRICTED
= (MF_MEDIAKEY_STATUS_RELEASED
+ 1)
114 } MF_MEDIAKEY_STATUS
;
116 typedef struct MFMediaKeyStatus
{
119 MF_MEDIAKEY_STATUS eMediaKeyStatus
;
122 EXTERN_GUID(MF_CONTENTDECRYPTIONMODULE_SERVICE
, 0x15320c45, 0xff80, 0x484a,
123 0x9d, 0xcb, 0xd, 0xf8, 0x94, 0xe6, 0x9a, 0x1);
124 EXTERN_GUID(GUID_ObjectStream
, 0x3e73735c, 0xe6c0, 0x481d, 0x82, 0x60, 0xee,
125 0x5d, 0xb1, 0x34, 0x3b, 0x5f);
126 EXTERN_GUID(GUID_ClassName
, 0x77631a31, 0xe5e7, 0x4785, 0xbf, 0x17, 0x20, 0xf5,
127 0x7b, 0x22, 0x48, 0x02);
128 EXTERN_GUID(CLSID_EMEStoreActivate
, 0x2df7b51e, 0x797b, 0x4d06, 0xbe, 0x71,
129 0xd1, 0x4a, 0x52, 0xcf, 0x84, 0x21);
131 # ifndef __IMFContentDecryptionModuleSessionCallbacks_INTERFACE_DEFINED__
132 # define __IMFContentDecryptionModuleSessionCallbacks_INTERFACE_DEFINED__
134 /* interface IMFContentDecryptionModuleSessionCallbacks */
135 /* [unique][uuid][object] */
137 EXTERN_C
const IID IID_IMFContentDecryptionModuleSessionCallbacks
;
139 MIDL_INTERFACE("3f96ee40-ad81-4096-8470-59a4b770f89a")
140 IMFContentDecryptionModuleSessionCallbacks
: public IUnknown
{
142 virtual HRESULT STDMETHODCALLTYPE
KeyMessage(
143 /* [in] */ MF_MEDIAKEYSESSION_MESSAGETYPE messageType
,
145 __RPC__in_ecount_full(messageSize
) const BYTE
* message
,
146 /* [in] */ DWORD messageSize
,
147 /* [optional][in] */ __RPC__in LPCWSTR destinationURL
) = 0;
149 virtual HRESULT STDMETHODCALLTYPE
KeyStatusChanged(void) = 0;
152 # endif /* __IMFContentDecryptionModuleSessionCallbacks_INTERFACE_DEFINED__ \
155 # ifndef __IMFContentDecryptionModuleSession_INTERFACE_DEFINED__
156 # define __IMFContentDecryptionModuleSession_INTERFACE_DEFINED__
158 /* interface IMFContentDecryptionModuleSession */
159 /* [unique][uuid][object] */
161 EXTERN_C
const IID IID_IMFContentDecryptionModuleSession
;
163 MIDL_INTERFACE("4e233efd-1dd2-49e8-b577-d63eee4c0d33")
164 IMFContentDecryptionModuleSession
: public IUnknown
{
166 virtual HRESULT STDMETHODCALLTYPE
GetSessionId(
167 /* [out] */ __RPC__deref_out_opt LPWSTR
* sessionId
) = 0;
169 virtual HRESULT STDMETHODCALLTYPE
GetExpiration(
170 /* [out] */ __RPC__out
double* expiration
) = 0;
172 virtual HRESULT STDMETHODCALLTYPE
GetKeyStatuses(
173 /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(
174 *numKeyStatuses
) MFMediaKeyStatus
*
176 /* [out] */ __RPC__out UINT
* numKeyStatuses
) = 0;
178 virtual HRESULT STDMETHODCALLTYPE
Load(
179 /* [in] */ __RPC__in LPCWSTR sessionId
,
180 /* [out] */ __RPC__out BOOL
* loaded
) = 0;
182 virtual HRESULT STDMETHODCALLTYPE
GenerateRequest(
183 /* [in] */ __RPC__in LPCWSTR initDataType
,
185 __RPC__in_ecount_full(initDataSize
) const BYTE
* initData
,
186 /* [in] */ DWORD initDataSize
) = 0;
188 virtual HRESULT STDMETHODCALLTYPE
Update(
189 /* [size_is][in] */ __RPC__in_ecount_full(responseSize
)
190 const BYTE
* response
,
191 /* [in] */ DWORD responseSize
) = 0;
193 virtual HRESULT STDMETHODCALLTYPE
Close(void) = 0;
195 virtual HRESULT STDMETHODCALLTYPE
Remove(void) = 0;
198 # endif /* __IMFContentDecryptionModuleSession_INTERFACE_DEFINED__ */
200 # ifndef __IMFPMPHostApp_INTERFACE_DEFINED__
201 # define __IMFPMPHostApp_INTERFACE_DEFINED__
203 /* interface IMFPMPHostApp */
206 EXTERN_C
const IID IID_IMFPMPHostApp
;
208 MIDL_INTERFACE("84d2054a-3aa1-4728-a3b0-440a418cf49c")
209 IMFPMPHostApp
: public IUnknown
{
211 virtual HRESULT STDMETHODCALLTYPE
LockProcess(void) = 0;
213 virtual HRESULT STDMETHODCALLTYPE
UnlockProcess(void) = 0;
215 virtual HRESULT STDMETHODCALLTYPE
ActivateClassById(
216 /* [in] */ __RPC__in LPCWSTR id
,
217 /* [unique][in] */ __RPC__in_opt IStream
* pStream
,
218 /* [in] */ __RPC__in REFIID riid
,
219 /* [iid_is][out] */ __RPC__deref_out_opt
void** ppv
) = 0;
222 # endif /* __IMFPMPHostApp_INTERFACE_DEFINED__ */
224 # ifndef __IMFContentDecryptionModule_INTERFACE_DEFINED__
225 # define __IMFContentDecryptionModule_INTERFACE_DEFINED__
227 /* interface IMFContentDecryptionModule */
228 /* [unique][uuid][object] */
230 EXTERN_C
const IID IID_IMFContentDecryptionModule
;
232 MIDL_INTERFACE("87be986c-10be-4943-bf48-4b54ce1983a2")
233 IMFContentDecryptionModule
: public IUnknown
{
235 virtual HRESULT STDMETHODCALLTYPE
SetContentEnabler(
236 /* [in] */ __RPC__in_opt IMFContentEnabler
* contentEnabler
,
237 /* [in] */ __RPC__in_opt IMFAsyncResult
* result
) = 0;
239 virtual HRESULT STDMETHODCALLTYPE
GetSuspendNotify(
240 /* [out] */ __RPC__deref_out_opt IMFCdmSuspendNotify
* *notify
) = 0;
242 virtual HRESULT STDMETHODCALLTYPE
SetPMPHostApp(
243 /* [in] */ __RPC__in_opt IMFPMPHostApp
* pmpHostApp
) = 0;
245 virtual HRESULT STDMETHODCALLTYPE
CreateSession(
246 /* [in] */ MF_MEDIAKEYSESSION_TYPE sessionType
,
247 /* [in] */ __RPC__in_opt IMFContentDecryptionModuleSessionCallbacks
*
249 /* [out] */ __RPC__deref_out_opt IMFContentDecryptionModuleSession
*
252 virtual HRESULT STDMETHODCALLTYPE
SetServerCertificate(
253 /* [size_is][in] */ __RPC__in_ecount_full(certificateSize
)
254 const BYTE
* certificate
,
255 /* [in] */ DWORD certificateSize
) = 0;
257 virtual HRESULT STDMETHODCALLTYPE
CreateTrustedInput(
258 /* [size_is][in] */ __RPC__in_ecount_full(contentInitDataSize
)
259 const BYTE
* contentInitData
,
260 /* [in] */ DWORD contentInitDataSize
,
261 /* [out] */ __RPC__deref_out_opt IMFTrustedInput
** trustedInput
) = 0;
263 virtual HRESULT STDMETHODCALLTYPE
GetProtectionSystemIds(
264 /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*count
)
267 /* [out] */ __RPC__out DWORD
* count
) = 0;
270 # endif /* __IMFContentDecryptionModule_INTERFACE_DEFINED__ */
272 # ifndef __IMFContentDecryptionModuleAccess_INTERFACE_DEFINED__
273 # define __IMFContentDecryptionModuleAccess_INTERFACE_DEFINED__
275 /* interface IMFContentDecryptionModuleAccess */
276 /* [unique][uuid][object] */
278 EXTERN_C
const IID IID_IMFContentDecryptionModuleAccess
;
280 MIDL_INTERFACE("a853d1f4-e2a0-4303-9edc-f1a68ee43136")
281 IMFContentDecryptionModuleAccess
: public IUnknown
{
283 virtual HRESULT STDMETHODCALLTYPE
CreateContentDecryptionModule(
284 /* [in] */ __RPC__in_opt IPropertyStore
*
285 contentDecryptionModuleProperties
,
286 /* [out] */ __RPC__deref_out_opt IMFContentDecryptionModule
*
287 *contentDecryptionModule
) = 0;
289 virtual HRESULT STDMETHODCALLTYPE
GetConfiguration(
290 /* [out] */ __RPC__deref_out_opt IPropertyStore
* *configuration
) = 0;
292 virtual HRESULT STDMETHODCALLTYPE
GetKeySystem(
293 /* [out] */ __RPC__deref_out_opt LPWSTR
* keySystem
) = 0;
295 # endif /* __IMFContentDecryptionModuleAccess_INTERFACE_DEFINED__ */
297 # ifndef __IMFContentDecryptionModuleFactory_INTERFACE_DEFINED__
298 # define __IMFContentDecryptionModuleFactory_INTERFACE_DEFINED__
300 /* interface IMFContentDecryptionModuleFactory */
301 /* [local][uuid][object] */
303 EXTERN_C
const IID IID_IMFContentDecryptionModuleFactory
;
304 MIDL_INTERFACE("7d5abf16-4cbb-4e08-b977-9ba59049943e")
305 IMFContentDecryptionModuleFactory
: public IUnknown
{
307 virtual BOOL STDMETHODCALLTYPE
IsTypeSupported(
308 /* [in] */ LPCWSTR keySystem
,
309 /* [optional][in] */ LPCWSTR contentType
) = 0;
311 virtual HRESULT STDMETHODCALLTYPE
CreateContentDecryptionModuleAccess(
312 /* [in] */ LPCWSTR keySystem
,
313 /* [size_is][size_is][in] */ IPropertyStore
* *configurations
,
314 /* [in] */ DWORD numConfigurations
,
315 /* [out] */ IMFContentDecryptionModuleAccess
*
316 *contentDecryptionModuleAccess
) = 0;
318 # endif /* __IMFContentDecryptionModuleFactory_INTERFACE_DEFINED__ */
320 #endif // defined(WINVER) && WINVER >= 0x0A00
322 #endif // DOM_MEDIA_PLATFORM_WMF_MFCDMEXTRA_H