Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1467)

Unified Diff: media/cdm/ppapi/stub/stub_cdm.cc

Issue 1043673002: Allow widevinecdmadapter to be built in Chromium (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/cdm/ppapi/stub/stub_cdm.cc
diff --git a/media/cdm/ppapi/stub/stub_cdm.cc b/media/cdm/ppapi/stub/stub_cdm.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5eec4501c6cf83e74eb1a7e96957081428ef8fe5
--- /dev/null
+++ b/media/cdm/ppapi/stub/stub_cdm.cc
@@ -0,0 +1,153 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/cdm/ppapi/stub/stub_cdm.h"
+
+#include "base/logging.h"
+
+const char kStubCdmVersion[] = "0.1.0.1";
xhwang 2015/03/30 17:23:50 Let's have some versioning scheme here. How about
jrummell 2015/04/01 23:37:36 Is the version used for anything? Changed to 1.4.8
+
+void INITIALIZE_CDM_MODULE() {
+}
+
+void DeinitializeCdmModule() {
+}
+
+void* CreateCdmInstance(int cdm_interface_version,
+ const char* /* key_system */,
+ uint32_t /* key_system_size */,
+ GetCdmHostFunc get_cdm_host_func,
+ void* user_data) {
+ DVLOG(1) << "CreateCdmInstance()";
+
+ if (cdm_interface_version != media::StubCdmInterface::kVersion)
+ return nullptr;
+
+ media::StubCdmInterface::Host* host =
+ static_cast<media::StubCdmInterface::Host*>(get_cdm_host_func(
+ media::StubCdmInterface::Host::kVersion, user_data));
+ if (!host)
+ return nullptr;
+
+ return new media::StubCdm(host);
+}
+
+const char* GetCdmVersion() {
+ return kStubCdmVersion;
+}
+
+namespace media {
+
+StubCdm::StubCdm(Host* host) : host_(host) {
+}
+
+StubCdm::~StubCdm() {
+}
+
+void StubCdm::Initialize(bool /* allow_distinctive_identifier */,
+ bool /* allow_persistent_state */) {
+}
+
+void StubCdm::CreateSessionAndGenerateRequest(
+ uint32 promise_id,
+ cdm::SessionType /* session_type */,
+ cdm::InitDataType /* init_data_type */,
+ const uint8* /* init_data */,
+ uint32 /* init_data_size */) {
+ FailRequest(promise_id);
ddorwin 2015/03/28 04:00:11 Succeed if the parameters are valid. Also, call ho
jrummell 2015/04/01 23:37:36 Done.
+}
+
+void StubCdm::LoadSession(uint32 promise_id,
+ cdm::SessionType /* session_type */,
+ const char* /* session_id */,
+ uint32_t /* session_id_length */) {
+ FailRequest(promise_id);
+}
+
+void StubCdm::UpdateSession(uint32 promise_id,
+ const char* /* session_id */,
+ uint32_t /* session_id_length */,
+ const uint8* /* response */,
+ uint32 /* response_size */) {
+ FailRequest(promise_id);
+}
+
+void StubCdm::CloseSession(uint32 promise_id,
+ const char* /* session_id */,
+ uint32_t /* session_id_length */) {
+ FailRequest(promise_id);
+}
+
+void StubCdm::RemoveSession(uint32 promise_id,
+ const char* /* session_id */,
+ uint32_t /* session_id_length */) {
+ FailRequest(promise_id);
+}
+
+void StubCdm::SetServerCertificate(
+ uint32 promise_id,
+ const uint8_t* /* server_certificate_data */,
+ uint32_t /* server_certificate_data_size */) {
+ FailRequest(promise_id);
+}
+
+void StubCdm::TimerExpired(void* /* context */) {
+}
+
+cdm::Status StubCdm::Decrypt(const cdm::InputBuffer& /* encrypted_buffer */,
+ cdm::DecryptedBlock* /* decrypted_block */) {
+ return cdm::kDecryptError;
+}
+
+cdm::Status StubCdm::InitializeAudioDecoder(
+ const cdm::AudioDecoderConfig& /* audio_decoder_config */) {
+ return cdm::kDecryptError;
+}
+
+cdm::Status StubCdm::InitializeVideoDecoder(
+ const cdm::VideoDecoderConfig& /* video_decoder_config */) {
+ return cdm::kDecryptError;
+}
+
+void StubCdm::ResetDecoder(cdm::StreamType /* decoder_type */) {
+}
+
+void StubCdm::DeinitializeDecoder(cdm::StreamType /* decoder_type */) {
+}
+
+cdm::Status StubCdm::DecryptAndDecodeFrame(
+ const cdm::InputBuffer& /* encrypted_buffer */,
+ cdm::VideoFrame* /* decoded_frame */) {
+ return cdm::kDecryptError;
+}
+
+cdm::Status StubCdm::DecryptAndDecodeSamples(
+ const cdm::InputBuffer& /* encrypted_buffer */,
+ cdm::AudioFrames* /* audio_frames */) {
+ return cdm::kDecryptError;
+}
+
+void StubCdm::Destroy() {
+ delete this;
+}
+
+void StubCdm::OnPlatformChallengeResponse(
+ const cdm::PlatformChallengeResponse& /* response */) {
+ NOTIMPLEMENTED();
xhwang 2015/03/30 17:23:50 NOTREACHED();
jrummell 2015/04/01 23:37:36 Done.
+}
+
+void StubCdm::OnQueryOutputProtectionStatus(
+ cdm::QueryResult /* result */,
+ uint32_t /* link_mask */,
+ uint32_t /* output_protection_mask */) {
+ NOTIMPLEMENTED();
xhwang 2015/03/30 17:23:50 NOTREACHED();
jrummell 2015/04/01 23:37:36 Done.
+};
+
+void StubCdm::FailRequest(uint32 promise_id) {
+ std::string message("Stub CDM.");
xhwang 2015/03/30 17:23:50 nit: "Operation not supported by stub CDM"?
jrummell 2015/04/01 23:37:36 Done.
+ host_->OnRejectPromise(promise_id, cdm::kInvalidAccessError, 0,
+ message.data(), message.length());
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698