From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- media/wmf-clearkey/WMFClearKeySession.h | 78 +++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 media/wmf-clearkey/WMFClearKeySession.h (limited to 'media/wmf-clearkey/WMFClearKeySession.h') diff --git a/media/wmf-clearkey/WMFClearKeySession.h b/media/wmf-clearkey/WMFClearKeySession.h new file mode 100644 index 0000000000..d2032cccef --- /dev/null +++ b/media/wmf-clearkey/WMFClearKeySession.h @@ -0,0 +1,78 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef DOM_MEDIA_PLATFORM_WMF_CLEARKEY_WMFCLEARKEYSESSION_H +#define DOM_MEDIA_PLATFORM_WMF_CLEARKEY_WMFCLEARKEYSESSION_H + +#include +#include +#include + +#include "content_decryption_module.h" +#include "MFCDMExtra.h" +#include "RefCounted.h" +#include "WMFClearKeyUtils.h" + +namespace mozilla { + +class SessionManagerWrapper; + +// This is the implementation for EME API's MediaKeySession. +// TODO : add a way to assert thread usage. It would only be used on the media +// supervisor thread pool. +class WMFClearKeySession final + : public Microsoft::WRL::RuntimeClass< + Microsoft::WRL::RuntimeClassFlags, + IMFContentDecryptionModuleSession, Microsoft::WRL::FtmBase> { + public: + WMFClearKeySession() = default; + ~WMFClearKeySession(); + WMFClearKeySession(const WMFClearKeySession&) = delete; + WMFClearKeySession& operator=(const WMFClearKeySession&) = delete; + + HRESULT RuntimeClassInitialize( + MF_MEDIAKEYSESSION_TYPE aSessionType, + IMFContentDecryptionModuleSessionCallbacks* aCallbacks, + SessionManagerWrapper* aManager); + + void Shutdown(); + + // IMFContentDecryptionModuleSession + STDMETHODIMP GenerateRequest(LPCWSTR init_data_type, + + const BYTE* init_data, + DWORD init_data_size) override; + STDMETHODIMP Load(LPCWSTR session_id, BOOL* loaded) override; + STDMETHODIMP Update(const BYTE* aResponse, DWORD aResponseSize) override; + STDMETHODIMP Close() override; + STDMETHODIMP Remove() override; + STDMETHODIMP GetSessionId(LPWSTR* aSessionId) override; + STDMETHODIMP GetExpiration(double* aExpiration) override; + STDMETHODIMP GetKeyStatuses(MFMediaKeyStatus** aKeyStatuses, + UINT* aKeyStatusesCount) override; + + void OnKeyMessage(MF_MEDIAKEYSESSION_MESSAGETYPE aMessageType, + const BYTE* aMessage, DWORD aMessageSize); + void OnKeyStatusChanged(const cdm::KeyInformation* aKeysInfo, + uint32_t aKeysInfoCount); + + private: + cdm::SessionType mSessionType; + std::string mSessionId; + Microsoft::WRL::ComPtr mCallbacks; + RefPtr mSessionManager; + + struct KeyInformation { + KeyInformation(const uint8_t* aKeyId, uint32_t aKeyIdSize, + cdm::KeyStatus aKeyStatus) + : mKeyId(aKeyId, aKeyId + aKeyIdSize), mKeyStatus(aKeyStatus) {} + std::vector mKeyId; + cdm::KeyStatus mKeyStatus; + }; + std::vector mKeyInfo; +}; + +} // namespace mozilla + +#endif // DOM_MEDIA_PLATFORM_WMF_CLEARKEY_WMFCLEARKEYSESSION_H -- cgit v1.2.3