Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* |
| 18 | * This file defines an NDK API. |
| 19 | * Do not remove methods. |
| 20 | * Do not change method signatures. |
| 21 | * Do not change the value of constants. |
| 22 | * Do not change the size of any of the classes defined in here. |
| 23 | * Do not reference types that are not part of the NDK. |
| 24 | * Do not #include files that aren't part of the NDK. |
| 25 | */ |
| 26 | |
| 27 | #ifndef _NDK_MEDIA_CODEC_H |
| 28 | #define _NDK_MEDIA_CODEC_H |
| 29 | |
Dan Albert | 19abcd8 | 2017-07-17 13:37:56 -0700 | [diff] [blame] | 30 | #include <stdint.h> |
Dan Albert | 2975a24 | 2016-09-23 16:17:45 -0700 | [diff] [blame] | 31 | #include <sys/cdefs.h> |
| 32 | |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 33 | #include "NdkMediaCrypto.h" |
Marco Nelissen | e419d7c | 2014-05-15 14:17:25 -0700 | [diff] [blame] | 34 | #include "NdkMediaError.h" |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 35 | #include "NdkMediaFormat.h" |
| 36 | |
| 37 | #ifdef __cplusplus |
| 38 | extern "C" { |
| 39 | #endif |
| 40 | |
Mathias Agopian | bc1713d | 2017-02-13 18:37:50 -0800 | [diff] [blame] | 41 | struct ANativeWindow; |
| 42 | |
Dan Albert | 2975a24 | 2016-09-23 16:17:45 -0700 | [diff] [blame] | 43 | #if __ANDROID_API__ >= 21 |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 44 | |
| 45 | struct AMediaCodec; |
| 46 | typedef struct AMediaCodec AMediaCodec; |
| 47 | |
| 48 | struct AMediaCodecBufferInfo { |
| 49 | int32_t offset; |
| 50 | int32_t size; |
| 51 | int64_t presentationTimeUs; |
| 52 | uint32_t flags; |
| 53 | }; |
| 54 | typedef struct AMediaCodecBufferInfo AMediaCodecBufferInfo; |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 55 | typedef struct AMediaCodecCryptoInfo AMediaCodecCryptoInfo; |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 56 | |
| 57 | enum { |
| 58 | AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM = 4, |
Marco Nelissen | 86aa02c | 2014-05-07 16:03:54 -0700 | [diff] [blame] | 59 | AMEDIACODEC_CONFIGURE_FLAG_ENCODE = 1, |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 60 | AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED = -3, |
| 61 | AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED = -2, |
| 62 | AMEDIACODEC_INFO_TRY_AGAIN_LATER = -1 |
| 63 | }; |
| 64 | |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 65 | /** |
Marco Nelissen | 86aa02c | 2014-05-07 16:03:54 -0700 | [diff] [blame] | 66 | * Create codec by name. Use this if you know the exact codec you want to use. |
| 67 | * When configuring, you will need to specify whether to use the codec as an |
| 68 | * encoder or decoder. |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 69 | */ |
Marco Nelissen | 86aa02c | 2014-05-07 16:03:54 -0700 | [diff] [blame] | 70 | AMediaCodec* AMediaCodec_createCodecByName(const char *name); |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 71 | |
| 72 | /** |
| 73 | * Create codec by mime type. Most applications will use this, specifying a |
| 74 | * mime type obtained from media extractor. |
| 75 | */ |
Marco Nelissen | 86aa02c | 2014-05-07 16:03:54 -0700 | [diff] [blame] | 76 | AMediaCodec* AMediaCodec_createDecoderByType(const char *mime_type); |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 77 | |
| 78 | /** |
| 79 | * Create encoder by name. |
| 80 | */ |
Marco Nelissen | 86aa02c | 2014-05-07 16:03:54 -0700 | [diff] [blame] | 81 | AMediaCodec* AMediaCodec_createEncoderByType(const char *mime_type); |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * delete the codec and free its resources |
| 85 | */ |
Marco Nelissen | e419d7c | 2014-05-15 14:17:25 -0700 | [diff] [blame] | 86 | media_status_t AMediaCodec_delete(AMediaCodec*); |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 87 | |
| 88 | /** |
| 89 | * Configure the codec. For decoding you would typically get the format from an extractor. |
| 90 | */ |
Marco Nelissen | e419d7c | 2014-05-15 14:17:25 -0700 | [diff] [blame] | 91 | media_status_t AMediaCodec_configure( |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 92 | AMediaCodec*, |
| 93 | const AMediaFormat* format, |
| 94 | ANativeWindow* surface, |
| 95 | AMediaCrypto *crypto, |
| 96 | uint32_t flags); |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 97 | |
| 98 | /** |
| 99 | * Start the codec. A codec must be configured before it can be started, and must be started |
| 100 | * before buffers can be sent to it. |
| 101 | */ |
Marco Nelissen | e419d7c | 2014-05-15 14:17:25 -0700 | [diff] [blame] | 102 | media_status_t AMediaCodec_start(AMediaCodec*); |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 103 | |
| 104 | /** |
| 105 | * Stop the codec. |
| 106 | */ |
Marco Nelissen | e419d7c | 2014-05-15 14:17:25 -0700 | [diff] [blame] | 107 | media_status_t AMediaCodec_stop(AMediaCodec*); |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 108 | |
| 109 | /* |
| 110 | * Flush the codec's input and output. All indices previously returned from calls to |
| 111 | * AMediaCodec_dequeueInputBuffer and AMediaCodec_dequeueOutputBuffer become invalid. |
| 112 | */ |
Marco Nelissen | e419d7c | 2014-05-15 14:17:25 -0700 | [diff] [blame] | 113 | media_status_t AMediaCodec_flush(AMediaCodec*); |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 114 | |
| 115 | /** |
| 116 | * Get an input buffer. The specified buffer index must have been previously obtained from |
| 117 | * dequeueInputBuffer, and not yet queued. |
| 118 | */ |
| 119 | uint8_t* AMediaCodec_getInputBuffer(AMediaCodec*, size_t idx, size_t *out_size); |
| 120 | |
| 121 | /** |
| 122 | * Get an output buffer. The specified buffer index must have been previously obtained from |
| 123 | * dequeueOutputBuffer, and not yet queued. |
| 124 | */ |
| 125 | uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec*, size_t idx, size_t *out_size); |
| 126 | |
| 127 | /** |
| 128 | * Get the index of the next available input buffer. An app will typically use this with |
| 129 | * getInputBuffer() to get a pointer to the buffer, then copy the data to be encoded or decoded |
| 130 | * into the buffer before passing it to the codec. |
| 131 | */ |
| 132 | ssize_t AMediaCodec_dequeueInputBuffer(AMediaCodec*, int64_t timeoutUs); |
| 133 | |
Dan Albert | 19abcd8 | 2017-07-17 13:37:56 -0700 | [diff] [blame] | 134 | /* |
| 135 | * __USE_FILE_OFFSET64 changes the type of off_t in LP32, which changes the ABI |
| 136 | * of these declarations to not match the platform. In that case, define these |
| 137 | * APIs in terms of int32_t instead. Passing an off_t in this situation will |
| 138 | * result in silent truncation unless the user builds with -Wconversion, but the |
| 139 | * only alternative it to not expose them at all for this configuration, which |
| 140 | * makes the whole API unusable. |
| 141 | * |
| 142 | * https://github.com/android-ndk/ndk/issues/459 |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 143 | */ |
Dan Albert | 19abcd8 | 2017-07-17 13:37:56 -0700 | [diff] [blame] | 144 | #if defined(__USE_FILE_OFFSET64) && !defined(__LP64__) |
| 145 | #define _off_t_compat int32_t |
| 146 | #else |
| 147 | #define _off_t_compat off_t |
| 148 | #endif /* defined(__USE_FILE_OFFSET64) && !defined(__LP64__) */ |
| 149 | |
| 150 | #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ |
| 151 | __STDC_VERSION__ >= 201112L |
| 152 | static_assert(sizeof(_off_t_compat) == sizeof(long), |
| 153 | "_off_t_compat does not match the NDK ABI. See " |
| 154 | "https://github.com/android-ndk/ndk/issues/459."); |
| 155 | #endif |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 156 | |
| 157 | /** |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 158 | * Send the specified buffer to the codec for processing. |
| 159 | */ |
Dan Albert | 19abcd8 | 2017-07-17 13:37:56 -0700 | [diff] [blame] | 160 | media_status_t AMediaCodec_queueInputBuffer(AMediaCodec*, size_t idx, |
| 161 | _off_t_compat offset, size_t size, |
| 162 | uint64_t time, uint32_t flags); |
| 163 | |
| 164 | /** |
| 165 | * Send the specified buffer to the codec for processing. |
| 166 | */ |
| 167 | media_status_t AMediaCodec_queueSecureInputBuffer(AMediaCodec*, size_t idx, |
| 168 | _off_t_compat offset, |
| 169 | AMediaCodecCryptoInfo*, |
| 170 | uint64_t time, uint32_t flags); |
| 171 | |
| 172 | #undef _off_t_compat |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 173 | |
| 174 | /** |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 175 | * Get the index of the next available buffer of processed data. |
| 176 | */ |
Glenn Kasten | b187de1 | 2014-12-30 08:18:15 -0800 | [diff] [blame] | 177 | ssize_t AMediaCodec_dequeueOutputBuffer(AMediaCodec*, AMediaCodecBufferInfo *info, |
| 178 | int64_t timeoutUs); |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 179 | AMediaFormat* AMediaCodec_getOutputFormat(AMediaCodec*); |
| 180 | |
| 181 | /** |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 182 | * If you are done with a buffer, use this call to return the buffer to |
| 183 | * the codec. If you previously specified a surface when configuring this |
| 184 | * video decoder you can optionally render the buffer. |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 185 | */ |
Marco Nelissen | e419d7c | 2014-05-15 14:17:25 -0700 | [diff] [blame] | 186 | media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool render); |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 187 | |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 188 | /** |
Vineeta Srivastava | 8c35da5 | 2016-01-08 17:33:09 -0800 | [diff] [blame] | 189 | * Dynamically sets the output surface of a codec. |
| 190 | * |
| 191 | * This can only be used if the codec was configured with an output surface. The |
| 192 | * new output surface should have a compatible usage type to the original output surface. |
| 193 | * E.g. codecs may not support switching from a SurfaceTexture (GPU readable) output |
| 194 | * to ImageReader (software readable) output. |
| 195 | * |
| 196 | * For more details, see the Java documentation for MediaCodec.setOutputSurface. |
| 197 | */ |
| 198 | media_status_t AMediaCodec_setOutputSurface(AMediaCodec*, ANativeWindow* surface); |
| 199 | |
| 200 | /** |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 201 | * If you are done with a buffer, use this call to update its surface timestamp |
| 202 | * and return it to the codec to render it on the output surface. If you |
| 203 | * have not specified an output surface when configuring this video codec, |
| 204 | * this call will simply return the buffer to the codec. |
| 205 | * |
| 206 | * For more details, see the Java documentation for MediaCodec.releaseOutputBuffer. |
| 207 | */ |
| 208 | media_status_t AMediaCodec_releaseOutputBufferAtTime( |
| 209 | AMediaCodec *mData, size_t idx, int64_t timestampNs); |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 210 | |
Robert Shih | 8f61a2b | 2017-09-11 14:03:11 -0700 | [diff] [blame^] | 211 | #if __ANDROID_API__ >= 26 |
| 212 | |
Praveen Chavan | 1943158 | 2017-01-16 11:56:18 -0800 | [diff] [blame] | 213 | /** |
| 214 | * Creates a Surface that can be used as the input to encoder, in place of input buffers |
| 215 | * |
| 216 | * This can only be called after the codec has been configured via |
| 217 | * AMediaCodec_configure(..); and before AMediaCodec_start() has been called. |
| 218 | * |
| 219 | * The application is responsible for releasing the surface by calling |
| 220 | * ANativeWindow_release() when done. |
| 221 | * |
| 222 | * For more details, see the Java documentation for MediaCodec.createInputSurface. |
| 223 | */ |
Praveen Chavan | 85a5363 | 2017-01-31 12:21:33 -0800 | [diff] [blame] | 224 | media_status_t AMediaCodec_createInputSurface( |
| 225 | AMediaCodec *mData, ANativeWindow **surface); |
| 226 | |
| 227 | /** |
| 228 | * Creates a persistent Surface that can be used as the input to encoder |
| 229 | * |
| 230 | * Persistent surface can be reused by MediaCodec instances and can be set |
| 231 | * on a new instance via AMediaCodec_setInputSurface(). |
| 232 | * A persistent surface can be connected to at most one instance of MediaCodec |
| 233 | * at any point in time. |
| 234 | * |
| 235 | * The application is responsible for releasing the surface by calling |
| 236 | * ANativeWindow_release() when done. |
| 237 | * |
| 238 | * For more details, see the Java documentation for MediaCodec.createPersistentInputSurface. |
| 239 | */ |
| 240 | media_status_t AMediaCodec_createPersistentInputSurface( |
| 241 | ANativeWindow **surface); |
| 242 | |
| 243 | /** |
| 244 | * Set a persistent-surface that can be used as the input to encoder, in place of input buffers |
| 245 | * |
| 246 | * The surface provided *must* be a persistent surface created via |
| 247 | * AMediaCodec_createPersistentInputSurface() |
| 248 | * This can only be called after the codec has been configured by calling |
| 249 | * AMediaCodec_configure(..); and before AMediaCodec_start() has been called. |
| 250 | * |
| 251 | * For more details, see the Java documentation for MediaCodec.setInputSurface. |
| 252 | */ |
| 253 | media_status_t AMediaCodec_setInputSurface( |
| 254 | AMediaCodec *mData, ANativeWindow *surface); |
| 255 | |
Praveen Chavan | f373e84 | 2017-02-01 11:50:15 -0800 | [diff] [blame] | 256 | /** |
| 257 | * Signal additional parameters to the codec instance. |
| 258 | * |
| 259 | * Parameters can be communicated only when the codec is running, i.e |
| 260 | * after AMediaCodec_start() has been called. |
| 261 | * |
| 262 | * NOTE: Some of these parameter changes may silently fail to apply. |
| 263 | */ |
| 264 | media_status_t AMediaCodec_setParameters( |
| 265 | AMediaCodec *mData, const AMediaFormat* params); |
Praveen Chavan | 85a5363 | 2017-01-31 12:21:33 -0800 | [diff] [blame] | 266 | |
Robert Shih | af42d3f | 2017-03-20 16:45:37 -0700 | [diff] [blame] | 267 | /** |
| 268 | * Signals end-of-stream on input. Equivalent to submitting an empty buffer with |
| 269 | * AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM set. |
| 270 | * |
| 271 | * Returns AMEDIA_ERROR_INVALID_OPERATION when used with an encoder not in executing state |
| 272 | * or not receiving input from a Surface created by AMediaCodec_createInputSurface or |
| 273 | * AMediaCodec_createPersistentInputSurface. |
| 274 | * |
| 275 | * Returns the previous codec error if one exists. |
| 276 | * |
| 277 | * Returns AMEDIA_OK when completed succesfully. |
| 278 | * |
| 279 | * For more details, see the Java documentation for MediaCodec.signalEndOfInputStream. |
| 280 | */ |
| 281 | media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData); |
| 282 | |
Robert Shih | 8f61a2b | 2017-09-11 14:03:11 -0700 | [diff] [blame^] | 283 | #endif /* __ANDROID_API__ >= 26 */ |
Praveen Chavan | 1943158 | 2017-01-16 11:56:18 -0800 | [diff] [blame] | 284 | |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 285 | typedef enum { |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 286 | AMEDIACODECRYPTOINFO_MODE_CLEAR = 0, |
Jeff Tinker | f45c7e7 | 2016-03-23 17:50:11 -0700 | [diff] [blame] | 287 | AMEDIACODECRYPTOINFO_MODE_AES_CTR = 1, |
| 288 | AMEDIACODECRYPTOINFO_MODE_AES_WV = 2, |
| 289 | AMEDIACODECRYPTOINFO_MODE_AES_CBC = 3 |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 290 | } cryptoinfo_mode_t; |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 291 | |
Jeff Tinker | 18cb1ec | 2015-12-18 11:55:22 -0800 | [diff] [blame] | 292 | typedef struct { |
| 293 | int32_t encryptBlocks; |
| 294 | int32_t skipBlocks; |
| 295 | } cryptoinfo_pattern_t; |
| 296 | |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 297 | /** |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 298 | * Create an AMediaCodecCryptoInfo from scratch. Use this if you need to use custom |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 299 | * crypto info, rather than one obtained from AMediaExtractor. |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 300 | * |
| 301 | * AMediaCodecCryptoInfo describes the structure of an (at least |
| 302 | * partially) encrypted input sample. |
| 303 | * A buffer's data is considered to be partitioned into "subsamples", |
| 304 | * each subsample starts with a (potentially empty) run of plain, |
| 305 | * unencrypted bytes followed by a (also potentially empty) run of |
| 306 | * encrypted bytes. |
| 307 | * numBytesOfClearData can be null to indicate that all data is encrypted. |
| 308 | * This information encapsulates per-sample metadata as outlined in |
| 309 | * ISO/IEC FDIS 23001-7:2011 "Common encryption in ISO base media file format files". |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 310 | */ |
| 311 | AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new( |
| 312 | int numsubsamples, |
| 313 | uint8_t key[16], |
| 314 | uint8_t iv[16], |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 315 | cryptoinfo_mode_t mode, |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 316 | size_t *clearbytes, |
| 317 | size_t *encryptedbytes); |
| 318 | |
| 319 | /** |
Marco Nelissen | 829e097 | 2014-05-13 16:22:19 -0700 | [diff] [blame] | 320 | * delete an AMediaCodecCryptoInfo created previously with AMediaCodecCryptoInfo_new, or |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 321 | * obtained from AMediaExtractor |
| 322 | */ |
Marco Nelissen | e419d7c | 2014-05-15 14:17:25 -0700 | [diff] [blame] | 323 | media_status_t AMediaCodecCryptoInfo_delete(AMediaCodecCryptoInfo*); |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 324 | |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 325 | /** |
Jeff Tinker | 18cb1ec | 2015-12-18 11:55:22 -0800 | [diff] [blame] | 326 | * Set the crypto pattern on an AMediaCryptoInfo object |
| 327 | */ |
| 328 | void AMediaCodecCryptoInfo_setPattern( |
| 329 | AMediaCodecCryptoInfo *info, |
| 330 | cryptoinfo_pattern_t *pattern); |
| 331 | |
| 332 | /** |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 333 | * The number of subsamples that make up the buffer's contents. |
| 334 | */ |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 335 | size_t AMediaCodecCryptoInfo_getNumSubSamples(AMediaCodecCryptoInfo*); |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 336 | |
| 337 | /** |
| 338 | * A 16-byte opaque key |
| 339 | */ |
Marco Nelissen | e419d7c | 2014-05-15 14:17:25 -0700 | [diff] [blame] | 340 | media_status_t AMediaCodecCryptoInfo_getKey(AMediaCodecCryptoInfo*, uint8_t *dst); |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 341 | |
| 342 | /** |
| 343 | * A 16-byte initialization vector |
| 344 | */ |
Marco Nelissen | e419d7c | 2014-05-15 14:17:25 -0700 | [diff] [blame] | 345 | media_status_t AMediaCodecCryptoInfo_getIV(AMediaCodecCryptoInfo*, uint8_t *dst); |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 346 | |
| 347 | /** |
| 348 | * The type of encryption that has been applied, |
| 349 | * one of AMEDIACODECRYPTOINFO_MODE_CLEAR or AMEDIACODECRYPTOINFO_MODE_AES_CTR. |
| 350 | */ |
| 351 | cryptoinfo_mode_t AMediaCodecCryptoInfo_getMode(AMediaCodecCryptoInfo*); |
| 352 | |
| 353 | /** |
| 354 | * The number of leading unencrypted bytes in each subsample. |
| 355 | */ |
Marco Nelissen | e419d7c | 2014-05-15 14:17:25 -0700 | [diff] [blame] | 356 | media_status_t AMediaCodecCryptoInfo_getClearBytes(AMediaCodecCryptoInfo*, size_t *dst); |
Marco Nelissen | 79e2b62 | 2014-05-16 08:07:28 -0700 | [diff] [blame] | 357 | |
| 358 | /** |
| 359 | * The number of trailing encrypted bytes in each subsample. |
| 360 | */ |
Marco Nelissen | e419d7c | 2014-05-15 14:17:25 -0700 | [diff] [blame] | 361 | media_status_t AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, size_t *dst); |
Marco Nelissen | 050eb32 | 2014-05-09 15:10:23 -0700 | [diff] [blame] | 362 | |
Dan Albert | 2975a24 | 2016-09-23 16:17:45 -0700 | [diff] [blame] | 363 | #endif /* __ANDROID_API__ >= 21 */ |
| 364 | |
Marco Nelissen | 0c3be87 | 2014-05-01 10:14:44 -0700 | [diff] [blame] | 365 | #ifdef __cplusplus |
| 366 | } // extern "C" |
| 367 | #endif |
| 368 | |
| 369 | #endif //_NDK_MEDIA_CODEC_H |