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 * @addtogroup Media 19 * @{ 20 */ 21 22 /** 23 * @file NdkMediaCodec.h 24 */ 25 26 /* 27 * This file defines an NDK API. 28 * Do not remove methods. 29 * Do not change method signatures. 30 * Do not change the value of constants. 31 * Do not change the size of any of the classes defined in here. 32 * Do not reference types that are not part of the NDK. 33 * Do not #include files that aren't part of the NDK. 34 */ 35 36 #ifndef _NDK_MEDIA_CODEC_H 37 #define _NDK_MEDIA_CODEC_H 38 39 #include <stdint.h> 40 #include <sys/cdefs.h> 41 42 #include <android/api-level.h> 43 44 #include "NdkMediaCrypto.h" 45 #include "NdkMediaError.h" 46 #include "NdkMediaFormat.h" 47 48 __BEGIN_DECLS 49 50 struct ANativeWindow; 51 typedef struct ANativeWindow ANativeWindow; 52 53 54 struct AMediaCodec; 55 typedef struct AMediaCodec AMediaCodec; 56 57 struct AMediaCodecBufferInfo { 58 int32_t offset; 59 int32_t size; 60 int64_t presentationTimeUs; 61 uint32_t flags; 62 }; 63 typedef struct AMediaCodecBufferInfo AMediaCodecBufferInfo; 64 typedef struct AMediaCodecCryptoInfo AMediaCodecCryptoInfo; 65 66 enum { 67 AMEDIACODEC_BUFFER_FLAG_CODEC_CONFIG = 2, 68 AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM = 4, 69 AMEDIACODEC_BUFFER_FLAG_PARTIAL_FRAME = 8, 70 71 AMEDIACODEC_CONFIGURE_FLAG_ENCODE = 1, 72 AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED = -3, 73 AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED = -2, 74 AMEDIACODEC_INFO_TRY_AGAIN_LATER = -1, 75 }; 76 77 /** 78 * Called when an input buffer becomes available. 79 * The specified index is the index of the available input buffer. 80 */ 81 typedef void (*AMediaCodecOnAsyncInputAvailable)( 82 AMediaCodec *codec, 83 void *userdata, 84 int32_t index); 85 /** 86 * Called when an output buffer becomes available. 87 * The specified index is the index of the available output buffer. 88 * The specified bufferInfo contains information regarding the available output buffer. 89 */ 90 typedef void (*AMediaCodecOnAsyncOutputAvailable)( 91 AMediaCodec *codec, 92 void *userdata, 93 int32_t index, 94 AMediaCodecBufferInfo *bufferInfo); 95 /** 96 * Called when the output format has changed. 97 * The specified format contains the new output format. 98 */ 99 typedef void (*AMediaCodecOnAsyncFormatChanged)( 100 AMediaCodec *codec, 101 void *userdata, 102 AMediaFormat *format); 103 /** 104 * Called when the MediaCodec encountered an error. 105 * The specified actionCode indicates the possible actions that client can take, 106 * and it can be checked by calling AMediaCodecActionCode_isRecoverable or 107 * AMediaCodecActionCode_isTransient. If both AMediaCodecActionCode_isRecoverable() 108 * and AMediaCodecActionCode_isTransient() return false, then the codec error is fatal 109 * and the codec must be deleted. 110 * The specified detail may contain more detailed messages about this error. 111 */ 112 typedef void (*AMediaCodecOnAsyncError)( 113 AMediaCodec *codec, 114 void *userdata, 115 media_status_t error, 116 int32_t actionCode, 117 const char *detail); 118 119 typedef struct AMediaCodecOnAsyncNotifyCallback { 120 AMediaCodecOnAsyncInputAvailable onAsyncInputAvailable; 121 AMediaCodecOnAsyncOutputAvailable onAsyncOutputAvailable; 122 AMediaCodecOnAsyncFormatChanged onAsyncFormatChanged; 123 AMediaCodecOnAsyncError onAsyncError; 124 } AMediaCodecOnAsyncNotifyCallback; 125 126 /** 127 * Called when an output frame has rendered on the output surface. 128 * 129 * \param codec The codec object that generated this notification. 130 * \param userdata The user data set at AMediaCodec_setOnFrameRenderedCallback. 131 * \param mediaTimeUs The presentation time (media time) of the frame rendered. 132 * This is usually the same as specified in 133 * AMediaCodec_queueInputBuffer, but some codecs may alter 134 * the media time by applying some time-based transformation, 135 * such as frame rate conversion. In that case, presentation 136 * time corresponds to the actual output frame rendered. 137 * \param systemNano The system time when the frame was rendered. 138 */ 139 typedef void (*AMediaCodecOnFrameRendered)( 140 AMediaCodec *codec, 141 void *userdata, 142 int64_t mediaTimeUs, 143 int64_t systemNano); 144 145 /** 146 * Create codec by name. Use this if you know the exact codec you want to use. 147 * When configuring, you will need to specify whether to use the codec as an 148 * encoder or decoder. 149 * 150 * Available since API level 21. 151 */ 152 AMediaCodec* AMediaCodec_createCodecByName(const char *name) __INTRODUCED_IN(21); 153 154 /** 155 * Create codec by mime type. Most applications will use this, specifying a 156 * mime type obtained from media extractor. 157 * 158 * Available since API level 21. 159 */ 160 AMediaCodec* AMediaCodec_createDecoderByType(const char *mime_type) __INTRODUCED_IN(21); 161 162 /** 163 * Create encoder by name. 164 * 165 * Available since API level 21. 166 */ 167 AMediaCodec* AMediaCodec_createEncoderByType(const char *mime_type) __INTRODUCED_IN(21); 168 169 /** 170 * Delete the codec and free its resources. 171 * 172 * Available since API level 21. 173 */ 174 media_status_t AMediaCodec_delete(AMediaCodec*) __INTRODUCED_IN(21); 175 176 /** 177 * Configure the codec. For decoding you would typically get the format from an extractor. 178 * 179 * Available since API level 21. 180 */ 181 media_status_t AMediaCodec_configure( 182 AMediaCodec*, 183 const AMediaFormat* format, 184 ANativeWindow* surface, 185 AMediaCrypto *crypto, 186 uint32_t flags) __INTRODUCED_IN(21); 187 188 /** 189 * Start the codec. A codec must be configured before it can be started, and must be started 190 * before buffers can be sent to it. 191 * 192 * Available since API level 21. 193 */ 194 media_status_t AMediaCodec_start(AMediaCodec*) __INTRODUCED_IN(21); 195 196 /** 197 * Stop the codec. 198 * 199 * Available since API level 21. 200 */ 201 media_status_t AMediaCodec_stop(AMediaCodec*) __INTRODUCED_IN(21); 202 203 /* 204 * Flush the codec's input and output. All indices previously returned from calls to 205 * AMediaCodec_dequeueInputBuffer and AMediaCodec_dequeueOutputBuffer become invalid. 206 * 207 * Available since API level 21. 208 */ 209 media_status_t AMediaCodec_flush(AMediaCodec*) __INTRODUCED_IN(21); 210 211 /** 212 * Get an input buffer. The specified buffer index must have been previously obtained from 213 * dequeueInputBuffer, and not yet queued. 214 * 215 * Available since API level 21. 216 */ 217 uint8_t* AMediaCodec_getInputBuffer(AMediaCodec*, size_t idx, size_t *out_size) __INTRODUCED_IN(21); 218 219 /** 220 * Get an output buffer. The specified buffer index must have been previously obtained from 221 * dequeueOutputBuffer, and not yet queued. 222 * 223 * Available since API level 21. 224 */ 225 uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec*, size_t idx, size_t *out_size) __INTRODUCED_IN(21); 226 227 /** 228 * Get the index of the next available input buffer. An app will typically use this with 229 * getInputBuffer() to get a pointer to the buffer, then copy the data to be encoded or decoded 230 * into the buffer before passing it to the codec. 231 * 232 * Available since API level 21. 233 */ 234 ssize_t AMediaCodec_dequeueInputBuffer(AMediaCodec*, int64_t timeoutUs) __INTRODUCED_IN(21); 235 236 /* 237 * __USE_FILE_OFFSET64 changes the type of off_t in LP32, which changes the ABI 238 * of these declarations to not match the platform. In that case, define these 239 * APIs in terms of int32_t instead. Passing an off_t in this situation will 240 * result in silent truncation unless the user builds with -Wconversion, but the 241 * only alternative it to not expose them at all for this configuration, which 242 * makes the whole API unusable. 243 * 244 * https://github.com/android-ndk/ndk/issues/459 245 */ 246 #if defined(__USE_FILE_OFFSET64) && !defined(__LP64__) 247 #define _off_t_compat int32_t 248 #else 249 #define _off_t_compat off_t 250 #endif /* defined(__USE_FILE_OFFSET64) && !defined(__LP64__) */ 251 252 #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ 253 __STDC_VERSION__ >= 201112L 254 #include <assert.h> 255 static_assert(sizeof(_off_t_compat) == sizeof(long), 256 "_off_t_compat does not match the NDK ABI. See " 257 "https://github.com/android-ndk/ndk/issues/459."); 258 #endif 259 260 /** 261 * Send the specified buffer to the codec for processing. 262 * 263 * Available since API level 21. 264 */ 265 media_status_t AMediaCodec_queueInputBuffer(AMediaCodec*, size_t idx, 266 _off_t_compat offset, size_t size, 267 uint64_t time, uint32_t flags) __INTRODUCED_IN(21); 268 269 /** 270 * Send the specified buffer to the codec for processing. 271 * 272 * Available since API level 21. 273 */ 274 media_status_t AMediaCodec_queueSecureInputBuffer(AMediaCodec*, size_t idx, 275 _off_t_compat offset, 276 AMediaCodecCryptoInfo*, 277 uint64_t time, uint32_t flags) __INTRODUCED_IN(21); 278 279 #undef _off_t_compat 280 281 /** 282 * Get the index of the next available buffer of processed data. 283 * 284 * Available since API level 21. 285 */ 286 ssize_t AMediaCodec_dequeueOutputBuffer(AMediaCodec*, AMediaCodecBufferInfo *info, 287 int64_t timeoutUs) __INTRODUCED_IN(21); 288 289 /** 290 * Returns the format of the codec's output. 291 * The caller must free the returned format. 292 * 293 * Available since API level 21. 294 */ 295 AMediaFormat* AMediaCodec_getOutputFormat(AMediaCodec*) __INTRODUCED_IN(21); 296 297 /** 298 * If you are done with a buffer, use this call to return the buffer to 299 * the codec. If you previously specified a surface when configuring this 300 * video decoder you can optionally render the buffer. 301 * 302 * Available since API level 21. 303 */ 304 media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool render) __INTRODUCED_IN(21); 305 306 /** 307 * Dynamically sets the output surface of a codec. 308 * 309 * This can only be used if the codec was configured with an output surface. The 310 * new output surface should have a compatible usage type to the original output surface. 311 * E.g. codecs may not support switching from a SurfaceTexture (GPU readable) output 312 * to ImageReader (software readable) output. 313 * 314 * For more details, see the Java documentation for MediaCodec.setOutputSurface. 315 * 316 * Available since API level 21. 317 */ 318 media_status_t AMediaCodec_setOutputSurface(AMediaCodec*, ANativeWindow* surface) __INTRODUCED_IN(21); 319 320 /** 321 * If you are done with a buffer, use this call to update its surface timestamp 322 * and return it to the codec to render it on the output surface. If you 323 * have not specified an output surface when configuring this video codec, 324 * this call will simply return the buffer to the codec. 325 * 326 * For more details, see the Java documentation for MediaCodec.releaseOutputBuffer. 327 * 328 * Available since API level 21. 329 */ 330 media_status_t AMediaCodec_releaseOutputBufferAtTime( 331 AMediaCodec *mData, size_t idx, int64_t timestampNs) __INTRODUCED_IN(21); 332 333 /** 334 * Creates a Surface that can be used as the input to encoder, in place of input buffers 335 * 336 * This can only be called after the codec has been configured via 337 * AMediaCodec_configure(..); and before AMediaCodec_start() has been called. 338 * 339 * The application is responsible for releasing the surface by calling 340 * ANativeWindow_release() when done. 341 * 342 * For more details, see the Java documentation for MediaCodec.createInputSurface. 343 * 344 * Available since API level 26. 345 */ 346 media_status_t AMediaCodec_createInputSurface( 347 AMediaCodec *mData, ANativeWindow **surface) __INTRODUCED_IN(26); 348 349 /** 350 * Creates a persistent Surface that can be used as the input to encoder 351 * 352 * Persistent surface can be reused by MediaCodec instances and can be set 353 * on a new instance via AMediaCodec_setInputSurface(). 354 * A persistent surface can be connected to at most one instance of MediaCodec 355 * at any point in time. 356 * 357 * The application is responsible for releasing the surface by calling 358 * ANativeWindow_release() when done. 359 * 360 * For more details, see the Java documentation for MediaCodec.createPersistentInputSurface. 361 * 362 * Available since API level 26. 363 */ 364 media_status_t AMediaCodec_createPersistentInputSurface( 365 ANativeWindow **surface) __INTRODUCED_IN(26); 366 367 /** 368 * Set a persistent-surface that can be used as the input to encoder, in place of input buffers 369 * 370 * The surface provided *must* be a persistent surface created via 371 * AMediaCodec_createPersistentInputSurface() 372 * This can only be called after the codec has been configured by calling 373 * AMediaCodec_configure(..); and before AMediaCodec_start() has been called. 374 * 375 * For more details, see the Java documentation for MediaCodec.setInputSurface. 376 * 377 * Available since API level 26. 378 */ 379 media_status_t AMediaCodec_setInputSurface( 380 AMediaCodec *mData, ANativeWindow *surface) __INTRODUCED_IN(26); 381 382 /** 383 * Signal additional parameters to the codec instance. 384 * 385 * Parameters can be communicated only when the codec is running, i.e 386 * after AMediaCodec_start() has been called. 387 * 388 * NOTE: Some of these parameter changes may silently fail to apply. 389 * 390 * Available since API level 26. 391 */ 392 media_status_t AMediaCodec_setParameters( 393 AMediaCodec *mData, const AMediaFormat* params) __INTRODUCED_IN(26); 394 395 /** 396 * Signals end-of-stream on input. Equivalent to submitting an empty buffer with 397 * AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM set. 398 * 399 * Returns AMEDIA_ERROR_INVALID_OPERATION when used with an encoder not in executing state 400 * or not receiving input from a Surface created by AMediaCodec_createInputSurface or 401 * AMediaCodec_createPersistentInputSurface. 402 * 403 * Returns the previous codec error if one exists. 404 * 405 * Returns AMEDIA_OK when completed succesfully. 406 * 407 * For more details, see the Java documentation for MediaCodec.signalEndOfInputStream. 408 * 409 * Available since API level 26. 410 */ 411 media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData) __INTRODUCED_IN(26); 412 413 /** 414 * Get format of the buffer. The specified buffer index must have been previously obtained from 415 * dequeueOutputBuffer. 416 * The caller must free the returned format. 417 * 418 * Available since API level 28. 419 */ 420 AMediaFormat* AMediaCodec_getBufferFormat(AMediaCodec*, size_t index) __INTRODUCED_IN(28); 421 422 /** 423 * Get the component name. If the codec was created by createDecoderByType 424 * or createEncoderByType, what component is chosen is not known beforehand. 425 * Caller shall call AMediaCodec_releaseName to free the returned pointer. 426 * 427 * Available since API level 28. 428 */ 429 media_status_t AMediaCodec_getName(AMediaCodec*, char** out_name) __INTRODUCED_IN(28); 430 431 /** 432 * Free the memory pointed by name which is returned by AMediaCodec_getName. 433 * 434 * Available since API level 28. 435 */ 436 void AMediaCodec_releaseName(AMediaCodec*, char* name) __INTRODUCED_IN(28); 437 438 /** 439 * Set an asynchronous callback for actionable AMediaCodec events. 440 * When asynchronous callback is enabled, it is an error for the client to call 441 * AMediaCodec_getInputBuffers(), AMediaCodec_getOutputBuffers(), 442 * AMediaCodec_dequeueInputBuffer() or AMediaCodec_dequeueOutputBuffer(). 443 * 444 * AMediaCodec_flush() behaves differently in asynchronous mode. 445 * After calling AMediaCodec_flush(), the client must call AMediaCodec_start() to 446 * "resume" receiving input buffers. Even if the client does not receive 447 * AMediaCodecOnAsyncInputAvailable callbacks from video encoders configured 448 * with an input surface, the client still needs to call AMediaCodec_start() 449 * to resume the input surface to send buffers to the encoders. 450 * 451 * When called with null callback, this method unregisters any previously set callback. 452 * 453 * Refer to the definition of AMediaCodecOnAsyncNotifyCallback on how each 454 * callback function is called and what are specified. 455 * The specified userdata is opaque data which will be passed along 456 * when the callback functions are called. MediaCodec does not look at or alter the 457 * value of userdata. Often it is a pointer to a client-owned object, 458 * and client manages the lifecycle of the object in that case. 459 * 460 * Once the callback is unregistered or the codec is reset / released, the 461 * previously registered callback will not be called. 462 * 463 * All callbacks are fired on one NDK internal thread. 464 * AMediaCodec_setAsyncNotifyCallback should not be called on the callback thread. 465 * No heavy duty task should be performed on callback thread. 466 * 467 * Available since API level 28. 468 */ 469 media_status_t AMediaCodec_setAsyncNotifyCallback( 470 AMediaCodec*, 471 AMediaCodecOnAsyncNotifyCallback callback, 472 void *userdata) __INTRODUCED_IN(28); 473 474 /** 475 * Registers a callback to be invoked when an output frame is rendered on the output surface. 476 * 477 * This method can be called in any codec state, but will only have an effect in the 478 * Executing state for codecs that render buffers to the output surface. 479 * 480 * This callback is for informational purposes only: to get precise 481 * render timing samples, and can be significantly delayed and batched. Some frames may have 482 * been rendered even if there was no callback generated. 483 * 484 * When called with null callback, this method unregisters any previously set callback. 485 * 486 * Refer to the definition of AMediaCodecOnFrameRendered on how each 487 * callback function is called and what are specified. 488 * The specified userdata is opaque data which will be passed along 489 * when the callback functions are called. MediaCodec does not look at or alter the 490 * value of userdata. Often it is a pointer to a client-owned object, 491 * and client manages the lifecycle of the object in that case. 492 * 493 * Once the callback is unregistered or the codec is reset / released, the 494 * previously registered callback will not be called. 495 * 496 * All callbacks are fired on one NDK internal thread. 497 * AMediaCodec_setOnFrameRenderedCallback should not be called on the callback thread. 498 * No heavy duty task should be performed on callback thread. 499 * 500 * Available since Android T. 501 */ 502 media_status_t AMediaCodec_setOnFrameRenderedCallback( 503 AMediaCodec*, 504 AMediaCodecOnFrameRendered callback, 505 void *userdata) __INTRODUCED_IN(__ANDROID_API_T__); 506 507 /** 508 * Release the crypto if applicable. 509 * 510 * Available since API level 28. 511 */ 512 media_status_t AMediaCodec_releaseCrypto(AMediaCodec*) __INTRODUCED_IN(28); 513 514 /** 515 * Call this after AMediaCodec_configure() returns successfully to get the input 516 * format accepted by the codec. Do this to determine what optional configuration 517 * parameters were supported by the codec. 518 * The caller must free the returned format. 519 * 520 * Available since API level 28. 521 */ 522 AMediaFormat* AMediaCodec_getInputFormat(AMediaCodec*) __INTRODUCED_IN(28); 523 524 /** 525 * Returns true if the codec cannot proceed further, but can be recovered by stopping, 526 * configuring, and starting again. 527 * 528 * Available since API level 28. 529 */ 530 bool AMediaCodecActionCode_isRecoverable(int32_t actionCode) __INTRODUCED_IN(28); 531 532 /** 533 * Returns true if the codec error is a transient issue, perhaps due to 534 * resource constraints, and that the method (or encoding/decoding) may be 535 * retried at a later time. 536 * 537 * Available since API level 28. 538 */ 539 bool AMediaCodecActionCode_isTransient(int32_t actionCode) __INTRODUCED_IN(28); 540 541 typedef enum { 542 AMEDIACODECRYPTOINFO_MODE_CLEAR = 0, 543 AMEDIACODECRYPTOINFO_MODE_AES_CTR = 1, 544 AMEDIACODECRYPTOINFO_MODE_AES_WV = 2, 545 AMEDIACODECRYPTOINFO_MODE_AES_CBC = 3 546 } cryptoinfo_mode_t; 547 548 typedef struct { 549 int32_t encryptBlocks; 550 int32_t skipBlocks; 551 } cryptoinfo_pattern_t; 552 553 /** 554 * Create an AMediaCodecCryptoInfo from scratch. Use this if you need to use custom 555 * crypto info, rather than one obtained from AMediaExtractor. 556 * 557 * AMediaCodecCryptoInfo describes the structure of an (at least 558 * partially) encrypted input sample. 559 * A buffer's data is considered to be partitioned into "subsamples", 560 * each subsample starts with a (potentially empty) run of plain, 561 * unencrypted bytes followed by a (also potentially empty) run of 562 * encrypted bytes. 563 * numBytesOfClearData can be null to indicate that all data is encrypted. 564 * This information encapsulates per-sample metadata as outlined in 565 * ISO/IEC FDIS 23001-7:2011 "Common encryption in ISO base media file format files". 566 * 567 * Available since API level 21. 568 */ 569 AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new( 570 int numsubsamples, 571 uint8_t key[16], 572 uint8_t iv[16], 573 cryptoinfo_mode_t mode, 574 size_t *clearbytes, 575 size_t *encryptedbytes) __INTRODUCED_IN(21); 576 577 /** 578 * Delete an AMediaCodecCryptoInfo created previously with AMediaCodecCryptoInfo_new, or 579 * obtained from AMediaExtractor. 580 * 581 * Available since API level 21. 582 */ 583 media_status_t AMediaCodecCryptoInfo_delete(AMediaCodecCryptoInfo*) __INTRODUCED_IN(21); 584 585 /** 586 * Set the crypto pattern on an AMediaCryptoInfo object. 587 * 588 * Available since API level 21. 589 */ 590 void AMediaCodecCryptoInfo_setPattern( 591 AMediaCodecCryptoInfo *info, 592 cryptoinfo_pattern_t *pattern) __INTRODUCED_IN(21); 593 594 /** 595 * The number of subsamples that make up the buffer's contents. 596 * 597 * Available since API level 21. 598 */ 599 size_t AMediaCodecCryptoInfo_getNumSubSamples(AMediaCodecCryptoInfo*) __INTRODUCED_IN(21); 600 601 /** 602 * A 16-byte opaque key. 603 * 604 * Available since API level 21. 605 */ 606 media_status_t AMediaCodecCryptoInfo_getKey(AMediaCodecCryptoInfo*, uint8_t *dst) __INTRODUCED_IN(21); 607 608 /** 609 * A 16-byte initialization vector. 610 * 611 * Available since API level 21. 612 */ 613 media_status_t AMediaCodecCryptoInfo_getIV(AMediaCodecCryptoInfo*, uint8_t *dst) __INTRODUCED_IN(21); 614 615 /** 616 * The type of encryption that has been applied, 617 * one of AMEDIACODECRYPTOINFO_MODE_CLEAR or AMEDIACODECRYPTOINFO_MODE_AES_CTR. 618 * 619 * Available since API level 21. 620 */ 621 cryptoinfo_mode_t AMediaCodecCryptoInfo_getMode(AMediaCodecCryptoInfo*) __INTRODUCED_IN(21); 622 623 /** 624 * The number of leading unencrypted bytes in each subsample. 625 * 626 * Available since API level 21. 627 */ 628 media_status_t AMediaCodecCryptoInfo_getClearBytes(AMediaCodecCryptoInfo*, size_t *dst) __INTRODUCED_IN(21); 629 630 /** 631 * The number of trailing encrypted bytes in each subsample. 632 * 633 * Available since API level 21. 634 */ 635 media_status_t AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, size_t *dst) __INTRODUCED_IN(21); 636 637 extern const char* AMEDIACODEC_KEY_HDR10_PLUS_INFO __INTRODUCED_IN(31); 638 extern const char* AMEDIACODEC_KEY_LOW_LATENCY __INTRODUCED_IN(31); 639 extern const char* AMEDIACODEC_KEY_OFFSET_TIME __INTRODUCED_IN(31); 640 extern const char* AMEDIACODEC_KEY_REQUEST_SYNC_FRAME __INTRODUCED_IN(31); 641 extern const char* AMEDIACODEC_KEY_SUSPEND __INTRODUCED_IN(31); 642 extern const char* AMEDIACODEC_KEY_SUSPEND_TIME __INTRODUCED_IN(31); 643 extern const char* AMEDIACODEC_KEY_VIDEO_BITRATE __INTRODUCED_IN(31); 644 645 __END_DECLS 646 647 #endif //_NDK_MEDIA_CODEC_H 648 649 /** @} */ 650