1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_CDM_STUB_STUB_CDM_H_
6 #define MEDIA_CDM_STUB_STUB_CDM_H_
8 #include "base/basictypes.h"
9 #include "media/cdm/ppapi/api/content_decryption_module.h"
13 typedef cdm::ContentDecryptionModule_8 StubCdmInterface
;
15 // Dummy implementation of the cdm::ContentDecryptionModule interface.
16 class StubCdm
: public StubCdmInterface
{
18 explicit StubCdm(Host
* host
);
21 // StubCdmInterface implementation.
22 void Initialize(bool allow_distinctive_identifier
,
23 bool allow_persistent_state
) override
;
24 void CreateSessionAndGenerateRequest(uint32 promise_id
,
25 cdm::SessionType session_type
,
26 cdm::InitDataType init_data_type
,
27 const uint8
* init_data
,
28 uint32 init_data_size
) override
;
29 void LoadSession(uint32 promise_id
,
30 cdm::SessionType session_type
,
31 const char* session_id
,
32 uint32_t session_id_length
) override
;
33 void UpdateSession(uint32 promise_id
,
34 const char* session_id
,
35 uint32_t session_id_length
,
36 const uint8
* response
,
37 uint32 response_size
) override
;
38 void CloseSession(uint32 promise_id
,
39 const char* session_id
,
40 uint32_t session_id_length
) override
;
41 void RemoveSession(uint32 promise_id
,
42 const char* session_id
,
43 uint32_t session_id_length
) override
;
44 void SetServerCertificate(uint32 promise_id
,
45 const uint8_t* server_certificate_data
,
46 uint32_t server_certificate_data_size
) override
;
47 void TimerExpired(void* context
) override
;
48 cdm::Status
Decrypt(const cdm::InputBuffer
& encrypted_buffer
,
49 cdm::DecryptedBlock
* decrypted_block
) override
;
50 cdm::Status
InitializeAudioDecoder(
51 const cdm::AudioDecoderConfig
& audio_decoder_config
) override
;
52 cdm::Status
InitializeVideoDecoder(
53 const cdm::VideoDecoderConfig
& video_decoder_config
) override
;
54 void DeinitializeDecoder(cdm::StreamType decoder_type
) override
;
55 void ResetDecoder(cdm::StreamType decoder_type
) override
;
56 cdm::Status
DecryptAndDecodeFrame(const cdm::InputBuffer
& encrypted_buffer
,
57 cdm::VideoFrame
* video_frame
) override
;
58 cdm::Status
DecryptAndDecodeSamples(const cdm::InputBuffer
& encrypted_buffer
,
59 cdm::AudioFrames
* audio_frames
) override
;
60 void Destroy() override
;
61 void OnPlatformChallengeResponse(
62 const cdm::PlatformChallengeResponse
& response
) override
;
63 void OnQueryOutputProtectionStatus(cdm::QueryResult result
,
65 uint32_t output_protection_mask
) override
;
68 // Helper function that rejects the promise specified by |promise_id|.
69 void FailRequest(uint32 promise_id
);
73 uint32 next_session_id_
;
75 DISALLOW_COPY_AND_ASSIGN(StubCdm
);
80 #endif // MEDIA_CDM_STUB_STUB_CDM_H_