MFContentProtectionManager.h (3060B)
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 #ifndef DOM_MEDIA_PLATFORM_WMF_MFCONTENTPROTECTIONMANAGER_H 6 #define DOM_MEDIA_PLATFORM_WMF_MFCONTENTPROTECTIONMANAGER_H 7 8 #include <mfapi.h> 9 #include <mfidl.h> 10 #include <windows.media.protection.h> 11 #include <wrl.h> 12 13 #include "MFCDMProxy.h" 14 15 namespace mozilla { 16 17 /** 18 * MFContentProtectionManager is used to enable the encrypted playback for the 19 * media engine. 20 * https://docs.microsoft.com/en-us/windows/win32/api/mfidl/nn-mfidl-imfcontentprotectionmanager 21 * https://docs.microsoft.com/en-us/uwp/api/windows.media.protection.mediaprotectionmanager 22 */ 23 class MFContentProtectionManager 24 : public Microsoft::WRL::RuntimeClass< 25 Microsoft::WRL::RuntimeClassFlags< 26 Microsoft::WRL::RuntimeClassType::WinRtClassicComMix | 27 Microsoft::WRL::RuntimeClassType::InhibitRoOriginateError>, 28 IMFContentProtectionManager, 29 ABI::Windows::Media::Protection::IMediaProtectionManager> { 30 public: 31 MFContentProtectionManager(); 32 ~MFContentProtectionManager(); 33 34 HRESULT RuntimeClassInitialize(); 35 36 void Shutdown(); 37 38 // IMFContentProtectionManager. 39 IFACEMETHODIMP BeginEnableContent(IMFActivate* aEnablerActivate, 40 IMFTopology* aTopology, 41 IMFAsyncCallback* aCallback, 42 IUnknown* aState) override; 43 IFACEMETHODIMP EndEnableContent(IMFAsyncResult* aAsyncResult) override; 44 45 // IMediaProtectionManager. 46 // MFMediaEngine can query this interface to invoke get_Properties(). 47 IFACEMETHODIMP add_ServiceRequested( 48 ABI::Windows::Media::Protection::IServiceRequestedEventHandler* aHandler, 49 EventRegistrationToken* aCookie) override; 50 IFACEMETHODIMP remove_ServiceRequested( 51 EventRegistrationToken aCookie) override; 52 IFACEMETHODIMP add_RebootNeeded( 53 ABI::Windows::Media::Protection::IRebootNeededEventHandler* aHandler, 54 EventRegistrationToken* aCookie) override; 55 IFACEMETHODIMP remove_RebootNeeded(EventRegistrationToken aCookie) override; 56 IFACEMETHODIMP add_ComponentLoadFailed( 57 ABI::Windows::Media::Protection::IComponentLoadFailedEventHandler* 58 aHandler, 59 EventRegistrationToken* aCookie) override; 60 IFACEMETHODIMP remove_ComponentLoadFailed( 61 EventRegistrationToken aCookie) override; 62 IFACEMETHODIMP get_Properties( 63 ABI::Windows::Foundation::Collections::IPropertySet** aValue) override; 64 65 HRESULT SetCDMProxy(MFCDMProxy* aCDMProxy); 66 67 MFCDMProxy* GetCDMProxy() const { return mCDMProxy; } 68 69 private: 70 HRESULT SetPMPServer( 71 ABI::Windows::Media::Protection::IMediaProtectionPMPServer* aPMPServer); 72 73 RefPtr<MFCDMProxy> mCDMProxy; 74 75 Microsoft::WRL::ComPtr<ABI::Windows::Foundation::Collections::IPropertySet> 76 mPMPServerSet; 77 }; 78 79 } // namespace mozilla 80 81 #endif // DOM_MEDIA_PLATFORM_WMF_MFCONTENTPROTECTIONMANAGER_H