Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: chromecast/browser/media/cast_media_client_android.cc

Issue 962793005: Adds MediaClientAndroid to support embedder/MediaDrmBridge interaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: overhaul: creates MediaClientAndroid (browser-side client), eliminates Java-based MediaDrmBridge ke… Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 mappings_.push_back(std::make_pair(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;
xhwang 2015/04/24 04:52:23 ditto about new Foo().
gunsch 2015/04/27 23:44:11 Done.
30 #endif
31
32 auto platform_mappings = GetPlatformKeySystemUUIDMappings();
33 mappings_.insert(mappings_.end(),
34 platform_mappings.begin(),
35 platform_mappings.end());
36 }
37
38 CastMediaClientAndroid::~CastMediaClientAndroid() {
39 STLDeleteContainerPairSecondPointers(delegates_.begin(), delegates_.end());
xhwang 2015/04/24 04:52:23 If you use ScopedPtrHashMap, then you don't need t
gunsch 2015/04/27 23:44:12 Unfortunately there's no hash function for std::ve
xhwang 2015/04/28 05:25:11 Acknowledged.
40 }
41
42 std::vector<std::pair<std::string, std::vector<uint8_t>>>
43 CastMediaClientAndroid::GetKeySystemUUIDMappings() const {
44 return mappings_;
45 }
46
47 ::media::MediaDrmBridgeDelegate*
48 CastMediaClientAndroid::GetMediaDrmBridgeDelegate(
49 const std::vector<uint8_t>& scheme_uuid) const {
50 DelegateMap::const_iterator it = delegates_.find(scheme_uuid);
51 if (it == delegates_.end())
52 return nullptr;
53 return it->second;
54 }
55
56 } // namespace media
57 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698