Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / chromecast / media / cdm / playready_drm_delegate_android.cc
blob2cb856bdefcabc44e29e06123189ff80ac4f838e
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 #include "chromecast/media/cdm/playready_drm_delegate_android.h"
7 #include "base/logging.h"
8 #include "chromecast/media/cdm/chromecast_init_data.h"
10 namespace chromecast {
11 namespace media {
13 const uint8_t kPlayreadyUuid[16] = {
14 0x9a, 0x04, 0xf0, 0x79, 0x98, 0x40, 0x42, 0x86,
15 0xab, 0x92, 0xe6, 0x5b, 0xe0, 0x88, 0x5f, 0x95};
17 PlayreadyDrmDelegateAndroid::PlayreadyDrmDelegateAndroid() {
20 PlayreadyDrmDelegateAndroid::~PlayreadyDrmDelegateAndroid() {
23 const ::media::UUID PlayreadyDrmDelegateAndroid::GetUUID() const {
24 return ::media::UUID(kPlayreadyUuid,
25 kPlayreadyUuid + arraysize(kPlayreadyUuid));
28 bool PlayreadyDrmDelegateAndroid::OnCreateSession(
29 const ::media::EmeInitDataType init_data_type,
30 const std::vector<uint8_t>& init_data,
31 std::vector<uint8_t>* /* init_data_out */,
32 std::vector<std::string>* optional_parameters_out) {
33 if (init_data_type == ::media::EmeInitDataType::CENC) {
34 ChromecastInitData custom_data;
35 if (FindChromecastInitData(init_data, InitDataMessageType::CUSTOM_DATA,
36 &custom_data)) {
37 optional_parameters_out->clear();
38 optional_parameters_out->push_back("PRCustomData");
39 optional_parameters_out->push_back(
40 std::string(custom_data.data.begin(), custom_data.data.end()));
41 LOG(INFO) << "Including " << custom_data.data.size()
42 << " bytes of custom PlayReady data";
45 return true;
48 } // namespace media
49 } // namespace chromecast