Bug 1874684 - Part 28: Return DateDuration from DifferenceISODateTime. r=mgaudet
[gecko.git] / media / wmf-clearkey / WMFClearKeyCDMAccess.cpp
blob709690e48f614a86dfd018a9f95f4ac179b98a8a
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 "WMFClearKeyCDMAccess.h"
7 #include <Mferror.h>
8 #include <oleauto.h>
10 #include "WMFClearKeyCDM.h"
11 #include "WMFClearKeyUtils.h"
13 namespace mozilla {
15 using Microsoft::WRL::ComPtr;
16 using Microsoft::WRL::MakeAndInitialize;
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;
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;
36 STDMETHODIMP WMFClearKeyCDMAccess::GetConfiguration(IPropertyStore** aConfig) {
37 NOT_IMPLEMENTED();
38 return E_NOTIMPL;
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;
48 wcscpy_s(*aKeySystem, wcslen(kCLEARKEY_SYSTEM_NAME) + 1,
49 kCLEARKEY_SYSTEM_NAME);
50 return S_OK;
53 } // namespace mozilla