OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "components/cdm/renderer/android_key_systems.h" | |
6 | |
7 #include <string> | |
8 #include <vector> | |
9 | |
10 #include "base/logging.h" | |
11 #include "components/cdm/common/cdm_messages_android.h" | |
12 #include "components/cdm/renderer/widevine_key_systems.h" | |
13 #include "content/public/renderer/render_thread.h" | |
14 | |
15 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | |
16 | |
17 using content::KeySystemInfo; | |
18 using content::SupportedCodecs; | |
19 | |
20 namespace cdm { | |
21 | |
22 static SupportedKeySystemResponse GetSupportedKeySystem( | |
ddorwin
2014/06/10 18:48:04
ditto on naming
ycheo (away)
2014/06/11 00:08:22
Done.
| |
23 const std::string& key_system) { | |
24 SupportedKeySystemRequest request; | |
25 SupportedKeySystemResponse response; | |
26 | |
27 request.key_system = key_system; | |
28 request.codecs = content::EME_CODEC_WEBM_ALL | content::EME_CODEC_MP4_ALL; | |
29 content::RenderThread::Get()->Send( | |
30 new CdmHostMsg_GetSupportedKeySystem(request, &response)); | |
31 DCHECK(response.compositing_codecs & content::EME_CODEC_ALL) | |
ddorwin
2014/06/10 18:48:04
This only checks that there is at least one suppor
ycheo (away)
2014/06/11 00:08:22
Good catch!.
| |
32 << "unrecognized codec"; | |
33 DCHECK(response.non_compositing_codecs & content::EME_CODEC_ALL) | |
34 << "unrecognized codec"; | |
35 return response; | |
36 } | |
37 | |
38 void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) { | |
39 SupportedKeySystemResponse response; | |
40 response = GetSupportedKeySystem(kWidevineKeySystem); | |
ddorwin
2014/06/10 18:48:04
merge with the line above.
ycheo (away)
2014/06/11 00:08:22
Done.
| |
41 if (response.compositing_codecs != content::EME_CODEC_NONE) { | |
42 AddWidevineWithCodecs( | |
43 WIDEVINE, | |
44 static_cast<SupportedCodecs>(response.compositing_codecs), | |
45 concrete_key_systems); | |
46 } | |
47 | |
48 if (response.non_compositing_codecs != content::EME_CODEC_NONE) { | |
49 AddWidevineWithCodecs( | |
50 WIDEVINE_HR_NON_COMPOSITING, | |
51 static_cast<SupportedCodecs>(response.non_compositing_codecs), | |
52 concrete_key_systems); | |
53 } | |
54 } | |
55 | |
56 void AddOtherAndroidSupportedKeySystems( | |
57 std::vector<KeySystemInfo>* concrete_key_systems) { | |
58 std::vector<std::string> key_system_names; | |
59 content::RenderThread::Get()->Send( | |
60 new CdmHostMsg_GetAllSupportedKeySystemNames(&key_system_names)); | |
61 | |
62 for (std::vector<std::string>::const_iterator it = key_system_names.begin(); | |
63 it != key_system_names.end(); ++it) { | |
64 if (it->compare(kWidevineKeySystem) == 0) // Skip Widevine. | |
65 continue; | |
66 | |
67 SupportedKeySystemResponse response = GetSupportedKeySystem(*it); | |
68 if (response.compositing_codecs != content::EME_CODEC_NONE) { | |
ddorwin
2014/06/10 18:48:04
Don't you want to support non-compositing?
ycheo (away)
2014/06/11 00:08:22
no, but the keysyste name suffix '.noncompositing'
ddorwin
2014/06/11 01:54:01
Right.
I don't know what the use case is or even
| |
69 KeySystemInfo info(*it); | |
70 info.supported_codecs = response.compositing_codecs; | |
71 concrete_key_systems->push_back(info); | |
72 } | |
73 } | |
74 } | |
75 | |
76 } // namespace cdm | |
OLD | NEW |