OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/renderer/android_key_systems.h" | 5 #include "components/cdm/renderer/android_key_systems.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "components/cdm/common/cdm_messages_android.h" | 11 #include "components/cdm/common/cdm_messages_android.h" |
12 #include "components/cdm/renderer/widevine_key_systems.h" | 12 #include "components/cdm/renderer/widevine_key_systems.h" |
13 #include "content/public/common/eme_constants.h" | |
14 #include "content/public/renderer/render_thread.h" | 13 #include "content/public/renderer/render_thread.h" |
| 14 #include "media/base/eme_constants.h" |
15 | 15 |
16 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 16 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
17 | 17 |
18 using content::KeySystemInfo; | 18 using media::KeySystemInfo; |
19 using content::SupportedCodecs; | 19 using media::SupportedCodecs; |
20 | 20 |
21 namespace cdm { | 21 namespace cdm { |
22 | 22 |
23 static SupportedKeySystemResponse QueryKeySystemSupport( | 23 static SupportedKeySystemResponse QueryKeySystemSupport( |
24 const std::string& key_system) { | 24 const std::string& key_system) { |
25 SupportedKeySystemRequest request; | 25 SupportedKeySystemRequest request; |
26 SupportedKeySystemResponse response; | 26 SupportedKeySystemResponse response; |
27 | 27 |
28 request.key_system = key_system; | 28 request.key_system = key_system; |
29 request.codecs = content::EME_CODEC_ALL; | 29 request.codecs = media::EME_CODEC_ALL; |
30 content::RenderThread::Get()->Send( | 30 content::RenderThread::Get()->Send( |
31 new ChromeViewHostMsg_QueryKeySystemSupport(request, &response)); | 31 new ChromeViewHostMsg_QueryKeySystemSupport(request, &response)); |
32 DCHECK(!(response.compositing_codecs & ~content::EME_CODEC_ALL)) | 32 DCHECK(!(response.compositing_codecs & ~media::EME_CODEC_ALL)) |
33 << "unrecognized codec"; | 33 << "unrecognized codec"; |
34 DCHECK(!(response.non_compositing_codecs & ~content::EME_CODEC_ALL)) | 34 DCHECK(!(response.non_compositing_codecs & ~media::EME_CODEC_ALL)) |
35 << "unrecognized codec"; | 35 << "unrecognized codec"; |
36 return response; | 36 return response; |
37 } | 37 } |
38 | 38 |
39 void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) { | 39 void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) { |
40 SupportedKeySystemResponse response = QueryKeySystemSupport( | 40 SupportedKeySystemResponse response = QueryKeySystemSupport( |
41 kWidevineKeySystem); | 41 kWidevineKeySystem); |
42 if (response.compositing_codecs != content::EME_CODEC_NONE) { | 42 if (response.compositing_codecs != media::EME_CODEC_NONE) { |
43 AddWidevineWithCodecs( | 43 AddWidevineWithCodecs( |
44 WIDEVINE, | 44 WIDEVINE, |
45 static_cast<SupportedCodecs>(response.compositing_codecs), | 45 static_cast<SupportedCodecs>(response.compositing_codecs), |
46 concrete_key_systems); | 46 concrete_key_systems); |
47 } | 47 } |
48 | 48 |
49 if (response.non_compositing_codecs != content::EME_CODEC_NONE) { | 49 if (response.non_compositing_codecs != media::EME_CODEC_NONE) { |
50 AddWidevineWithCodecs( | 50 AddWidevineWithCodecs( |
51 WIDEVINE_HR_NON_COMPOSITING, | 51 WIDEVINE_HR_NON_COMPOSITING, |
52 static_cast<SupportedCodecs>(response.non_compositing_codecs), | 52 static_cast<SupportedCodecs>(response.non_compositing_codecs), |
53 concrete_key_systems); | 53 concrete_key_systems); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 void AddAndroidPlatformKeySystems( | 57 void AddAndroidPlatformKeySystems( |
58 std::vector<KeySystemInfo>* concrete_key_systems) { | 58 std::vector<KeySystemInfo>* concrete_key_systems) { |
59 std::vector<std::string> key_system_names; | 59 std::vector<std::string> key_system_names; |
60 content::RenderThread::Get()->Send( | 60 content::RenderThread::Get()->Send( |
61 new ChromeViewHostMsg_GetPlatformKeySystemNames(&key_system_names)); | 61 new ChromeViewHostMsg_GetPlatformKeySystemNames(&key_system_names)); |
62 | 62 |
63 for (std::vector<std::string>::const_iterator it = key_system_names.begin(); | 63 for (std::vector<std::string>::const_iterator it = key_system_names.begin(); |
64 it != key_system_names.end(); ++it) { | 64 it != key_system_names.end(); ++it) { |
65 SupportedKeySystemResponse response = QueryKeySystemSupport(*it); | 65 SupportedKeySystemResponse response = QueryKeySystemSupport(*it); |
66 if (response.compositing_codecs != content::EME_CODEC_NONE) { | 66 if (response.compositing_codecs != media::EME_CODEC_NONE) { |
67 KeySystemInfo info(*it); | 67 KeySystemInfo info(*it); |
68 info.supported_codecs = response.compositing_codecs; | 68 info.supported_codecs = response.compositing_codecs; |
69 // Here we assume that support for a container implies support for the | 69 // Here we assume that support for a container implies support for the |
70 // associated initialization data type. KeySystems handles validating | 70 // associated initialization data type. KeySystems handles validating |
71 // |init_data_type| x |container| pairings. | 71 // |init_data_type| x |container| pairings. |
72 if (response.compositing_codecs & content::EME_CODEC_WEBM_ALL) | 72 if (response.compositing_codecs & media::EME_CODEC_WEBM_ALL) |
73 info.supported_init_data_types |= content::EME_INIT_DATA_TYPE_WEBM; | 73 info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_WEBM; |
74 #if defined(USE_PROPRIETARY_CODECS) | 74 #if defined(USE_PROPRIETARY_CODECS) |
75 if (response.compositing_codecs & content::EME_CODEC_MP4_ALL) | 75 if (response.compositing_codecs & media::EME_CODEC_MP4_ALL) |
76 info.supported_init_data_types |= content::EME_INIT_DATA_TYPE_CENC; | 76 info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC; |
77 #endif // defined(USE_PROPRIETARY_CODECS) | 77 #endif // defined(USE_PROPRIETARY_CODECS) |
78 concrete_key_systems->push_back(info); | 78 concrete_key_systems->push_back(info); |
79 } | 79 } |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 } // namespace cdm | 83 } // namespace cdm |
OLD | NEW |