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 #include "WMFPMPServer.h"
10 #include "WMFClearKeyUtils.h"
14 using Microsoft::WRL::ComPtr
;
15 using Microsoft::WRL::MakeAndInitialize
;
17 HRESULT
WMFPMPServer::RuntimeClassInitialize(
18 ABI::Windows::Foundation::Collections::IPropertySet
* aPropertyPmp
) {
20 mPropertyPmp
= aPropertyPmp
;
21 RETURN_IF_FAILED(MFCreatePMPMediaSession(MFPMPSESSION_IN_PROCESS
, nullptr,
22 &mMediaSession
, nullptr));
23 RETURN_IF_FAILED(MFGetService(mMediaSession
.Get(), MF_PMP_SERVER_CONTEXT
,
24 IID_PPV_ARGS(&mPmpServer
)));
25 RETURN_IF_FAILED(MFGetService(mMediaSession
.Get(), MF_PMP_SERVICE
,
26 IID_PPV_ARGS(&mPmpHost
)));
30 STDMETHODIMP
WMFPMPServer::GetIids(ULONG
* aIidCount
, IID
** aIids
) {
35 STDMETHODIMP
WMFPMPServer::GetRuntimeClassName(
36 _COM_Outptr_ HSTRING
* aClassName
) {
41 STDMETHODIMP
WMFPMPServer::GetTrustLevel(TrustLevel
* aTrustLevel
) {
45 STDMETHODIMP
WMFPMPServer::get_Properties(
46 ABI::Windows::Foundation::Collections::IPropertySet
** aPpProperties
) {
48 RETURN_IF_FAILED(mPropertyPmp
.CopyTo(aPpProperties
));
52 STDMETHODIMP
WMFPMPServer::GetService(REFGUID aGuidService
, REFIID aRiid
,
58 if (aGuidService
== MF_PMP_SERVER_CONTEXT
) {
59 RETURN_IF_FAILED(mPmpServer
.CopyTo(aRiid
, aObject
));
60 } else if (aGuidService
== MF_PMP_SERVICE
&& aRiid
== IID_IMFPMPHost
) {
61 RETURN_IF_FAILED(mPmpHost
.CopyTo(aRiid
, aObject
));
63 RETURN_IF_FAILED(MF_E_UNSUPPORTED_SERVICE
);
68 } // namespace mozilla