OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "media/base/android/media_drm_bridge.h" | 5 #include "media/base/android/media_drm_bridge.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 return std::string(session_id_vector.begin(), session_id_vector.end()); | 49 return std::string(session_id_vector.begin(), session_id_vector.end()); |
50 } | 50 } |
51 | 51 |
52 const uint8 kWidevineUuid[16] = { | 52 const uint8 kWidevineUuid[16] = { |
53 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, | 53 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, |
54 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED }; | 54 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED }; |
55 | 55 |
56 // Convert |init_data_type| to a string supported by MediaDRM. | 56 // Convert |init_data_type| to a string supported by MediaDRM. |
57 // "audio"/"video" does not matter, so use "video". | 57 // "audio"/"video" does not matter, so use "video". |
58 std::string ConvertInitDataType(media::EmeInitDataType init_data_type) { | 58 std::string ConvertInitDataType(media::EmeInitDataType init_data_type) { |
59 // TODO(jrummell): API level >=20 supports "webm" and "cenc", so switch | 59 // TODO(jrummell/xhwang): EME init data types like "webm" and "cenc" are |
60 // to those strings. | 60 // supported in API level >=21 for Widevine key system. Switch to use those |
| 61 // strings when they are officially supported in Android for all key systems. |
61 switch (init_data_type) { | 62 switch (init_data_type) { |
62 case media::EmeInitDataType::WEBM: | 63 case media::EmeInitDataType::WEBM: |
63 return "video/webm"; | 64 return "video/webm"; |
64 case media::EmeInitDataType::CENC: | 65 case media::EmeInitDataType::CENC: |
65 return "video/mp4"; | 66 return "video/mp4"; |
| 67 case media::EmeInitDataType::KEYIDS: |
| 68 return "keyids"; |
66 default: | 69 default: |
67 NOTREACHED(); | 70 NOTREACHED(); |
68 return "video/unknown"; | 71 return "unknown"; |
69 } | 72 } |
70 } | 73 } |
71 | 74 |
72 class KeySystemManager { | 75 class KeySystemManager { |
73 public: | 76 public: |
74 KeySystemManager(); | 77 KeySystemManager(); |
75 UUID GetUUID(const std::string& key_system); | 78 UUID GetUUID(const std::string& key_system); |
76 std::vector<std::string> GetPlatformKeySystemNames(); | 79 std::vector<std::string> GetPlatformKeySystemNames(); |
77 | 80 |
78 private: | 81 private: |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 JNIEnv* env = AttachCurrentThread(); | 539 JNIEnv* env = AttachCurrentThread(); |
537 Java_MediaDrmBridge_resetDeviceCredentials(env, j_media_drm_.obj()); | 540 Java_MediaDrmBridge_resetDeviceCredentials(env, j_media_drm_.obj()); |
538 } | 541 } |
539 | 542 |
540 void MediaDrmBridge::OnResetDeviceCredentialsCompleted( | 543 void MediaDrmBridge::OnResetDeviceCredentialsCompleted( |
541 JNIEnv* env, jobject, bool success) { | 544 JNIEnv* env, jobject, bool success) { |
542 base::ResetAndReturn(&reset_credentials_cb_).Run(success); | 545 base::ResetAndReturn(&reset_credentials_cb_).Run(success); |
543 } | 546 } |
544 | 547 |
545 } // namespace media | 548 } // namespace media |
OLD | NEW |