diff options
author | Marco Nelissen <marcone@google.com> | 2014-05-09 15:10:23 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2014-05-13 15:03:04 -0700 |
commit | 050eb3280d7305b84f723d515be2dc9606dc39d1 (patch) | |
tree | 110716a883abc7e41f3507f86973224dc4bc0adb /include/ndk/NdkMediaCodec.h | |
parent | 021cf9634ab09c0753a40b7c9ef4ba603be5c3da (diff) | |
download | frameworks_av-050eb3280d7305b84f723d515be2dc9606dc39d1.zip frameworks_av-050eb3280d7305b84f723d515be2dc9606dc39d1.tar.gz frameworks_av-050eb3280d7305b84f723d515be2dc9606dc39d1.tar.bz2 |
Some crypto stuff, error codes
Add crypto/drm related functions, define some media errors
instead of using magic numbers in the code.
Change-Id: I5924cba0bfcdb3623073c9182a646b70f4ead5a5
Diffstat (limited to 'include/ndk/NdkMediaCodec.h')
-rw-r--r-- | include/ndk/NdkMediaCodec.h | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/include/ndk/NdkMediaCodec.h b/include/ndk/NdkMediaCodec.h index c35c6b3..5233fe3 100644 --- a/include/ndk/NdkMediaCodec.h +++ b/include/ndk/NdkMediaCodec.h @@ -29,6 +29,7 @@ #include <android/native_window.h> +#include "NdkMediaCrypto.h" #include "NdkMediaFormat.h" #ifdef __cplusplus @@ -46,6 +47,7 @@ struct AMediaCodecBufferInfo { uint32_t flags; }; typedef struct AMediaCodecBufferInfo AMediaCodecBufferInfo; +typedef struct AMediaCodecCryptoInfo AMediaCodecCryptoInfo; enum { AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM = 4, @@ -81,8 +83,12 @@ int AMediaCodec_delete(AMediaCodec*); /** * Configure the codec. For decoding you would typically get the format from an extractor. */ -int AMediaCodec_configure(AMediaCodec*, const AMediaFormat* format, - ANativeWindow* surface, uint32_t flags); // TODO: other args +int AMediaCodec_configure( + AMediaCodec*, + const AMediaFormat* format, + ANativeWindow* surface, + AMediaCrypto *crypto, + uint32_t flags); /** * Start the codec. A codec must be configured before it can be started, and must be started @@ -127,6 +133,12 @@ int AMediaCodec_queueInputBuffer(AMediaCodec*, size_t idx, off_t offset, size_t size, uint64_t time, uint32_t flags); /** + * Send the specified buffer to the codec for processing. + */ +int AMediaCodec_queueSecureInputBuffer(AMediaCodec*, + size_t idx, off_t offset, AMediaCodecCryptoInfo*, uint64_t time, uint32_t flags); + +/** * Get the index of the next available buffer of processed data. */ ssize_t AMediaCodec_dequeueOutputBuffer(AMediaCodec*, AMediaCodecBufferInfo *info, int64_t timeoutUs); @@ -138,7 +150,6 @@ AMediaFormat* AMediaCodec_getOutputFormat(AMediaCodec*); int AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool render); - typedef void (*OnCodecEvent)(AMediaCodec *codec, void *userdata); /** @@ -150,6 +161,36 @@ typedef void (*OnCodecEvent)(AMediaCodec *codec, void *userdata); int AMediaCodec_setNotificationCallback(AMediaCodec*, OnCodecEvent callback, void *userdata); +enum { + AMEDIACODECRYPTOINFO_MODE_CLEAR = 0, + AMEDIACODECRYPTOINFO_MODE_AES_CTR = 1 +}; + +/** + * create an AMediaCodecCryptoInfo from scratch. Use this if you need to use custom + * crypto info, rather than one obtained from AMediaExtractor. + */ +AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new( + int numsubsamples, + uint8_t key[16], + uint8_t iv[16], + uint32_t mode, + size_t *clearbytes, + size_t *encryptedbytes); + +/** + * delete an AMediaCodecCryptoInfo create previously with AMediaCodecCryptoInfo_new, or + * obtained from AMediaExtractor + */ +int AMediaCodecCryptoInfo_delete(AMediaCodecCryptoInfo*); + +size_t AMediaCodecCryptoInfo_getNumSubSamples(AMediaCodecCryptoInfo*); +int AMediaCodecCryptoInfo_getKey(AMediaCodecCryptoInfo*, uint8_t *dst); +int AMediaCodecCryptoInfo_getIV(AMediaCodecCryptoInfo*, uint8_t *dst); +uint32_t AMediaCodecCryptoInfo_getMode(AMediaCodecCryptoInfo*); +int AMediaCodecCryptoInfo_getClearBytes(AMediaCodecCryptoInfo*, size_t *dst); +int AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, size_t *dst); + #ifdef __cplusplus } // extern "C" #endif |