| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <cstring> | 5 #include <cstring> |
| 6 #include <map> | 6 #include <map> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "media/cdm/ppapi/api/content_decryption_module.h" |
| 14 #include "media/cdm/ppapi/linked_ptr.h" |
| 13 #include "ppapi/c/pp_errors.h" | 15 #include "ppapi/c/pp_errors.h" |
| 14 #include "ppapi/c/pp_stdint.h" | 16 #include "ppapi/c/pp_stdint.h" |
| 15 #include "ppapi/c/private/pp_content_decryptor.h" | 17 #include "ppapi/c/private/pp_content_decryptor.h" |
| 16 #include "ppapi/cpp/completion_callback.h" | 18 #include "ppapi/cpp/completion_callback.h" |
| 17 #include "ppapi/cpp/core.h" | 19 #include "ppapi/cpp/core.h" |
| 18 #include "ppapi/cpp/dev/buffer_dev.h" | 20 #include "ppapi/cpp/dev/buffer_dev.h" |
| 19 #include "ppapi/cpp/instance.h" | 21 #include "ppapi/cpp/instance.h" |
| 20 #include "ppapi/cpp/logging.h" | 22 #include "ppapi/cpp/logging.h" |
| 21 #include "ppapi/cpp/module.h" | 23 #include "ppapi/cpp/module.h" |
| 22 #include "ppapi/cpp/pass_ref.h" | 24 #include "ppapi/cpp/pass_ref.h" |
| 23 #include "ppapi/cpp/private/content_decryptor_private.h" | 25 #include "ppapi/cpp/private/content_decryptor_private.h" |
| 24 #include "ppapi/cpp/resource.h" | 26 #include "ppapi/cpp/resource.h" |
| 25 #include "ppapi/cpp/var.h" | 27 #include "ppapi/cpp/var.h" |
| 26 #include "ppapi/cpp/var_array_buffer.h" | 28 #include "ppapi/cpp/var_array_buffer.h" |
| 27 #include "ppapi/utility/completion_callback_factory.h" | 29 #include "ppapi/utility/completion_callback_factory.h" |
| 28 #include "webkit/renderer/media/crypto/ppapi/cdm/content_decryption_module.h" | |
| 29 #include "webkit/renderer/media/crypto/ppapi/linked_ptr.h" | |
| 30 | 30 |
| 31 #if defined(CHECK_DOCUMENT_URL) | 31 #if defined(CHECK_DOCUMENT_URL) |
| 32 #include "ppapi/cpp/dev/url_util_dev.h" | 32 #include "ppapi/cpp/dev/url_util_dev.h" |
| 33 #include "ppapi/cpp/instance_handle.h" | 33 #include "ppapi/cpp/instance_handle.h" |
| 34 #endif // defined(CHECK_DOCUMENT_URL) | 34 #endif // defined(CHECK_DOCUMENT_URL) |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 bool IsMainThread() { | 38 bool IsMainThread() { |
| 39 return pp::Module::Get()->core()->IsMainThread(); | 39 return pp::Module::Get()->core()->IsMainThread(); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 case PP_DECRYPTORSTREAMTYPE_VIDEO: | 197 case PP_DECRYPTORSTREAMTYPE_VIDEO: |
| 198 return cdm::kStreamTypeVideo; | 198 return cdm::kStreamTypeVideo; |
| 199 } | 199 } |
| 200 | 200 |
| 201 PP_NOTREACHED(); | 201 PP_NOTREACHED(); |
| 202 return cdm::kStreamTypeVideo; | 202 return cdm::kStreamTypeVideo; |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace | 205 } // namespace |
| 206 | 206 |
| 207 namespace webkit_media { | 207 namespace media { |
| 208 | 208 |
| 209 // cdm::Buffer implementation that provides access to memory owned by a | 209 // cdm::Buffer implementation that provides access to memory owned by a |
| 210 // pp::Buffer_Dev. | 210 // pp::Buffer_Dev. |
| 211 // This class holds a reference to the Buffer_Dev throughout its lifetime. | 211 // This class holds a reference to the Buffer_Dev throughout its lifetime. |
| 212 // TODO(xhwang): Find a better name. It's confusing to have PpbBuffer, | 212 // TODO(xhwang): Find a better name. It's confusing to have PpbBuffer, |
| 213 // pp::Buffer_Dev and PPB_Buffer_Dev. | 213 // pp::Buffer_Dev and PPB_Buffer_Dev. |
| 214 class PpbBuffer : public cdm::Buffer { | 214 class PpbBuffer : public cdm::Buffer { |
| 215 public: | 215 public: |
| 216 static PpbBuffer* Create(const pp::Buffer_Dev& buffer, uint32_t buffer_id) { | 216 static PpbBuffer* Create(const pp::Buffer_Dev& buffer, uint32_t buffer_id) { |
| 217 PP_DCHECK(buffer.data()); | 217 PP_DCHECK(buffer.data()); |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 } | 1179 } |
| 1180 virtual ~CdmWrapperModule() { | 1180 virtual ~CdmWrapperModule() { |
| 1181 DeinitializeCdmModule(); | 1181 DeinitializeCdmModule(); |
| 1182 } | 1182 } |
| 1183 | 1183 |
| 1184 virtual pp::Instance* CreateInstance(PP_Instance instance) { | 1184 virtual pp::Instance* CreateInstance(PP_Instance instance) { |
| 1185 return new CdmWrapper(instance, this); | 1185 return new CdmWrapper(instance, this); |
| 1186 } | 1186 } |
| 1187 }; | 1187 }; |
| 1188 | 1188 |
| 1189 } // namespace webkit_media | 1189 } // namespace media |
| 1190 | 1190 |
| 1191 namespace pp { | 1191 namespace pp { |
| 1192 | 1192 |
| 1193 // Factory function for your specialization of the Module object. | 1193 // Factory function for your specialization of the Module object. |
| 1194 Module* CreateModule() { | 1194 Module* CreateModule() { |
| 1195 return new webkit_media::CdmWrapperModule(); | 1195 return new media::CdmWrapperModule(); |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 } // namespace pp | 1198 } // namespace pp |
| OLD | NEW |