WMFClearKeyCDMAccess.cpp (1488B)
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 "WMFClearKeyCDMAccess.h" 6 7 #include <Mferror.h> 8 #include <oleauto.h> 9 10 #include "WMFClearKeyCDM.h" 11 #include "WMFClearKeyUtils.h" 12 13 namespace mozilla { 14 15 using Microsoft::WRL::ComPtr; 16 using Microsoft::WRL::MakeAndInitialize; 17 18 STDMETHODIMP WMFClearKeyCDMAccess::CreateContentDecryptionModule( 19 IPropertyStore* aProperties, IMFContentDecryptionModule** aCdm) { 20 ENTRY_LOG(); 21 if (!aProperties) { 22 ENTRY_LOG_ARGS("Null properties!"); 23 return MF_E_UNEXPECTED; 24 } 25 26 *aCdm = nullptr; 27 ComPtr<IMFContentDecryptionModule> cdm; 28 RETURN_IF_FAILED( 29 (MakeAndInitialize<WMFClearKeyCDM, IMFContentDecryptionModule>( 30 &cdm, aProperties))); 31 *aCdm = cdm.Detach(); 32 ENTRY_LOG_ARGS("Created clearkey CDM!"); 33 return S_OK; 34 } 35 36 STDMETHODIMP WMFClearKeyCDMAccess::GetConfiguration(IPropertyStore** aConfig) { 37 NOT_IMPLEMENTED(); 38 return E_NOTIMPL; 39 } 40 41 STDMETHODIMP WMFClearKeyCDMAccess::GetKeySystem(LPWSTR* aKeySystem) { 42 ENTRY_LOG(); 43 *aKeySystem = (LPWSTR)CoTaskMemAlloc((wcslen(kCLEARKEY_SYSTEM_NAME) + 1) * 44 sizeof(wchar_t)); 45 if (*aKeySystem == NULL) { 46 return E_OUTOFMEMORY; 47 } 48 wcscpy_s(*aKeySystem, wcslen(kCLEARKEY_SYSTEM_NAME) + 1, 49 kCLEARKEY_SYSTEM_NAME); 50 return S_OK; 51 } 52 53 } // namespace mozilla