| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.media.MediaCodec; | 8 import android.media.MediaCodec; |
| 9 import android.media.MediaCodec.CryptoInfo; |
| 9 import android.media.MediaCodecInfo; | 10 import android.media.MediaCodecInfo; |
| 10 import android.media.MediaCodecList; | 11 import android.media.MediaCodecList; |
| 11 import android.os.Build; | 12 import android.os.Build; |
| 12 | 13 |
| 13 import org.chromium.base.Log; | 14 import org.chromium.base.Log; |
| 14 import org.chromium.base.annotations.CalledByNative; | 15 import org.chromium.base.annotations.CalledByNative; |
| 15 import org.chromium.base.annotations.JNINamespace; | 16 import org.chromium.base.annotations.JNINamespace; |
| 16 import org.chromium.base.annotations.MainDex; | 17 import org.chromium.base.annotations.MainDex; |
| 17 | 18 |
| 18 import java.util.Arrays; | 19 import java.util.Arrays; |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 } | 511 } |
| 511 Log.d(TAG, "Found target encoder for mime " + mime + " : " +
encoderName); | 512 Log.d(TAG, "Found target encoder for mime " + mime + " : " +
encoderName); |
| 512 return codecProperties; | 513 return codecProperties; |
| 513 } | 514 } |
| 514 } | 515 } |
| 515 } | 516 } |
| 516 | 517 |
| 517 Log.w(TAG, "HW encoder for " + mime + " is not available on this device.
"); | 518 Log.w(TAG, "HW encoder for " + mime + " is not available on this device.
"); |
| 518 return null; | 519 return null; |
| 519 } | 520 } |
| 521 |
| 522 /** |
| 523 * Returns true if and only if the platform we are running on supports the '
cbcs' |
| 524 * encryption scheme, specifically AES CBC encryption with possibility of pa
ttern |
| 525 * encryption. |
| 526 * While 'cbcs' scheme was originally implemented in N, there was a bug (in
the |
| 527 * DRM code) which means that it didn't really work properly until post-N). |
| 528 */ |
| 529 static boolean platformSupportsCbcsEncryption() { |
| 530 return Build.VERSION.SDK_INT > Build.VERSION_CODES.N; |
| 531 } |
| 532 |
| 533 /** |
| 534 * Sets the encryption pattern value if and only if CryptoInfo.setPattern me
thod is |
| 535 * supported. |
| 536 * This method was introduced in Android N. Note that if platformSupportsCbc
sEncryption |
| 537 * returns true, then this function will set the pattern. |
| 538 */ |
| 539 static void setPatternIfSupported(CryptoInfo cryptoInfo, int encrypt, int sk
ip) { |
| 540 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
| 541 cryptoInfo.setPattern(new CryptoInfo.Pattern(encrypt, skip)); |
| 542 } |
| 543 } |
| 520 } | 544 } |
| OLD | NEW |