OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "chromecast/browser/media/cast_media_client_android.h" |
| 6 |
| 7 #include <utility> |
| 8 |
| 9 #include "base/stl_util.h" |
| 10 #include "chromecast/media/base/key_systems_common.h" |
| 11 #include "chromecast/media/cdm/playready_drm_delegate_android.h" |
| 12 #include "components/cdm/browser/widevine_drm_delegate_android.h" |
| 13 |
| 14 namespace chromecast { |
| 15 namespace media { |
| 16 |
| 17 CastMediaClientAndroid::CastMediaClientAndroid() { |
| 18 #if defined(PLAYREADY_CDM_AVAILABLE) |
| 19 ::media::MediaDrmBridgeDelegate* playready_delegate = |
| 20 new PlayreadyDrmDelegateAndroid(); |
| 21 AddKeySystemUUIDMapping(kChromecastPlayreadyKeySystem, |
| 22 playready_delegate->GetUUID()); |
| 23 delegates_[playready_delegate->GetUUID()] = playready_delegate; |
| 24 #endif |
| 25 |
| 26 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 27 // Note: MediaDrmBridge adds the Widevine UUID mapping automatically. |
| 28 delegates_[widevine_delegate->GetUUID()] = |
| 29 new cdm::WidevineDrmDelegateAndroid(); |
| 30 #endif |
| 31 |
| 32 auto platform_mappings = GetPlatformKeySystemUUIDMappings(); |
| 33 for (const auto& mapping : platform_mappings) { |
| 34 AddKeySystemUUIDMapping(mapping.first, mapping.second); |
| 35 } |
| 36 } |
| 37 |
| 38 CastMediaClientAndroid::~CastMediaClientAndroid() { |
| 39 STLDeleteContainerPairSecondPointers(delegates_.begin(), delegates_.end()); |
| 40 } |
| 41 |
| 42 ::media::MediaDrmBridgeDelegate* |
| 43 CastMediaClientAndroid::GetMediaDrmBridgeDelegate( |
| 44 const ::media::UUID& scheme_uuid) const { |
| 45 DelegateMap::const_iterator it = delegates_.find(scheme_uuid); |
| 46 if (it == delegates_.end()) |
| 47 return nullptr; |
| 48 return it->second; |
| 49 } |
| 50 |
| 51 } // namespace media |
| 52 } // namespace chromecast |
OLD | NEW |