summaryrefslogtreecommitdiffstats
path: root/media/java
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2012-04-19 12:47:07 -0700
committerAndreas Huber <andih@google.com>2012-04-19 13:42:14 -0700
commitbfc56f497de0d18125366a02a93e61cdc0891be4 (patch)
tree6ac44fbe8d011cfd62c1743354ace0541e3d1d26 /media/java
parent5cef554cc857b2b542d2c62f8cd0c36d62e1bb9b (diff)
downloadframeworks_base-bfc56f497de0d18125366a02a93e61cdc0891be4.zip
frameworks_base-bfc56f497de0d18125366a02a93e61cdc0891be4.tar.gz
frameworks_base-bfc56f497de0d18125366a02a93e61cdc0891be4.tar.bz2
DRM errors signaled by the CryptoPlugin are now visible to MediaCodec clients
through a custom exception "MediaCodec.CryptoException". Change-Id: I30215e9e13bab68abad23e27dcead7c1accd07f1 related-to-bug: 6365261
Diffstat (limited to 'media/java')
-rw-r--r--media/java/android/media/MediaCodec.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 2efacd8..258760f 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -280,6 +280,19 @@ final public class MediaCodec {
*/
public native final void flush();
+ public final static class CryptoException extends RuntimeException {
+ public CryptoException(int errorCode, String detailMessage) {
+ super(detailMessage);
+ mErrorCode = errorCode;
+ }
+
+ public int getErrorCode() {
+ return mErrorCode;
+ }
+
+ private int mErrorCode;
+ }
+
/** After filling a range of the input buffer at the specified index
* submit it to the component.
*
@@ -304,10 +317,13 @@ final public class MediaCodec {
* @param presentationTimeUs The time at which this buffer should be rendered.
* @param flags A bitmask of flags {@link #FLAG_SYNCFRAME},
* {@link #FLAG_CODECCONFIG} or {@link #FLAG_EOS}.
+ * @throws CryptoException if a crypto object has been specified in
+ * {@link #configure}
*/
public native final void queueInputBuffer(
int index,
- int offset, int size, long presentationTimeUs, int flags);
+ int offset, int size, long presentationTimeUs, int flags)
+ throws CryptoException;
/** Metadata describing the structure of a (at least partially) encrypted
* input sample.
@@ -361,7 +377,7 @@ final public class MediaCodec {
int offset,
CryptoInfo info,
long presentationTimeUs,
- int flags);
+ int flags) throws CryptoException;
/** Returns the index of an input buffer to be filled with valid data
* or -1 if no such buffer is currently available.