diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /dom/media/fake-cdm/cdm-test-decryptor.h | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/fake-cdm/cdm-test-decryptor.h')
-rw-r--r-- | dom/media/fake-cdm/cdm-test-decryptor.h | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/dom/media/fake-cdm/cdm-test-decryptor.h b/dom/media/fake-cdm/cdm-test-decryptor.h new file mode 100644 index 0000000000..30486e06ae --- /dev/null +++ b/dom/media/fake-cdm/cdm-test-decryptor.h @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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 FAKE_DECRYPTOR_H__ +#define FAKE_DECRYPTOR_H__ + +#include "content_decryption_module.h" +#include <string> +#include "mozilla/Attributes.h" + +class FakeDecryptor : public cdm::ContentDecryptionModule_10 { + public: + explicit FakeDecryptor(cdm::Host_10* aHost); + + void Initialize(bool aAllowDistinctiveIdentifier, bool aAllowPersistentState, + bool aUseHardwareSecureCodecs) override { + mHost->OnInitialized(true); + } + + void GetStatusForPolicy(uint32_t aPromiseId, + const cdm::Policy& aPolicy) override {} + + void SetServerCertificate(uint32_t aPromiseId, + const uint8_t* aServerCertificateData, + uint32_t aServerCertificateDataSize) override {} + + void CreateSessionAndGenerateRequest(uint32_t aPromiseId, + cdm::SessionType aSessionType, + cdm::InitDataType aInitDataType, + const uint8_t* aInitData, + uint32_t aInitDataSize) override {} + + void LoadSession(uint32_t aPromiseId, cdm::SessionType aSessionType, + const char* aSessionId, uint32_t aSessionIdSize) override {} + + void UpdateSession(uint32_t aPromiseId, const char* aSessionId, + uint32_t aSessionIdSize, const uint8_t* aResponse, + uint32_t aResponseSize) override; + + void CloseSession(uint32_t aPromiseId, const char* aSessionId, + uint32_t aSessionIdSize) override {} + + void RemoveSession(uint32_t aPromiseId, const char* aSessionId, + uint32_t aSessionIdSize) override {} + + void TimerExpired(void* aContext) override {} + + cdm::Status Decrypt(const cdm::InputBuffer_2& aEncryptedBuffer, + cdm::DecryptedBlock* aDecryptedBuffer) override { + return cdm::Status::kDecodeError; + } + + cdm::Status InitializeAudioDecoder( + const cdm::AudioDecoderConfig_2& aAudioDecoderConfig) override { + return cdm::Status::kDecodeError; + } + + cdm::Status InitializeVideoDecoder( + const cdm::VideoDecoderConfig_2& aVideoDecoderConfig) override { + return cdm::Status::kDecodeError; + } + + void DeinitializeDecoder(cdm::StreamType aDecoderType) override {} + + void ResetDecoder(cdm::StreamType aDecoderType) override {} + + cdm::Status DecryptAndDecodeFrame(const cdm::InputBuffer_2& aEncryptedBuffer, + cdm::VideoFrame* aVideoFrame) override { + return cdm::Status::kDecodeError; + } + + cdm::Status DecryptAndDecodeSamples( + const cdm::InputBuffer_2& aEncryptedBuffer, + cdm::AudioFrames* aAudioFrame) override { + return cdm::Status::kDecodeError; + } + + void OnPlatformChallengeResponse( + const cdm::PlatformChallengeResponse& aResponse) override {} + + void OnQueryOutputProtectionStatus(cdm::QueryResult aResult, + uint32_t aLinkMask, + uint32_t aOutputProtectionMask) override {} + + void OnStorageId(uint32_t aVersion, const uint8_t* aStorageId, + uint32_t aStorageIdSize) override {} + + void Destroy() override { + delete this; + sInstance = nullptr; + } + + static void Message(const std::string& aMessage); + + cdm::Host_10* mHost; + + static FakeDecryptor* sInstance; + + private: + virtual ~FakeDecryptor() = default; + + void TestStorage(); +}; + +#endif |