| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/media/crypto/encrypted_media_player_support_impl.h" | 5 #include "content/renderer/media/crypto/encrypted_media_player_support_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // so we keep it as simple as possible without breaking major use cases. | 116 // so we keep it as simple as possible without breaking major use cases. |
| 117 static std::string GuessInitDataType(const unsigned char* init_data, | 117 static std::string GuessInitDataType(const unsigned char* init_data, |
| 118 unsigned init_data_length) { | 118 unsigned init_data_length) { |
| 119 // Most WebM files use KeyId of 16 bytes. MP4 init data are always >16 bytes. | 119 // Most WebM files use KeyId of 16 bytes. MP4 init data are always >16 bytes. |
| 120 if (init_data_length == 16) | 120 if (init_data_length == 16) |
| 121 return "video/webm"; | 121 return "video/webm"; |
| 122 | 122 |
| 123 return "video/mp4"; | 123 return "video/mp4"; |
| 124 } | 124 } |
| 125 | 125 |
| 126 scoped_ptr<EncryptedMediaPlayerSupport> EncryptedMediaPlayerSupport::Create( | |
| 127 blink::WebMediaPlayerClient* client) { | |
| 128 return scoped_ptr<EncryptedMediaPlayerSupport>( | |
| 129 new EncryptedMediaPlayerSupportImpl(client)); | |
| 130 } | |
| 131 | |
| 132 EncryptedMediaPlayerSupportImpl::EncryptedMediaPlayerSupportImpl( | 126 EncryptedMediaPlayerSupportImpl::EncryptedMediaPlayerSupportImpl( |
| 133 blink::WebMediaPlayerClient* client) | 127 blink::WebMediaPlayerClient* client) |
| 134 : client_(client), | 128 : client_(client), |
| 135 web_cdm_(NULL) { | 129 web_cdm_(NULL) { |
| 136 } | 130 } |
| 137 | 131 |
| 138 EncryptedMediaPlayerSupportImpl::~EncryptedMediaPlayerSupportImpl() { | 132 EncryptedMediaPlayerSupportImpl::~EncryptedMediaPlayerSupportImpl() { |
| 139 } | 133 } |
| 140 | 134 |
| 141 WebMediaPlayer::MediaKeyException | 135 WebMediaPlayer::MediaKeyException |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 456 |
| 463 if (web_cdm_) { | 457 if (web_cdm_) { |
| 464 decryptor_ready_cb.Run(web_cdm_->GetDecryptor(), base::Bind(DoNothing)); | 458 decryptor_ready_cb.Run(web_cdm_->GetDecryptor(), base::Bind(DoNothing)); |
| 465 return; | 459 return; |
| 466 } | 460 } |
| 467 | 461 |
| 468 decryptor_ready_cb_ = decryptor_ready_cb; | 462 decryptor_ready_cb_ = decryptor_ready_cb; |
| 469 } | 463 } |
| 470 | 464 |
| 471 } // namespace content | 465 } // namespace content |
| OLD | NEW |