OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 package org.chromium.media; | 5 package org.chromium.media; |
6 | 6 |
7 import android.media.MediaCrypto; | 7 import android.media.MediaCrypto; |
8 import android.media.MediaDrm; | 8 import android.media.MediaDrm; |
9 import android.os.AsyncTask; | 9 import android.os.AsyncTask; |
10 import android.os.Handler; | 10 import android.os.Handler; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return true; | 120 return true; |
121 } catch (Exception e) { | 121 } catch (Exception e) { |
122 Log.e(TAG, "Cannot open a new session: " + e.toString()); | 122 Log.e(TAG, "Cannot open a new session: " + e.toString()); |
123 return false; | 123 return false; |
124 } | 124 } |
125 | 125 |
126 assert(mSessionId != null); | 126 assert(mSessionId != null); |
127 return createMediaCrypto(); | 127 return createMediaCrypto(); |
128 } | 128 } |
129 | 129 |
| 130 /** |
| 131 * Check whether the crypto scheme is supported for the given container. |
| 132 * If |containerMimeType| is an empty string, we just return whether |
| 133 * the crypto scheme is supported. |
| 134 * TODO(qinmin): Implement the checking for container. |
| 135 * |
| 136 * @return true if the container and the crypto scheme is supported, or |
| 137 * false otherwise. |
| 138 */ |
130 @CalledByNative | 139 @CalledByNative |
131 private static boolean isCryptoSchemeSupported(byte[] schemeUUID, String con
tainerMimeType) { | 140 private static boolean isCryptoSchemeSupported(byte[] schemeUUID, String con
tainerMimeType) { |
132 UUID cryptoScheme = getUUIDFromBytes(schemeUUID); | 141 UUID cryptoScheme = getUUIDFromBytes(schemeUUID); |
133 return MediaDrm.isCryptoSchemeSupported(cryptoScheme); | 142 return MediaDrm.isCryptoSchemeSupported(cryptoScheme); |
134 } | 143 } |
135 | 144 |
136 /** | 145 /** |
137 * Create a new MediaDrmBridge from the crypto scheme UUID. | 146 * Create a new MediaDrmBridge from the crypto scheme UUID. |
138 * | 147 * |
139 * @param schemeUUID Crypto scheme UUID. | 148 * @param schemeUUID Crypto scheme UUID. |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 460 |
452 private native void nativeOnMediaCryptoReady(int nativeMediaDrmBridge); | 461 private native void nativeOnMediaCryptoReady(int nativeMediaDrmBridge); |
453 | 462 |
454 private native void nativeOnKeyMessage(int nativeMediaDrmBridge, String sess
ionId, | 463 private native void nativeOnKeyMessage(int nativeMediaDrmBridge, String sess
ionId, |
455 byte[] message, String destinationUrl
); | 464 byte[] message, String destinationUrl
); |
456 | 465 |
457 private native void nativeOnKeyAdded(int nativeMediaDrmBridge, String sessio
nId); | 466 private native void nativeOnKeyAdded(int nativeMediaDrmBridge, String sessio
nId); |
458 | 467 |
459 private native void nativeOnKeyError(int nativeMediaDrmBridge, String sessio
nId); | 468 private native void nativeOnKeyError(int nativeMediaDrmBridge, String sessio
nId); |
460 } | 469 } |
OLD | NEW |