OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "components/cdm/browser/widevine_drm_delegate_android.h" | 5 #include "components/cdm/common/widevine_drm_delegate_android.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "media/cdm/cenc_utils.h" | 8 #include "media/cdm/cenc_utils.h" |
9 | 9 |
10 namespace cdm { | 10 namespace cdm { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 const uint8_t kWidevineUuid[16] = { | 14 const uint8_t kWidevineUuid[16] = { |
15 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, | 15 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, // |
16 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED }; | 16 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED}; |
17 | 17 |
18 } // namespace | 18 } // namespace |
19 | 19 |
20 WidevineDrmDelegateAndroid::WidevineDrmDelegateAndroid() { | 20 WidevineDrmDelegateAndroid::WidevineDrmDelegateAndroid() {} |
21 } | |
22 | 21 |
23 WidevineDrmDelegateAndroid::~WidevineDrmDelegateAndroid() { | 22 WidevineDrmDelegateAndroid::~WidevineDrmDelegateAndroid() {} |
24 } | |
25 | 23 |
26 const std::vector<uint8_t> WidevineDrmDelegateAndroid::GetUUID() const { | 24 const std::vector<uint8_t> WidevineDrmDelegateAndroid::GetUUID() const { |
27 return std::vector<uint8_t>(kWidevineUuid, | 25 return std::vector<uint8_t>(kWidevineUuid, |
28 kWidevineUuid + arraysize(kWidevineUuid)); | 26 kWidevineUuid + arraysize(kWidevineUuid)); |
29 } | 27 } |
30 | 28 |
31 bool WidevineDrmDelegateAndroid::OnCreateSession( | 29 bool WidevineDrmDelegateAndroid::OnCreateSession( |
32 const media::EmeInitDataType init_data_type, | 30 const media::EmeInitDataType init_data_type, |
33 const std::vector<uint8_t>& init_data, | 31 const std::vector<uint8_t>& init_data, |
34 std::vector<uint8_t>* init_data_out, | 32 std::vector<uint8_t>* init_data_out, |
35 std::vector<std::string>* /* optional_parameters_out */) { | 33 std::vector<std::string>* /* optional_parameters_out */) { |
36 if (init_data_type != media::EmeInitDataType::CENC) | 34 if (init_data_type != media::EmeInitDataType::CENC) |
37 return true; | 35 return true; |
38 | 36 |
39 #if defined(USE_PROPRIETARY_CODECS) | 37 #if defined(USE_PROPRIETARY_CODECS) |
40 // Widevine MediaDrm plugin only accepts the "data" part of the PSSH box as | 38 // Widevine MediaDrm plugin only accepts the "data" part of the PSSH box as |
41 // the init data when using MP4 container. | 39 // the init data when using MP4 container. |
42 return media::GetPsshData(init_data, GetUUID(), init_data_out); | 40 return media::GetPsshData(init_data, GetUUID(), init_data_out); |
43 #else | 41 #else |
44 return false; | 42 return false; |
45 #endif | 43 #endif |
46 } | 44 } |
47 | 45 |
48 } // namespace cdm | 46 } // namespace cdm |
OLD | NEW |