WMFPMPServer.cpp (2083B)
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/. */ 4 5 #include "WMFPMPServer.h" 6 7 #include <mfapi.h> 8 #include <mferror.h> 9 10 #include "WMFClearKeyUtils.h" 11 12 namespace mozilla { 13 14 using Microsoft::WRL::ComPtr; 15 using Microsoft::WRL::MakeAndInitialize; 16 17 HRESULT WMFPMPServer::RuntimeClassInitialize( 18 ABI::Windows::Foundation::Collections::IPropertySet* aPropertyPmp) { 19 ENTRY_LOG(); 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))); 27 return S_OK; 28 } 29 30 STDMETHODIMP WMFPMPServer::GetIids(ULONG* aIidCount, IID** aIids) { 31 NOT_IMPLEMENTED(); 32 return E_NOTIMPL; 33 } 34 35 STDMETHODIMP WMFPMPServer::GetRuntimeClassName( 36 _COM_Outptr_ HSTRING* aClassName) { 37 NOT_IMPLEMENTED(); 38 return E_NOTIMPL; 39 } 40 41 STDMETHODIMP WMFPMPServer::GetTrustLevel(TrustLevel* aTrustLevel) { 42 NOT_IMPLEMENTED(); 43 return E_NOTIMPL; 44 } 45 STDMETHODIMP WMFPMPServer::get_Properties( 46 ABI::Windows::Foundation::Collections::IPropertySet** aPpProperties) { 47 ENTRY_LOG(); 48 RETURN_IF_FAILED(mPropertyPmp.CopyTo(aPpProperties)); 49 return S_OK; 50 } 51 52 STDMETHODIMP WMFPMPServer::GetService(REFGUID aGuidService, REFIID aRiid, 53 LPVOID* aObject) { 54 ENTRY_LOG(); 55 if (!aObject) { 56 return E_POINTER; 57 } 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)); 62 } else { 63 RETURN_IF_FAILED(MF_E_UNSUPPORTED_SERVICE); 64 } 65 return S_OK; 66 } 67 68 } // namespace mozilla