From 4280e86dcc1e3d5d1061350680dc8f6b47213e47 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 18 Jun 2018 13:17:24 -0700 Subject: [PATCH] Add __INTRODUCED_IN to audio/camera/media headers. Bug: https://github.com/android-ndk/ndk/issues/706 Bug: http://b/113052379 Test: builds Change-Id: I519d4fd825d40c3f72515f29a7e5b12c23a1749a Merged-In: I519d4fd825d40c3f72515f29a7e5b12c23a1749a (cherry picked from commit 85a41536a4885b12120ddafb4d0b3fee8a8613b6) --- .../include/camera/NdkCameraCaptureSession.h | 21 ++- camera/ndk/include/camera/NdkCameraDevice.h | 40 +++--- camera/ndk/include/camera/NdkCameraError.h | 4 - camera/ndk/include/camera/NdkCameraManager.h | 25 ++-- camera/ndk/include/camera/NdkCameraMetadata.h | 14 +- .../include/camera/NdkCameraMetadataTags.h | 5 - camera/ndk/include/camera/NdkCaptureRequest.h | 41 +++--- camera/ndk/libcamera2ndk.map.txt | 16 +-- media/libaaudio/include/aaudio/AAudio.h | 120 +++++++++--------- media/ndk/include/media/NdkImage.h | 32 ++--- media/ndk/include/media/NdkImageReader.h | 36 ++---- media/ndk/include/media/NdkMediaCodec.h | 92 ++++++-------- media/ndk/include/media/NdkMediaCrypto.h | 12 +- media/ndk/include/media/NdkMediaDataSource.h | 16 +-- media/ndk/include/media/NdkMediaDrm.h | 56 ++++---- media/ndk/include/media/NdkMediaExtractor.h | 59 ++++----- media/ndk/include/media/NdkMediaFormat.h | 44 +++---- media/ndk/include/media/NdkMediaMuxer.h | 22 ++-- 18 files changed, 288 insertions(+), 367 deletions(-) diff --git a/camera/ndk/include/camera/NdkCameraCaptureSession.h b/camera/ndk/include/camera/NdkCameraCaptureSession.h index 78e062a889..9bf8247b95 100644 --- a/camera/ndk/include/camera/NdkCameraCaptureSession.h +++ b/camera/ndk/include/camera/NdkCameraCaptureSession.h @@ -45,8 +45,6 @@ __BEGIN_DECLS -#if __ANDROID_API__ >= 24 - /** * ACameraCaptureSession is an opaque type that manages frame captures of a camera device. * @@ -434,7 +432,7 @@ typedef struct ACameraDevice ACameraDevice; * */ camera_status_t ACameraCaptureSession_getDevice( - ACameraCaptureSession* session, /*out*/ACameraDevice** device); + ACameraCaptureSession* session, /*out*/ACameraDevice** device) __INTRODUCED_IN(24); /** * Submit an array of requests to be captured in sequence as a burst in the minimum of time possible. @@ -472,7 +470,7 @@ camera_status_t ACameraCaptureSession_capture( ACameraCaptureSession* session, /*optional*/ACameraCaptureSession_captureCallbacks* callbacks, int numRequests, ACaptureRequest** requests, - /*optional*/int* captureSequenceId); + /*optional*/int* captureSequenceId) __INTRODUCED_IN(24); /** * Request endlessly repeating capture of a sequence of images by this capture session. @@ -526,7 +524,7 @@ camera_status_t ACameraCaptureSession_setRepeatingRequest( ACameraCaptureSession* session, /*optional*/ACameraCaptureSession_captureCallbacks* callbacks, int numRequests, ACaptureRequest** requests, - /*optional*/int* captureSequenceId); + /*optional*/int* captureSequenceId) __INTRODUCED_IN(24); /** * Cancel any ongoing repeating capture set by {@link ACameraCaptureSession_setRepeatingRequest}. @@ -549,7 +547,8 @@ camera_status_t ACameraCaptureSession_setRepeatingRequest( *
  • {@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error
  • *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons
  • */ -camera_status_t ACameraCaptureSession_stopRepeating(ACameraCaptureSession* session); +camera_status_t ACameraCaptureSession_stopRepeating(ACameraCaptureSession* session) + __INTRODUCED_IN(24); /** * Discard all captures currently pending and in-progress as fast as possible. @@ -589,11 +588,8 @@ camera_status_t ACameraCaptureSession_stopRepeating(ACameraCaptureSession* sessi *
  • {@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error
  • *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons
  • */ -camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* session); - -#endif /* __ANDROID_API__ >= 24 */ - -#if __ANDROID_API__ >= 28 +camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* session) + __INTRODUCED_IN(24); typedef struct ACaptureSessionOutput ACaptureSessionOutput; @@ -638,8 +634,7 @@ typedef struct ACaptureSessionOutput ACaptureSessionOutput; *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons
  • */ camera_status_t ACameraCaptureSession_updateSharedOutput(ACameraCaptureSession* session, - ACaptureSessionOutput* output); -#endif /* __ANDROID_API__ >= 28 */ + ACaptureSessionOutput* output) __INTRODUCED_IN(28); __END_DECLS diff --git a/camera/ndk/include/camera/NdkCameraDevice.h b/camera/ndk/include/camera/NdkCameraDevice.h index b715b12e15..bdd27f9942 100644 --- a/camera/ndk/include/camera/NdkCameraDevice.h +++ b/camera/ndk/include/camera/NdkCameraDevice.h @@ -44,8 +44,6 @@ __BEGIN_DECLS -#if __ANDROID_API__ >= 24 - /** * ACameraDevice is opaque type that provides access to a camera device. * @@ -176,7 +174,7 @@ typedef ACameraDevice_StateCallbacks ACameraDevice_stateCallbacks; *
  • {@link ACAMERA_OK} if the method call succeeds.
  • *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if device is NULL.
  • */ -camera_status_t ACameraDevice_close(ACameraDevice* device); +camera_status_t ACameraDevice_close(ACameraDevice* device) __INTRODUCED_IN(24); /** * Return the camera id associated with this camera device. @@ -187,7 +185,7 @@ camera_status_t ACameraDevice_close(ACameraDevice* device); * delete/free by the application. Also the returned string must not be used after the device * has been closed. */ -const char* ACameraDevice_getId(const ACameraDevice* device); +const char* ACameraDevice_getId(const ACameraDevice* device) __INTRODUCED_IN(24); typedef enum { /** @@ -290,7 +288,7 @@ typedef enum { */ camera_status_t ACameraDevice_createCaptureRequest( const ACameraDevice* device, ACameraDevice_request_template templateId, - /*out*/ACaptureRequest** request); + /*out*/ACaptureRequest** request) __INTRODUCED_IN(24); typedef struct ACaptureSessionOutputContainer ACaptureSessionOutputContainer; @@ -313,7 +311,7 @@ typedef struct ACaptureSessionOutput ACaptureSessionOutput; *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if container is NULL.
  • */ camera_status_t ACaptureSessionOutputContainer_create( - /*out*/ACaptureSessionOutputContainer** container); + /*out*/ACaptureSessionOutputContainer** container) __INTRODUCED_IN(24); /** * Free a capture session output container. @@ -322,7 +320,8 @@ camera_status_t ACaptureSessionOutputContainer_create( * * @see ACaptureSessionOutputContainer_create */ -void ACaptureSessionOutputContainer_free(ACaptureSessionOutputContainer* container); +void ACaptureSessionOutputContainer_free(ACaptureSessionOutputContainer* container) + __INTRODUCED_IN(24); /** * Create a ACaptureSessionOutput object. @@ -344,7 +343,7 @@ void ACaptureSessionOutputContainer_free(ACaptureSessionOutputContain * @see ACaptureSessionOutputContainer_add */ camera_status_t ACaptureSessionOutput_create( - ANativeWindow* anw, /*out*/ACaptureSessionOutput** output); + ANativeWindow* anw, /*out*/ACaptureSessionOutput** output) __INTRODUCED_IN(24); /** * Free a ACaptureSessionOutput object. @@ -353,7 +352,7 @@ camera_status_t ACaptureSessionOutput_create( * * @see ACaptureSessionOutput_create */ -void ACaptureSessionOutput_free(ACaptureSessionOutput* output); +void ACaptureSessionOutput_free(ACaptureSessionOutput* output) __INTRODUCED_IN(24); /** * Add an {@link ACaptureSessionOutput} object to {@link ACaptureSessionOutputContainer}. @@ -366,7 +365,8 @@ void ACaptureSessionOutput_free(ACaptureSessionOutput* output); *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if container or output is NULL.
  • */ camera_status_t ACaptureSessionOutputContainer_add( - ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output); + ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output) + __INTRODUCED_IN(24); /** * Remove an {@link ACaptureSessionOutput} object from {@link ACaptureSessionOutputContainer}. @@ -382,7 +382,8 @@ camera_status_t ACaptureSessionOutputContainer_add( *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if container or output is NULL.
  • */ camera_status_t ACaptureSessionOutputContainer_remove( - ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output); + ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output) + __INTRODUCED_IN(24); /** * Create a new camera capture session by providing the target output set of {@link ANativeWindow} @@ -663,11 +664,7 @@ camera_status_t ACameraDevice_createCaptureSession( ACameraDevice* device, const ACaptureSessionOutputContainer* outputs, const ACameraCaptureSession_stateCallbacks* callbacks, - /*out*/ACameraCaptureSession** session); - -#endif /* __ANDROID_API__ >= 24 */ - -#if __ANDROID_API__ >= 28 + /*out*/ACameraCaptureSession** session) __INTRODUCED_IN(24); /** * Create a shared ACaptureSessionOutput object. @@ -691,7 +688,7 @@ camera_status_t ACameraDevice_createCaptureSession( * @see ACaptureSessionOutputContainer_add */ camera_status_t ACaptureSessionSharedOutput_create( - ANativeWindow* anw, /*out*/ACaptureSessionOutput** output); + ANativeWindow* anw, /*out*/ACaptureSessionOutput** output) __INTRODUCED_IN(28); /** * Add a native window to shared ACaptureSessionOutput. @@ -708,7 +705,8 @@ camera_status_t ACaptureSessionSharedOutput_create( * window associated with ACaptureSessionOutput; or anw is already present inside * ACaptureSessionOutput. */ -camera_status_t ACaptureSessionSharedOutput_add(ACaptureSessionOutput *output, ANativeWindow *anw); +camera_status_t ACaptureSessionSharedOutput_add(ACaptureSessionOutput *output, + ANativeWindow *anw) __INTRODUCED_IN(28); /** * Remove a native window from shared ACaptureSessionOutput. @@ -724,7 +722,7 @@ camera_status_t ACaptureSessionSharedOutput_add(ACaptureSessionOutput *output, A * ACaptureSessionOutput. */ camera_status_t ACaptureSessionSharedOutput_remove(ACaptureSessionOutput *output, - ANativeWindow* anw); + ANativeWindow* anw) __INTRODUCED_IN(28); /** * Create a new camera capture session similar to {@link ACameraDevice_createCaptureSession}. This @@ -757,9 +755,7 @@ camera_status_t ACameraDevice_createCaptureSessionWithSessionParameters( const ACaptureSessionOutputContainer* outputs, const ACaptureRequest* sessionParameters, const ACameraCaptureSession_stateCallbacks* callbacks, - /*out*/ACameraCaptureSession** session); - -#endif /* __ANDROID_API__ >= 28 */ + /*out*/ACameraCaptureSession** session) __INTRODUCED_IN(28); __END_DECLS diff --git a/camera/ndk/include/camera/NdkCameraError.h b/camera/ndk/include/camera/NdkCameraError.h index 6b5815502b..e19ce362f4 100644 --- a/camera/ndk/include/camera/NdkCameraError.h +++ b/camera/ndk/include/camera/NdkCameraError.h @@ -40,8 +40,6 @@ __BEGIN_DECLS -#if __ANDROID_API__ >= 24 - typedef enum { ACAMERA_OK = 0, @@ -132,8 +130,6 @@ typedef enum { ACAMERA_ERROR_PERMISSION_DENIED = ACAMERA_ERROR_BASE - 13, } camera_status_t; -#endif /* __ANDROID_API__ >= 24 */ - __END_DECLS #endif /* _NDK_CAMERA_ERROR_H */ diff --git a/camera/ndk/include/camera/NdkCameraManager.h b/camera/ndk/include/camera/NdkCameraManager.h index e5b3ad8aac..a1cca4d926 100644 --- a/camera/ndk/include/camera/NdkCameraManager.h +++ b/camera/ndk/include/camera/NdkCameraManager.h @@ -44,8 +44,6 @@ __BEGIN_DECLS -#if __ANDROID_API__ >= 24 - /** * ACameraManager is opaque type that provides access to camera service. * @@ -65,14 +63,14 @@ typedef struct ACameraManager ACameraManager; * @return a {@link ACameraManager} instance. * */ -ACameraManager* ACameraManager_create(); +ACameraManager* ACameraManager_create() __INTRODUCED_IN(24); /** *

    Delete the {@link ACameraManager} instance and free its resources.

    * * @param manager the {@link ACameraManager} instance to be deleted. */ -void ACameraManager_delete(ACameraManager* manager); +void ACameraManager_delete(ACameraManager* manager) __INTRODUCED_IN(24); /// Struct to hold list of camera devices typedef struct ACameraIdList { @@ -102,14 +100,14 @@ typedef struct ACameraIdList { *
  • {@link ACAMERA_ERROR_NOT_ENOUGH_MEMORY} if allocating memory fails.
  • */ camera_status_t ACameraManager_getCameraIdList(ACameraManager* manager, - /*out*/ACameraIdList** cameraIdList); + /*out*/ACameraIdList** cameraIdList) __INTRODUCED_IN(24); /** * Delete a list of camera devices allocated via {@link ACameraManager_getCameraIdList}. * * @param cameraIdList the {@link ACameraIdList} to be deleted. */ -void ACameraManager_deleteCameraIdList(ACameraIdList* cameraIdList); +void ACameraManager_deleteCameraIdList(ACameraIdList* cameraIdList) __INTRODUCED_IN(24); /** * Definition of camera availability callbacks. @@ -120,7 +118,8 @@ void ACameraManager_deleteCameraIdList(ACameraIdList* cameraIdList); * argument is owned by camera framework and will become invalid immediately after * this callback returns. */ -typedef void (*ACameraManager_AvailabilityCallback)(void* context, const char* cameraId); +typedef void (*ACameraManager_AvailabilityCallback)(void* context, + const char* cameraId) __INTRODUCED_IN(24); /** * A listener for camera devices becoming available or unavailable to open. @@ -168,7 +167,8 @@ typedef struct ACameraManager_AvailabilityListener { * {ACameraManager_AvailabilityCallbacks#onCameraUnavailable} is NULL. */ camera_status_t ACameraManager_registerAvailabilityCallback( - ACameraManager* manager, const ACameraManager_AvailabilityCallbacks* callback); + ACameraManager* manager, + const ACameraManager_AvailabilityCallbacks* callback) __INTRODUCED_IN(24); /** * Unregister camera availability callbacks. @@ -185,7 +185,8 @@ camera_status_t ACameraManager_registerAvailabilityCallback( * {ACameraManager_AvailabilityCallbacks#onCameraUnavailable} is NULL. */ camera_status_t ACameraManager_unregisterAvailabilityCallback( - ACameraManager* manager, const ACameraManager_AvailabilityCallbacks* callback); + ACameraManager* manager, + const ACameraManager_AvailabilityCallbacks* callback) __INTRODUCED_IN(24); /** * Query the capabilities of a camera device. These capabilities are @@ -211,7 +212,7 @@ camera_status_t ACameraManager_unregisterAvailabilityCallback( */ camera_status_t ACameraManager_getCameraCharacteristics( ACameraManager* manager, const char* cameraId, - /*out*/ACameraMetadata** characteristics); + /*out*/ACameraMetadata** characteristics) __INTRODUCED_IN(24); /** * Open a connection to a camera with the given ID. The opened camera device will be @@ -271,9 +272,7 @@ camera_status_t ACameraManager_getCameraCharacteristics( camera_status_t ACameraManager_openCamera( ACameraManager* manager, const char* cameraId, ACameraDevice_StateCallbacks* callback, - /*out*/ACameraDevice** device); - -#endif /* __ANDROID_API__ >= 24 */ + /*out*/ACameraDevice** device) __INTRODUCED_IN(24); __END_DECLS diff --git a/camera/ndk/include/camera/NdkCameraMetadata.h b/camera/ndk/include/camera/NdkCameraMetadata.h index bdb1587198..2078da7d31 100644 --- a/camera/ndk/include/camera/NdkCameraMetadata.h +++ b/camera/ndk/include/camera/NdkCameraMetadata.h @@ -44,8 +44,6 @@ __BEGIN_DECLS -#if __ANDROID_API__ >= 24 - /** * ACameraMetadata is opaque type that provides access to read-only camera metadata like camera * characteristics (via {@link ACameraManager_getCameraCharacteristics}) or capture results (via @@ -191,7 +189,8 @@ typedef struct ACameraMetadata_const_entry { * of input tag value. */ camera_status_t ACameraMetadata_getConstEntry( - const ACameraMetadata* metadata, uint32_t tag, /*out*/ACameraMetadata_const_entry* entry); + const ACameraMetadata* metadata, + uint32_t tag, /*out*/ACameraMetadata_const_entry* entry) __INTRODUCED_IN(24); /** * List all the entry tags in input {@link ACameraMetadata}. @@ -208,7 +207,8 @@ camera_status_t ACameraMetadata_getConstEntry( *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.
  • */ camera_status_t ACameraMetadata_getAllTags( - const ACameraMetadata* metadata, /*out*/int32_t* numEntries, /*out*/const uint32_t** tags); + const ACameraMetadata* metadata, + /*out*/int32_t* numEntries, /*out*/const uint32_t** tags) __INTRODUCED_IN(24); /** * Create a copy of input {@link ACameraMetadata}. @@ -220,16 +220,14 @@ camera_status_t ACameraMetadata_getAllTags( * * @return a valid ACameraMetadata pointer or NULL if the input metadata cannot be copied. */ -ACameraMetadata* ACameraMetadata_copy(const ACameraMetadata* src); +ACameraMetadata* ACameraMetadata_copy(const ACameraMetadata* src) __INTRODUCED_IN(24); /** * Free a {@link ACameraMetadata} structure. * * @param metadata the {@link ACameraMetadata} to be freed. */ -void ACameraMetadata_free(ACameraMetadata* metadata); - -#endif /* __ANDROID_API__ >= 24 */ +void ACameraMetadata_free(ACameraMetadata* metadata) __INTRODUCED_IN(24); __END_DECLS diff --git a/camera/ndk/include/camera/NdkCameraMetadataTags.h b/camera/ndk/include/camera/NdkCameraMetadataTags.h index e90b8f83f7..7398f78715 100644 --- a/camera/ndk/include/camera/NdkCameraMetadataTags.h +++ b/camera/ndk/include/camera/NdkCameraMetadataTags.h @@ -40,8 +40,6 @@ __BEGIN_DECLS -#if __ANDROID_API__ >= 24 - typedef enum acamera_metadata_section { ACAMERA_COLOR_CORRECTION, ACAMERA_CONTROL, @@ -7880,9 +7878,6 @@ typedef enum acamera_metadata_enum_acamera_distortion_correction_mode { } acamera_metadata_enum_android_distortion_correction_mode_t; - -#endif /* __ANDROID_API__ >= 24 */ - __END_DECLS #endif /* _NDK_CAMERA_METADATA_TAGS_H */ diff --git a/camera/ndk/include/camera/NdkCaptureRequest.h b/camera/ndk/include/camera/NdkCaptureRequest.h index 4961ce39f6..2fb5d12c7b 100644 --- a/camera/ndk/include/camera/NdkCaptureRequest.h +++ b/camera/ndk/include/camera/NdkCaptureRequest.h @@ -44,8 +44,6 @@ __BEGIN_DECLS -#if __ANDROID_API__ >= 24 - // Container for output targets typedef struct ACameraOutputTargets ACameraOutputTargets; @@ -101,7 +99,8 @@ typedef struct ACaptureRequest ACaptureRequest; * * @see ACaptureRequest_addTarget */ -camera_status_t ACameraOutputTarget_create(ANativeWindow* window, ACameraOutputTarget** output); +camera_status_t ACameraOutputTarget_create(ANativeWindow* window, + ACameraOutputTarget** output) __INTRODUCED_IN(24); /** * Free a ACameraOutputTarget object. @@ -110,7 +109,7 @@ camera_status_t ACameraOutputTarget_create(ANativeWindow* window, ACameraOutputT * * @see ACameraOutputTarget_create */ -void ACameraOutputTarget_free(ACameraOutputTarget* output); +void ACameraOutputTarget_free(ACameraOutputTarget* output) __INTRODUCED_IN(24); /** * Add an {@link ACameraOutputTarget} object to {@link ACaptureRequest}. @@ -123,7 +122,7 @@ void ACameraOutputTarget_free(ACameraOutputTarget* output); *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request or output is NULL.
  • */ camera_status_t ACaptureRequest_addTarget(ACaptureRequest* request, - const ACameraOutputTarget* output); + const ACameraOutputTarget* output) __INTRODUCED_IN(24); /** * Remove an {@link ACameraOutputTarget} object from {@link ACaptureRequest}. @@ -138,7 +137,7 @@ camera_status_t ACaptureRequest_addTarget(ACaptureRequest* request, *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request or output is NULL.
  • */ camera_status_t ACaptureRequest_removeTarget(ACaptureRequest* request, - const ACameraOutputTarget* output); + const ACameraOutputTarget* output) __INTRODUCED_IN(24); /** * Get a metadata entry from input {@link ACaptureRequest}. @@ -158,7 +157,7 @@ camera_status_t ACaptureRequest_removeTarget(ACaptureRequest* request, * entry of input tag value. */ camera_status_t ACaptureRequest_getConstEntry( - const ACaptureRequest* request, uint32_t tag, ACameraMetadata_const_entry* entry); + const ACaptureRequest* request, uint32_t tag, ACameraMetadata_const_entry* entry) __INTRODUCED_IN(24); /* * List all the entry tags in input {@link ACaptureRequest}. @@ -179,7 +178,7 @@ camera_status_t ACaptureRequest_getConstEntry( *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.
  • */ camera_status_t ACaptureRequest_getAllTags( - const ACaptureRequest* request, /*out*/int32_t* numTags, /*out*/const uint32_t** tags); + const ACaptureRequest* request, /*out*/int32_t* numTags, /*out*/const uint32_t** tags) __INTRODUCED_IN(24); /** * Set/change a camera capture control entry with unsigned 8 bits data type. @@ -198,7 +197,7 @@ camera_status_t ACaptureRequest_getAllTags( * the tag is not controllable by application. */ camera_status_t ACaptureRequest_setEntry_u8( - ACaptureRequest* request, uint32_t tag, uint32_t count, const uint8_t* data); + ACaptureRequest* request, uint32_t tag, uint32_t count, const uint8_t* data) __INTRODUCED_IN(24); /** * Set/change a camera capture control entry with signed 32 bits data type. @@ -217,7 +216,7 @@ camera_status_t ACaptureRequest_setEntry_u8( * the tag is not controllable by application. */ camera_status_t ACaptureRequest_setEntry_i32( - ACaptureRequest* request, uint32_t tag, uint32_t count, const int32_t* data); + ACaptureRequest* request, uint32_t tag, uint32_t count, const int32_t* data) __INTRODUCED_IN(24); /** * Set/change a camera capture control entry with float data type. @@ -236,7 +235,7 @@ camera_status_t ACaptureRequest_setEntry_i32( * the tag is not controllable by application. */ camera_status_t ACaptureRequest_setEntry_float( - ACaptureRequest* request, uint32_t tag, uint32_t count, const float* data); + ACaptureRequest* request, uint32_t tag, uint32_t count, const float* data) __INTRODUCED_IN(24); /** * Set/change a camera capture control entry with signed 64 bits data type. @@ -255,7 +254,7 @@ camera_status_t ACaptureRequest_setEntry_float( * the tag is not controllable by application. */ camera_status_t ACaptureRequest_setEntry_i64( - ACaptureRequest* request, uint32_t tag, uint32_t count, const int64_t* data); + ACaptureRequest* request, uint32_t tag, uint32_t count, const int64_t* data) __INTRODUCED_IN(24); /** * Set/change a camera capture control entry with double data type. @@ -274,7 +273,7 @@ camera_status_t ACaptureRequest_setEntry_i64( * the tag is not controllable by application. */ camera_status_t ACaptureRequest_setEntry_double( - ACaptureRequest* request, uint32_t tag, uint32_t count, const double* data); + ACaptureRequest* request, uint32_t tag, uint32_t count, const double* data) __INTRODUCED_IN(24); /** * Set/change a camera capture control entry with rational data type. @@ -294,18 +293,14 @@ camera_status_t ACaptureRequest_setEntry_double( */ camera_status_t ACaptureRequest_setEntry_rational( ACaptureRequest* request, uint32_t tag, uint32_t count, - const ACameraMetadata_rational* data); + const ACameraMetadata_rational* data) __INTRODUCED_IN(24); /** * Free a {@link ACaptureRequest} structure. * * @param request the {@link ACaptureRequest} to be freed. */ -void ACaptureRequest_free(ACaptureRequest* request); - -#endif /* __ANDROID_API__ >= 24 */ - -#if __ANDROID_API__ >= 28 +void ACaptureRequest_free(ACaptureRequest* request) __INTRODUCED_IN(24); /** * Associate an arbitrary user context pointer to the {@link ACaptureRequest} @@ -325,7 +320,7 @@ void ACaptureRequest_free(ACaptureRequest* request); *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL.
  • */ camera_status_t ACaptureRequest_setUserContext( - ACaptureRequest* request, void* context); + ACaptureRequest* request, void* context) __INTRODUCED_IN(28); /** * Get the user context pointer of the {@link ACaptureRequest} @@ -341,7 +336,7 @@ camera_status_t ACaptureRequest_setUserContext( *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL.
  • */ camera_status_t ACaptureRequest_getUserContext( - const ACaptureRequest* request, /*out*/void** context); + const ACaptureRequest* request, /*out*/void** context) __INTRODUCED_IN(28); /** * Create a copy of input {@link ACaptureRequest}. @@ -353,9 +348,7 @@ camera_status_t ACaptureRequest_getUserContext( * * @return a valid ACaptureRequest pointer or NULL if the input request cannot be copied. */ -ACaptureRequest* ACaptureRequest_copy(const ACaptureRequest* src); - -#endif /* __ANDROID_API__ >= 28 */ +ACaptureRequest* ACaptureRequest_copy(const ACaptureRequest* src) __INTRODUCED_IN(28); __END_DECLS diff --git a/camera/ndk/libcamera2ndk.map.txt b/camera/ndk/libcamera2ndk.map.txt index d179aa01f0..a29e96df34 100644 --- a/camera/ndk/libcamera2ndk.map.txt +++ b/camera/ndk/libcamera2ndk.map.txt @@ -6,11 +6,11 @@ LIBCAMERA2NDK { ACameraCaptureSession_getDevice; ACameraCaptureSession_setRepeatingRequest; ACameraCaptureSession_stopRepeating; - ACameraCaptureSession_updateSharedOutput; + ACameraCaptureSession_updateSharedOutput; # introduced=28 ACameraDevice_close; ACameraDevice_createCaptureRequest; ACameraDevice_createCaptureSession; - ACameraDevice_createCaptureSessionWithSessionParameters; + ACameraDevice_createCaptureSessionWithSessionParameters; # introduced=28 ACameraDevice_getId; ACameraManager_create; ACameraManager_delete; @@ -27,11 +27,11 @@ LIBCAMERA2NDK { ACameraOutputTarget_create; ACameraOutputTarget_free; ACaptureRequest_addTarget; - ACaptureRequest_copy; + ACaptureRequest_copy; # introduced=28 ACaptureRequest_free; ACaptureRequest_getAllTags; ACaptureRequest_getConstEntry; - ACaptureRequest_getUserContext; + ACaptureRequest_getUserContext; # introduced=28 ACaptureRequest_removeTarget; ACaptureRequest_setEntry_double; ACaptureRequest_setEntry_float; @@ -39,15 +39,15 @@ LIBCAMERA2NDK { ACaptureRequest_setEntry_i64; ACaptureRequest_setEntry_rational; ACaptureRequest_setEntry_u8; - ACaptureRequest_setUserContext; + ACaptureRequest_setUserContext; # introduced=28 ACaptureSessionOutputContainer_add; ACaptureSessionOutputContainer_create; ACaptureSessionOutputContainer_free; ACaptureSessionOutputContainer_remove; ACaptureSessionOutput_create; - ACaptureSessionSharedOutput_create; - ACaptureSessionSharedOutput_add; - ACaptureSessionSharedOutput_remove; + ACaptureSessionSharedOutput_create; # introduced=28 + ACaptureSessionSharedOutput_add; # introduced=28 + ACaptureSessionSharedOutput_remove; # introduced=28 ACaptureSessionOutput_free; local: *; diff --git a/media/libaaudio/include/aaudio/AAudio.h b/media/libaaudio/include/aaudio/AAudio.h index 5b29419535..1493b261e2 100644 --- a/media/libaaudio/include/aaudio/AAudio.h +++ b/media/libaaudio/include/aaudio/AAudio.h @@ -423,7 +423,7 @@ typedef struct AAudioStreamBuilderStruct AAudioStreamBuilder; * * @return pointer to a text representation of an AAudio result code. */ -AAUDIO_API const char * AAudio_convertResultToText(aaudio_result_t returnCode); +AAUDIO_API const char * AAudio_convertResultToText(aaudio_result_t returnCode) __INTRODUCED_IN(26); /** * The text is the ASCII symbol corresponding to the stream state, @@ -433,7 +433,8 @@ AAUDIO_API const char * AAudio_convertResultToText(aaudio_result_t returnCode); * * @return pointer to a text representation of an AAudio state. */ -AAUDIO_API const char * AAudio_convertStreamStateToText(aaudio_stream_state_t state); +AAUDIO_API const char * AAudio_convertStreamStateToText(aaudio_stream_state_t state) + __INTRODUCED_IN(26); // ============================================================ // StreamBuilder @@ -451,7 +452,8 @@ AAUDIO_API const char * AAudio_convertStreamStateToText(aaudio_stream_state_t st * * AAudioStreamBuilder_delete() must be called when you are done using the builder. */ -AAUDIO_API aaudio_result_t AAudio_createStreamBuilder(AAudioStreamBuilder** builder); +AAUDIO_API aaudio_result_t AAudio_createStreamBuilder(AAudioStreamBuilder** builder) + __INTRODUCED_IN(26); /** * Request an audio device identified device using an ID. @@ -464,7 +466,7 @@ AAUDIO_API aaudio_result_t AAudio_createStreamBuilder(AAudioStreamBuilder** buil * @param deviceId device identifier or AAUDIO_UNSPECIFIED */ AAUDIO_API void AAudioStreamBuilder_setDeviceId(AAudioStreamBuilder* builder, - int32_t deviceId); + int32_t deviceId) __INTRODUCED_IN(26); /** * Request a sample rate in Hertz. @@ -481,7 +483,7 @@ AAUDIO_API void AAudioStreamBuilder_setDeviceId(AAudioStreamBuilder* builder, * @param sampleRate frames per second. Common rates include 44100 and 48000 Hz. */ AAUDIO_API void AAudioStreamBuilder_setSampleRate(AAudioStreamBuilder* builder, - int32_t sampleRate); + int32_t sampleRate) __INTRODUCED_IN(26); /** * Request a number of channels for the stream. @@ -498,7 +500,7 @@ AAUDIO_API void AAudioStreamBuilder_setSampleRate(AAudioStreamBuilder* builder, * @param channelCount Number of channels desired. */ AAUDIO_API void AAudioStreamBuilder_setChannelCount(AAudioStreamBuilder* builder, - int32_t channelCount); + int32_t channelCount) __INTRODUCED_IN(26); /** * Identical to AAudioStreamBuilder_setChannelCount(). @@ -507,7 +509,7 @@ AAUDIO_API void AAudioStreamBuilder_setChannelCount(AAudioStreamBuilder* builder * @param samplesPerFrame Number of samples in a frame. */ AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* builder, - int32_t samplesPerFrame); + int32_t samplesPerFrame) __INTRODUCED_IN(26); /** * Request a sample data format, for example AAUDIO_FORMAT_PCM_I16. @@ -524,7 +526,7 @@ AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* buil * @param format common formats are AAUDIO_FORMAT_PCM_FLOAT and AAUDIO_FORMAT_PCM_I16. */ AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder, - aaudio_format_t format); + aaudio_format_t format) __INTRODUCED_IN(26); /** * Request a mode for sharing the device. @@ -538,7 +540,7 @@ AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder, * @param sharingMode AAUDIO_SHARING_MODE_SHARED or AAUDIO_SHARING_MODE_EXCLUSIVE */ AAUDIO_API void AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder* builder, - aaudio_sharing_mode_t sharingMode); + aaudio_sharing_mode_t sharingMode) __INTRODUCED_IN(26); /** * Request the direction for a stream. @@ -549,7 +551,7 @@ AAUDIO_API void AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder* builder, * @param direction AAUDIO_DIRECTION_OUTPUT or AAUDIO_DIRECTION_INPUT */ AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder, - aaudio_direction_t direction); + aaudio_direction_t direction) __INTRODUCED_IN(26); /** * Set the requested buffer capacity in frames. @@ -561,7 +563,7 @@ AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder, * @param numFrames the desired buffer capacity in frames or AAUDIO_UNSPECIFIED */ AAUDIO_API void AAudioStreamBuilder_setBufferCapacityInFrames(AAudioStreamBuilder* builder, - int32_t numFrames); + int32_t numFrames) __INTRODUCED_IN(26); /** * Set the requested performance mode. @@ -578,7 +580,7 @@ AAUDIO_API void AAudioStreamBuilder_setBufferCapacityInFrames(AAudioStreamBuilde * @param mode the desired performance mode, eg. AAUDIO_PERFORMANCE_MODE_LOW_LATENCY */ AAUDIO_API void AAudioStreamBuilder_setPerformanceMode(AAudioStreamBuilder* builder, - aaudio_performance_mode_t mode); + aaudio_performance_mode_t mode) __INTRODUCED_IN(26); /** * Set the intended use case for the stream. @@ -595,7 +597,7 @@ AAUDIO_API void AAudioStreamBuilder_setPerformanceMode(AAudioStreamBuilder* buil * @param usage the desired usage, eg. AAUDIO_USAGE_GAME */ AAUDIO_API void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder, - aaudio_usage_t usage); + aaudio_usage_t usage) __INTRODUCED_IN(28); /** * Set the type of audio data that the stream will carry. @@ -612,7 +614,7 @@ AAUDIO_API void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder, * @param contentType the type of audio data, eg. AAUDIO_CONTENT_TYPE_SPEECH */ AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, - aaudio_content_type_t contentType); + aaudio_content_type_t contentType) __INTRODUCED_IN(28); /** * Set the input (capture) preset for the stream. @@ -632,7 +634,7 @@ AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, * @param inputPreset the desired configuration for recording */ AAUDIO_API void AAudioStreamBuilder_setInputPreset(AAudioStreamBuilder* builder, - aaudio_input_preset_t inputPreset); + aaudio_input_preset_t inputPreset) __INTRODUCED_IN(28); /** Set the requested session ID. * @@ -662,7 +664,7 @@ AAUDIO_API void AAudioStreamBuilder_setInputPreset(AAudioStreamBuilder* builder, * @param sessionId an allocated sessionID or AAUDIO_SESSION_ID_ALLOCATE */ AAUDIO_API void AAudioStreamBuilder_setSessionId(AAudioStreamBuilder* builder, - aaudio_session_id_t sessionId); + aaudio_session_id_t sessionId) __INTRODUCED_IN(28); /** * Return one of these values from the data callback function. @@ -760,8 +762,7 @@ typedef aaudio_data_callback_result_t (*AAudioStream_dataCallback)( * to the callback functions. */ AAUDIO_API void AAudioStreamBuilder_setDataCallback(AAudioStreamBuilder* builder, - AAudioStream_dataCallback callback, - void *userData); + AAudioStream_dataCallback callback, void *userData) __INTRODUCED_IN(26); /** * Set the requested data callback buffer size in frames. @@ -787,7 +788,7 @@ AAUDIO_API void AAudioStreamBuilder_setDataCallback(AAudioStreamBuilder* builder * @param numFrames the desired buffer size in frames or AAUDIO_UNSPECIFIED */ AAUDIO_API void AAudioStreamBuilder_setFramesPerDataCallback(AAudioStreamBuilder* builder, - int32_t numFrames); + int32_t numFrames) __INTRODUCED_IN(26); /** * Prototype for the callback function that is passed to @@ -840,8 +841,7 @@ typedef void (*AAudioStream_errorCallback)( * to the callback functions. */ AAUDIO_API void AAudioStreamBuilder_setErrorCallback(AAudioStreamBuilder* builder, - AAudioStream_errorCallback callback, - void *userData); + AAudioStream_errorCallback callback, void *userData) __INTRODUCED_IN(26); /** * Open a stream based on the options in the StreamBuilder. @@ -854,7 +854,7 @@ AAUDIO_API void AAudioStreamBuilder_setErrorCallback(AAudioStreamBuilder* builde * @return AAUDIO_OK or a negative error. */ AAUDIO_API aaudio_result_t AAudioStreamBuilder_openStream(AAudioStreamBuilder* builder, - AAudioStream** stream); + AAudioStream** stream) __INTRODUCED_IN(26); /** * Delete the resources associated with the StreamBuilder. @@ -862,7 +862,8 @@ AAUDIO_API aaudio_result_t AAudioStreamBuilder_openStream(AAudioStreamBuilder* * @param builder reference provided by AAudio_createStreamBuilder() * @return AAUDIO_OK or a negative error. */ -AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* builder); +AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* builder) + __INTRODUCED_IN(26); // ============================================================ // Stream Control @@ -874,7 +875,7 @@ AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* buil * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. */ -AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream* stream); +AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream* stream) __INTRODUCED_IN(26); /** * Asynchronously request to start playing the stream. For output streams, one should @@ -885,7 +886,7 @@ AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. */ -AAUDIO_API aaudio_result_t AAudioStream_requestStart(AAudioStream* stream); +AAUDIO_API aaudio_result_t AAudioStream_requestStart(AAudioStream* stream) __INTRODUCED_IN(26); /** * Asynchronous request for the stream to pause. @@ -899,7 +900,7 @@ AAUDIO_API aaudio_result_t AAudioStream_requestStart(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. */ -AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream* stream); +AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream* stream) __INTRODUCED_IN(26); /** * Asynchronous request for the stream to flush. @@ -913,7 +914,7 @@ AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. */ -AAUDIO_API aaudio_result_t AAudioStream_requestFlush(AAudioStream* stream); +AAUDIO_API aaudio_result_t AAudioStream_requestFlush(AAudioStream* stream) __INTRODUCED_IN(26); /** * Asynchronous request for the stream to stop. @@ -923,7 +924,7 @@ AAUDIO_API aaudio_result_t AAudioStream_requestFlush(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. */ -AAUDIO_API aaudio_result_t AAudioStream_requestStop(AAudioStream* stream); +AAUDIO_API aaudio_result_t AAudioStream_requestStop(AAudioStream* stream) __INTRODUCED_IN(26); /** * Query the current state of the client, eg. AAUDIO_STREAM_STATE_PAUSING @@ -935,7 +936,7 @@ AAUDIO_API aaudio_result_t AAudioStream_requestStop(AAudioStream* stream); * * @param stream reference provided by AAudioStreamBuilder_openStream() */ -AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream); +AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream) __INTRODUCED_IN(26); /** * Wait until the current state no longer matches the input state. @@ -960,9 +961,8 @@ AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream); * @return AAUDIO_OK or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange(AAudioStream* stream, - aaudio_stream_state_t inputState, - aaudio_stream_state_t *nextState, - int64_t timeoutNanoseconds); + aaudio_stream_state_t inputState, aaudio_stream_state_t *nextState, + int64_t timeoutNanoseconds) __INTRODUCED_IN(26); // ============================================================ // Stream I/O @@ -989,9 +989,7 @@ AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange(AAudioStream* stream, * @return The number of frames actually read or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_read(AAudioStream* stream, - void *buffer, - int32_t numFrames, - int64_t timeoutNanoseconds); + void *buffer, int32_t numFrames, int64_t timeoutNanoseconds) __INTRODUCED_IN(26); /** * Write data to the stream. @@ -1014,9 +1012,7 @@ AAUDIO_API aaudio_result_t AAudioStream_read(AAudioStream* stream, * @return The number of frames actually written or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_write(AAudioStream* stream, - const void *buffer, - int32_t numFrames, - int64_t timeoutNanoseconds); + const void *buffer, int32_t numFrames, int64_t timeoutNanoseconds) __INTRODUCED_IN(26); // ============================================================ // Stream - queries @@ -1039,7 +1035,7 @@ AAUDIO_API aaudio_result_t AAudioStream_write(AAudioStream* stream, * @return actual buffer size in frames or a negative error */ AAUDIO_API aaudio_result_t AAudioStream_setBufferSizeInFrames(AAudioStream* stream, - int32_t numFrames); + int32_t numFrames) __INTRODUCED_IN(26); /** * Query the maximum number of frames that can be filled without blocking. @@ -1047,7 +1043,7 @@ AAUDIO_API aaudio_result_t AAudioStream_setBufferSizeInFrames(AAudioStream* stre * @param stream reference provided by AAudioStreamBuilder_openStream() * @return buffer size in frames. */ -AAUDIO_API int32_t AAudioStream_getBufferSizeInFrames(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getBufferSizeInFrames(AAudioStream* stream) __INTRODUCED_IN(26); /** * Query the number of frames that the application should read or write at @@ -1062,7 +1058,7 @@ AAUDIO_API int32_t AAudioStream_getBufferSizeInFrames(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return burst size */ -AAUDIO_API int32_t AAudioStream_getFramesPerBurst(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getFramesPerBurst(AAudioStream* stream) __INTRODUCED_IN(26); /** * Query maximum buffer capacity in frames. @@ -1070,7 +1066,7 @@ AAUDIO_API int32_t AAudioStream_getFramesPerBurst(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return buffer capacity in frames */ -AAUDIO_API int32_t AAudioStream_getBufferCapacityInFrames(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getBufferCapacityInFrames(AAudioStream* stream) __INTRODUCED_IN(26); /** * Query the size of the buffer that will be passed to the dataProc callback @@ -1091,7 +1087,7 @@ AAUDIO_API int32_t AAudioStream_getBufferCapacityInFrames(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return callback buffer size in frames or AAUDIO_UNSPECIFIED */ -AAUDIO_API int32_t AAudioStream_getFramesPerDataCallback(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getFramesPerDataCallback(AAudioStream* stream) __INTRODUCED_IN(26); /** * An XRun is an Underrun or an Overrun. @@ -1108,13 +1104,13 @@ AAUDIO_API int32_t AAudioStream_getFramesPerDataCallback(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return the underrun or overrun count */ -AAUDIO_API int32_t AAudioStream_getXRunCount(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getXRunCount(AAudioStream* stream) __INTRODUCED_IN(26); /** * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual sample rate */ -AAUDIO_API int32_t AAudioStream_getSampleRate(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getSampleRate(AAudioStream* stream) __INTRODUCED_IN(26); /** * A stream has one or more channels of data. @@ -1123,7 +1119,7 @@ AAUDIO_API int32_t AAudioStream_getSampleRate(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual number of channels */ -AAUDIO_API int32_t AAudioStream_getChannelCount(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getChannelCount(AAudioStream* stream) __INTRODUCED_IN(26); /** * Identical to AAudioStream_getChannelCount(). @@ -1131,39 +1127,41 @@ AAUDIO_API int32_t AAudioStream_getChannelCount(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual number of samples frame */ -AAUDIO_API int32_t AAudioStream_getSamplesPerFrame(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getSamplesPerFrame(AAudioStream* stream) __INTRODUCED_IN(26); /** * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual device ID */ -AAUDIO_API int32_t AAudioStream_getDeviceId(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getDeviceId(AAudioStream* stream) __INTRODUCED_IN(26); /** * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual data format */ -AAUDIO_API aaudio_format_t AAudioStream_getFormat(AAudioStream* stream); +AAUDIO_API aaudio_format_t AAudioStream_getFormat(AAudioStream* stream) __INTRODUCED_IN(26); /** * Provide actual sharing mode. * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual sharing mode */ -AAUDIO_API aaudio_sharing_mode_t AAudioStream_getSharingMode(AAudioStream* stream); +AAUDIO_API aaudio_sharing_mode_t AAudioStream_getSharingMode(AAudioStream* stream) + __INTRODUCED_IN(26); /** * Get the performance mode used by the stream. * * @param stream reference provided by AAudioStreamBuilder_openStream() */ -AAUDIO_API aaudio_performance_mode_t AAudioStream_getPerformanceMode(AAudioStream* stream); +AAUDIO_API aaudio_performance_mode_t AAudioStream_getPerformanceMode(AAudioStream* stream) + __INTRODUCED_IN(26); /** * @param stream reference provided by AAudioStreamBuilder_openStream() * @return direction */ -AAUDIO_API aaudio_direction_t AAudioStream_getDirection(AAudioStream* stream); +AAUDIO_API aaudio_direction_t AAudioStream_getDirection(AAudioStream* stream) __INTRODUCED_IN(26); /** * Passes back the number of frames that have been written since the stream was created. @@ -1176,7 +1174,7 @@ AAUDIO_API aaudio_direction_t AAudioStream_getDirection(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return frames written */ -AAUDIO_API int64_t AAudioStream_getFramesWritten(AAudioStream* stream); +AAUDIO_API int64_t AAudioStream_getFramesWritten(AAudioStream* stream) __INTRODUCED_IN(26); /** * Passes back the number of frames that have been read since the stream was created. @@ -1189,7 +1187,7 @@ AAUDIO_API int64_t AAudioStream_getFramesWritten(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return frames read */ -AAUDIO_API int64_t AAudioStream_getFramesRead(AAudioStream* stream); +AAUDIO_API int64_t AAudioStream_getFramesRead(AAudioStream* stream) __INTRODUCED_IN(26); /** * Passes back the session ID associated with this stream. @@ -1213,7 +1211,7 @@ AAUDIO_API int64_t AAudioStream_getFramesRead(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return session ID or AAUDIO_SESSION_ID_NONE */ -AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream); +AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream) __INTRODUCED_IN(28); /** * Passes back the time at which a particular frame was presented. @@ -1238,9 +1236,7 @@ AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream); * @return AAUDIO_OK or a negative error */ AAUDIO_API aaudio_result_t AAudioStream_getTimestamp(AAudioStream* stream, - clockid_t clockid, - int64_t *framePosition, - int64_t *timeNanoseconds); + clockid_t clockid, int64_t *framePosition, int64_t *timeNanoseconds) __INTRODUCED_IN(26); /** * Return the use case for the stream. @@ -1250,7 +1246,7 @@ AAUDIO_API aaudio_result_t AAudioStream_getTimestamp(AAudioStream* stream, * @param stream reference provided by AAudioStreamBuilder_openStream() * @return frames read */ -AAUDIO_API aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream); +AAUDIO_API aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream) __INTRODUCED_IN(28); /** * Return the content type for the stream. @@ -1260,7 +1256,8 @@ AAUDIO_API aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return content type, for example AAUDIO_CONTENT_TYPE_MUSIC */ -AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* stream); +AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* stream) + __INTRODUCED_IN(28); /** * Return the input preset for the stream. @@ -1270,7 +1267,8 @@ AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* strea * @param stream reference provided by AAudioStreamBuilder_openStream() * @return input preset, for example AAUDIO_INPUT_PRESET_CAMCORDER */ -AAUDIO_API aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* stream); +AAUDIO_API aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* stream) + __INTRODUCED_IN(28); #ifdef __cplusplus } diff --git a/media/ndk/include/media/NdkImage.h b/media/ndk/include/media/NdkImage.h index 19df760ab3..38e12e32bf 100644 --- a/media/ndk/include/media/NdkImage.h +++ b/media/ndk/include/media/NdkImage.h @@ -516,8 +516,6 @@ typedef struct AImageCropRect { int32_t bottom; } AImageCropRect; -#if __ANDROID_API__ >= 24 - /** * Return the image back the the system and delete the AImage object from memory. * @@ -529,7 +527,7 @@ typedef struct AImageCropRect { * * @param image The {@link AImage} to be deleted. */ -void AImage_delete(AImage* image); +void AImage_delete(AImage* image) __INTRODUCED_IN(24); /** * Query the width of the input {@link AImage}. @@ -543,7 +541,7 @@ void AImage_delete(AImage* image); *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this * image has been deleted.
  • */ -media_status_t AImage_getWidth(const AImage* image, /*out*/int32_t* width); +media_status_t AImage_getWidth(const AImage* image, /*out*/int32_t* width) __INTRODUCED_IN(24); /** * Query the height of the input {@link AImage}. @@ -557,7 +555,7 @@ media_status_t AImage_getWidth(const AImage* image, /*out*/int32_t* width); *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this * image has been deleted.
  • */ -media_status_t AImage_getHeight(const AImage* image, /*out*/int32_t* height); +media_status_t AImage_getHeight(const AImage* image, /*out*/int32_t* height) __INTRODUCED_IN(24); /** * Query the format of the input {@link AImage}. @@ -573,7 +571,7 @@ media_status_t AImage_getHeight(const AImage* image, /*out*/int32_t* height); *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this * image has been deleted.
  • */ -media_status_t AImage_getFormat(const AImage* image, /*out*/int32_t* format); +media_status_t AImage_getFormat(const AImage* image, /*out*/int32_t* format) __INTRODUCED_IN(24); /** * Query the cropped rectangle of the input {@link AImage}. @@ -590,7 +588,7 @@ media_status_t AImage_getFormat(const AImage* image, /*out*/int32_t* format); *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this * image has been deleted.
  • */ -media_status_t AImage_getCropRect(const AImage* image, /*out*/AImageCropRect* rect); +media_status_t AImage_getCropRect(const AImage* image, /*out*/AImageCropRect* rect) __INTRODUCED_IN(24); /** * Query the timestamp of the input {@link AImage}. @@ -614,7 +612,7 @@ media_status_t AImage_getCropRect(const AImage* image, /*out*/AImageCropRect* re *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this * image has been deleted.
  • */ -media_status_t AImage_getTimestamp(const AImage* image, /*out*/int64_t* timestampNs); +media_status_t AImage_getTimestamp(const AImage* image, /*out*/int64_t* timestampNs) __INTRODUCED_IN(24); /** * Query the number of planes of the input {@link AImage}. @@ -632,7 +630,7 @@ media_status_t AImage_getTimestamp(const AImage* image, /*out*/int64_t* timestam *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this * image has been deleted.
  • */ -media_status_t AImage_getNumberOfPlanes(const AImage* image, /*out*/int32_t* numPlanes); +media_status_t AImage_getNumberOfPlanes(const AImage* image, /*out*/int32_t* numPlanes) __INTRODUCED_IN(24); /** * Query the pixel stride of the input {@link AImage}. @@ -660,7 +658,7 @@ media_status_t AImage_getNumberOfPlanes(const AImage* image, /*out*/int32_t* num * for CPU access. */ media_status_t AImage_getPlanePixelStride( - const AImage* image, int planeIdx, /*out*/int32_t* pixelStride); + const AImage* image, int planeIdx, /*out*/int32_t* pixelStride) __INTRODUCED_IN(24); /** * Query the row stride of the input {@link AImage}. @@ -687,7 +685,7 @@ media_status_t AImage_getPlanePixelStride( * for CPU access. */ media_status_t AImage_getPlaneRowStride( - const AImage* image, int planeIdx, /*out*/int32_t* rowStride); + const AImage* image, int planeIdx, /*out*/int32_t* rowStride) __INTRODUCED_IN(24); /** * Get the data pointer of the input image for direct application access. @@ -712,11 +710,7 @@ media_status_t AImage_getPlaneRowStride( */ media_status_t AImage_getPlaneData( const AImage* image, int planeIdx, - /*out*/uint8_t** data, /*out*/int* dataLength); - -#endif /* __ANDROID_API__ >= 24 */ - -#if __ANDROID_API__ >= 26 + /*out*/uint8_t** data, /*out*/int* dataLength) __INTRODUCED_IN(24); /** * Return the image back the the system and delete the AImage object from memory asynchronously. @@ -732,7 +726,7 @@ media_status_t AImage_getPlaneData( * * @see sync.h */ -void AImage_deleteAsync(AImage* image, int releaseFenceFd); +void AImage_deleteAsync(AImage* image, int releaseFenceFd) __INTRODUCED_IN(26); /** * Get the hardware buffer handle of the input image intended for GPU and/or hardware access. @@ -760,9 +754,7 @@ void AImage_deleteAsync(AImage* image, int releaseFenceFd); * * @see AImageReader_ImageCallback */ -media_status_t AImage_getHardwareBuffer(const AImage* image, /*out*/AHardwareBuffer** buffer); - -#endif /* __ANDROID_API__ >= 26 */ +media_status_t AImage_getHardwareBuffer(const AImage* image, /*out*/AHardwareBuffer** buffer) __INTRODUCED_IN(26); __END_DECLS diff --git a/media/ndk/include/media/NdkImageReader.h b/media/ndk/include/media/NdkImageReader.h index 571410bf4d..eb1a44aaa2 100644 --- a/media/ndk/include/media/NdkImageReader.h +++ b/media/ndk/include/media/NdkImageReader.h @@ -50,8 +50,6 @@ __BEGIN_DECLS */ typedef struct AImageReader AImageReader; -#if __ANDROID_API__ >= 24 - /** * Create a new reader for images of the desired size and format. * @@ -88,7 +86,7 @@ typedef struct AImageReader AImageReader; */ media_status_t AImageReader_new( int32_t width, int32_t height, int32_t format, int32_t maxImages, - /*out*/AImageReader** reader); + /*out*/AImageReader** reader) __INTRODUCED_IN(24); /** * Delete an {@link AImageReader} and return all images generated by this reader to system. @@ -100,7 +98,7 @@ media_status_t AImageReader_new( * * @param reader The image reader to be deleted. */ -void AImageReader_delete(AImageReader* reader); +void AImageReader_delete(AImageReader* reader) __INTRODUCED_IN(24); /** * Get a {@link ANativeWindow} that can be used to produce {@link AImage} for this image reader. @@ -114,7 +112,7 @@ void AImageReader_delete(AImageReader* reader); *
  • {@link AMEDIA_OK} if the method call succeeds.
  • *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or window is NULL.
  • */ -media_status_t AImageReader_getWindow(AImageReader* reader, /*out*/ANativeWindow** window); +media_status_t AImageReader_getWindow(AImageReader* reader, /*out*/ANativeWindow** window) __INTRODUCED_IN(24); /** * Query the default width of the {@link AImage} generated by this reader, in pixels. @@ -130,7 +128,7 @@ media_status_t AImageReader_getWindow(AImageReader* reader, /*out*/ANativeWindow *
  • {@link AMEDIA_OK} if the method call succeeds.
  • *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or width is NULL.
  • */ -media_status_t AImageReader_getWidth(const AImageReader* reader, /*out*/int32_t* width); +media_status_t AImageReader_getWidth(const AImageReader* reader, /*out*/int32_t* width) __INTRODUCED_IN(24); /** * Query the default height of the {@link AImage} generated by this reader, in pixels. @@ -146,7 +144,7 @@ media_status_t AImageReader_getWidth(const AImageReader* reader, /*out*/int32_t* *
  • {@link AMEDIA_OK} if the method call succeeds.
  • *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or height is NULL.
  • */ -media_status_t AImageReader_getHeight(const AImageReader* reader, /*out*/int32_t* height); +media_status_t AImageReader_getHeight(const AImageReader* reader, /*out*/int32_t* height) __INTRODUCED_IN(24); /** * Query the format of the {@link AImage} generated by this reader. @@ -159,7 +157,7 @@ media_status_t AImageReader_getHeight(const AImageReader* reader, /*out*/int32_t *
  • {@link AMEDIA_OK} if the method call succeeds.
  • *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or format is NULL.
  • */ -media_status_t AImageReader_getFormat(const AImageReader* reader, /*out*/int32_t* format); +media_status_t AImageReader_getFormat(const AImageReader* reader, /*out*/int32_t* format) __INTRODUCED_IN(24); /** * Query the maximum number of concurrently acquired {@link AImage}s of this reader. @@ -172,7 +170,7 @@ media_status_t AImageReader_getFormat(const AImageReader* reader, /*out*/int32_t *
  • {@link AMEDIA_OK} if the method call succeeds.
  • *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or maxImages is NULL.
  • */ -media_status_t AImageReader_getMaxImages(const AImageReader* reader, /*out*/int32_t* maxImages); +media_status_t AImageReader_getMaxImages(const AImageReader* reader, /*out*/int32_t* maxImages) __INTRODUCED_IN(24); /** * Acquire the next {@link AImage} from the image reader's queue. @@ -208,7 +206,7 @@ media_status_t AImageReader_getMaxImages(const AImageReader* reader, /*out*/int3 * * @see AImageReader_acquireLatestImage */ -media_status_t AImageReader_acquireNextImage(AImageReader* reader, /*out*/AImage** image); +media_status_t AImageReader_acquireNextImage(AImageReader* reader, /*out*/AImage** image) __INTRODUCED_IN(24); /** @@ -252,7 +250,7 @@ media_status_t AImageReader_acquireNextImage(AImageReader* reader, /*out*/AImage * * @see AImageReader_acquireNextImage */ -media_status_t AImageReader_acquireLatestImage(AImageReader* reader, /*out*/AImage** image); +media_status_t AImageReader_acquireLatestImage(AImageReader* reader, /*out*/AImage** image) __INTRODUCED_IN(24); /** @@ -296,11 +294,7 @@ typedef struct AImageReader_ImageListener { *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader is NULL.
  • */ media_status_t AImageReader_setImageListener( - AImageReader* reader, AImageReader_ImageListener* listener); - -#endif /* __ANDROID_API__ >= 24 */ - -#if __ANDROID_API__ >= 26 + AImageReader* reader, AImageReader_ImageListener* listener) __INTRODUCED_IN(24); /** * AImageReader constructor similar to {@link AImageReader_new} that takes an additional parameter @@ -365,7 +359,7 @@ media_status_t AImageReader_setImageListener( */ media_status_t AImageReader_newWithUsage( int32_t width, int32_t height, int32_t format, uint64_t usage, int32_t maxImages, - /*out*/ AImageReader** reader); + /*out*/ AImageReader** reader) __INTRODUCED_IN(26); /** * Acquire the next {@link AImage} from the image reader's queue asynchronously. @@ -384,7 +378,7 @@ media_status_t AImageReader_newWithUsage( * @see sync_get_fence_info */ media_status_t AImageReader_acquireNextImageAsync( - AImageReader* reader, /*out*/AImage** image, /*out*/int* acquireFenceFd); + AImageReader* reader, /*out*/AImage** image, /*out*/int* acquireFenceFd) __INTRODUCED_IN(26); /** * Acquire the latest {@link AImage} from the image reader's queue asynchronously, dropping older @@ -404,7 +398,7 @@ media_status_t AImageReader_acquireNextImageAsync( * @see sync_get_fence_info */ media_status_t AImageReader_acquireLatestImageAsync( - AImageReader* reader, /*out*/AImage** image, /*out*/int* acquireFenceFd); + AImageReader* reader, /*out*/AImage** image, /*out*/int* acquireFenceFd) __INTRODUCED_IN(26); /** * Signature of the callback which is called when {@link AImageReader} is about to remove a buffer. * @@ -459,9 +453,7 @@ typedef struct AImageReader_BufferRemovedListener { * @see AImage_getHardwareBuffer */ media_status_t AImageReader_setBufferRemovedListener( - AImageReader* reader, AImageReader_BufferRemovedListener* listener); - -#endif /* __ANDROID_API__ >= 26 */ + AImageReader* reader, AImageReader_BufferRemovedListener* listener) __INTRODUCED_IN(26); __END_DECLS diff --git a/media/ndk/include/media/NdkMediaCodec.h b/media/ndk/include/media/NdkMediaCodec.h index c49582dfc1..b329b39d75 100644 --- a/media/ndk/include/media/NdkMediaCodec.h +++ b/media/ndk/include/media/NdkMediaCodec.h @@ -121,30 +121,28 @@ struct AMediaCodecOnAsyncNotifyCallback { AMediaCodecOnAsyncError onAsyncError; }; -#if __ANDROID_API__ >= 21 - /** * Create codec by name. Use this if you know the exact codec you want to use. * When configuring, you will need to specify whether to use the codec as an * encoder or decoder. */ -AMediaCodec* AMediaCodec_createCodecByName(const char *name); +AMediaCodec* AMediaCodec_createCodecByName(const char *name) __INTRODUCED_IN(21); /** * Create codec by mime type. Most applications will use this, specifying a * mime type obtained from media extractor. */ -AMediaCodec* AMediaCodec_createDecoderByType(const char *mime_type); +AMediaCodec* AMediaCodec_createDecoderByType(const char *mime_type) __INTRODUCED_IN(21); /** * Create encoder by name. */ -AMediaCodec* AMediaCodec_createEncoderByType(const char *mime_type); +AMediaCodec* AMediaCodec_createEncoderByType(const char *mime_type) __INTRODUCED_IN(21); /** * delete the codec and free its resources */ -media_status_t AMediaCodec_delete(AMediaCodec*); +media_status_t AMediaCodec_delete(AMediaCodec*) __INTRODUCED_IN(21); /** * Configure the codec. For decoding you would typically get the format from an extractor. @@ -154,43 +152,43 @@ media_status_t AMediaCodec_configure( const AMediaFormat* format, ANativeWindow* surface, AMediaCrypto *crypto, - uint32_t flags); + uint32_t flags) __INTRODUCED_IN(21); /** * Start the codec. A codec must be configured before it can be started, and must be started * before buffers can be sent to it. */ -media_status_t AMediaCodec_start(AMediaCodec*); +media_status_t AMediaCodec_start(AMediaCodec*) __INTRODUCED_IN(21); /** * Stop the codec. */ -media_status_t AMediaCodec_stop(AMediaCodec*); +media_status_t AMediaCodec_stop(AMediaCodec*) __INTRODUCED_IN(21); /* * Flush the codec's input and output. All indices previously returned from calls to * AMediaCodec_dequeueInputBuffer and AMediaCodec_dequeueOutputBuffer become invalid. */ -media_status_t AMediaCodec_flush(AMediaCodec*); +media_status_t AMediaCodec_flush(AMediaCodec*) __INTRODUCED_IN(21); /** * Get an input buffer. The specified buffer index must have been previously obtained from * dequeueInputBuffer, and not yet queued. */ -uint8_t* AMediaCodec_getInputBuffer(AMediaCodec*, size_t idx, size_t *out_size); +uint8_t* AMediaCodec_getInputBuffer(AMediaCodec*, size_t idx, size_t *out_size) __INTRODUCED_IN(21); /** * Get an output buffer. The specified buffer index must have been previously obtained from * dequeueOutputBuffer, and not yet queued. */ -uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec*, size_t idx, size_t *out_size); +uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec*, size_t idx, size_t *out_size) __INTRODUCED_IN(21); /** * Get the index of the next available input buffer. An app will typically use this with * getInputBuffer() to get a pointer to the buffer, then copy the data to be encoded or decoded * into the buffer before passing it to the codec. */ -ssize_t AMediaCodec_dequeueInputBuffer(AMediaCodec*, int64_t timeoutUs); +ssize_t AMediaCodec_dequeueInputBuffer(AMediaCodec*, int64_t timeoutUs) __INTRODUCED_IN(21); /* * __USE_FILE_OFFSET64 changes the type of off_t in LP32, which changes the ABI @@ -221,7 +219,7 @@ static_assert(sizeof(_off_t_compat) == sizeof(long), */ media_status_t AMediaCodec_queueInputBuffer(AMediaCodec*, size_t idx, _off_t_compat offset, size_t size, - uint64_t time, uint32_t flags); + uint64_t time, uint32_t flags) __INTRODUCED_IN(21); /** * Send the specified buffer to the codec for processing. @@ -229,7 +227,7 @@ media_status_t AMediaCodec_queueInputBuffer(AMediaCodec*, size_t idx, media_status_t AMediaCodec_queueSecureInputBuffer(AMediaCodec*, size_t idx, _off_t_compat offset, AMediaCodecCryptoInfo*, - uint64_t time, uint32_t flags); + uint64_t time, uint32_t flags) __INTRODUCED_IN(21); #undef _off_t_compat @@ -237,21 +235,21 @@ media_status_t AMediaCodec_queueSecureInputBuffer(AMediaCodec*, size_t idx, * Get the index of the next available buffer of processed data. */ ssize_t AMediaCodec_dequeueOutputBuffer(AMediaCodec*, AMediaCodecBufferInfo *info, - int64_t timeoutUs); -AMediaFormat* AMediaCodec_getOutputFormat(AMediaCodec*); + int64_t timeoutUs) __INTRODUCED_IN(21); +AMediaFormat* AMediaCodec_getOutputFormat(AMediaCodec*) __INTRODUCED_IN(21); /** * Get format of the buffer. The specified buffer index must have been previously obtained from * dequeueOutputBuffer. */ -AMediaFormat* AMediaCodec_getBufferFormat(AMediaCodec*, size_t index); +AMediaFormat* AMediaCodec_getBufferFormat(AMediaCodec*, size_t index) __INTRODUCED_IN(21); /** * If you are done with a buffer, use this call to return the buffer to * the codec. If you previously specified a surface when configuring this * video decoder you can optionally render the buffer. */ -media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool render); +media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool render) __INTRODUCED_IN(21); /** * Dynamically sets the output surface of a codec. @@ -263,7 +261,7 @@ media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool re * * For more details, see the Java documentation for MediaCodec.setOutputSurface. */ -media_status_t AMediaCodec_setOutputSurface(AMediaCodec*, ANativeWindow* surface); +media_status_t AMediaCodec_setOutputSurface(AMediaCodec*, ANativeWindow* surface) __INTRODUCED_IN(21); /** * If you are done with a buffer, use this call to update its surface timestamp @@ -274,9 +272,7 @@ media_status_t AMediaCodec_setOutputSurface(AMediaCodec*, ANativeWindow* surface * For more details, see the Java documentation for MediaCodec.releaseOutputBuffer. */ media_status_t AMediaCodec_releaseOutputBufferAtTime( - AMediaCodec *mData, size_t idx, int64_t timestampNs); - -#if __ANDROID_API__ >= 26 + AMediaCodec *mData, size_t idx, int64_t timestampNs) __INTRODUCED_IN(21); /** * Creates a Surface that can be used as the input to encoder, in place of input buffers @@ -290,7 +286,7 @@ media_status_t AMediaCodec_releaseOutputBufferAtTime( * For more details, see the Java documentation for MediaCodec.createInputSurface. */ media_status_t AMediaCodec_createInputSurface( - AMediaCodec *mData, ANativeWindow **surface); + AMediaCodec *mData, ANativeWindow **surface) __INTRODUCED_IN(26); /** * Creates a persistent Surface that can be used as the input to encoder @@ -306,7 +302,7 @@ media_status_t AMediaCodec_createInputSurface( * For more details, see the Java documentation for MediaCodec.createPersistentInputSurface. */ media_status_t AMediaCodec_createPersistentInputSurface( - ANativeWindow **surface); + ANativeWindow **surface) __INTRODUCED_IN(26); /** * Set a persistent-surface that can be used as the input to encoder, in place of input buffers @@ -319,7 +315,7 @@ media_status_t AMediaCodec_createPersistentInputSurface( * For more details, see the Java documentation for MediaCodec.setInputSurface. */ media_status_t AMediaCodec_setInputSurface( - AMediaCodec *mData, ANativeWindow *surface); + AMediaCodec *mData, ANativeWindow *surface) __INTRODUCED_IN(26); /** * Signal additional parameters to the codec instance. @@ -330,7 +326,7 @@ media_status_t AMediaCodec_setInputSurface( * NOTE: Some of these parameter changes may silently fail to apply. */ media_status_t AMediaCodec_setParameters( - AMediaCodec *mData, const AMediaFormat* params); + AMediaCodec *mData, const AMediaFormat* params) __INTRODUCED_IN(26); /** * Signals end-of-stream on input. Equivalent to submitting an empty buffer with @@ -346,23 +342,19 @@ media_status_t AMediaCodec_setParameters( * * For more details, see the Java documentation for MediaCodec.signalEndOfInputStream. */ -media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData); - -#endif /* __ANDROID_API__ >= 26 */ - -#if __ANDROID_API__ >= 28 +media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData) __INTRODUCED_IN(26); /** * Get the component name. If the codec was created by createDecoderByType * or createEncoderByType, what component is chosen is not known beforehand. * Caller shall call AMediaCodec_releaseName to free the returned pointer. */ -media_status_t AMediaCodec_getName(AMediaCodec*, char** out_name); +media_status_t AMediaCodec_getName(AMediaCodec*, char** out_name) __INTRODUCED_IN(28); /** * Free the memory pointed by name which is returned by AMediaCodec_getName. */ -void AMediaCodec_releaseName(AMediaCodec*, char* name); +void AMediaCodec_releaseName(AMediaCodec*, char* name) __INTRODUCED_IN(28); /** * Set an asynchronous callback for actionable AMediaCodec events. @@ -386,34 +378,32 @@ void AMediaCodec_releaseName(AMediaCodec*, char* name); media_status_t AMediaCodec_setAsyncNotifyCallback( AMediaCodec*, AMediaCodecOnAsyncNotifyCallback callback, - void *userdata); + void *userdata) __INTRODUCED_IN(28); /** * Release the crypto if applicable. */ -media_status_t AMediaCodec_releaseCrypto(AMediaCodec*); +media_status_t AMediaCodec_releaseCrypto(AMediaCodec*) __INTRODUCED_IN(28); /** * Call this after AMediaCodec_configure() returns successfully to get the input * format accepted by the codec. Do this to determine what optional configuration * parameters were supported by the codec. */ -AMediaFormat* AMediaCodec_getInputFormat(AMediaCodec*); +AMediaFormat* AMediaCodec_getInputFormat(AMediaCodec*) __INTRODUCED_IN(28); /** * Returns true if the codec cannot proceed further, but can be recovered by stopping, * configuring, and starting again. */ -bool AMediaCodecActionCode_isRecoverable(int32_t actionCode); +bool AMediaCodecActionCode_isRecoverable(int32_t actionCode) __INTRODUCED_IN(28); /** * Returns true if the codec error is a transient issue, perhaps due to * resource constraints, and that the method (or encoding/decoding) may be * retried at a later time. */ -bool AMediaCodecActionCode_isTransient(int32_t actionCode); - -#endif /* __ANDROID_API__ >= 28 */ +bool AMediaCodecActionCode_isTransient(int32_t actionCode) __INTRODUCED_IN(28); typedef enum { AMEDIACODECRYPTOINFO_MODE_CLEAR = 0, @@ -447,53 +437,51 @@ AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new( uint8_t iv[16], cryptoinfo_mode_t mode, size_t *clearbytes, - size_t *encryptedbytes); + size_t *encryptedbytes) __INTRODUCED_IN(21); /** * delete an AMediaCodecCryptoInfo created previously with AMediaCodecCryptoInfo_new, or * obtained from AMediaExtractor */ -media_status_t AMediaCodecCryptoInfo_delete(AMediaCodecCryptoInfo*); +media_status_t AMediaCodecCryptoInfo_delete(AMediaCodecCryptoInfo*) __INTRODUCED_IN(21); /** * Set the crypto pattern on an AMediaCryptoInfo object */ void AMediaCodecCryptoInfo_setPattern( AMediaCodecCryptoInfo *info, - cryptoinfo_pattern_t *pattern); + cryptoinfo_pattern_t *pattern) __INTRODUCED_IN(21); /** * The number of subsamples that make up the buffer's contents. */ -size_t AMediaCodecCryptoInfo_getNumSubSamples(AMediaCodecCryptoInfo*); +size_t AMediaCodecCryptoInfo_getNumSubSamples(AMediaCodecCryptoInfo*) __INTRODUCED_IN(21); /** * A 16-byte opaque key */ -media_status_t AMediaCodecCryptoInfo_getKey(AMediaCodecCryptoInfo*, uint8_t *dst); +media_status_t AMediaCodecCryptoInfo_getKey(AMediaCodecCryptoInfo*, uint8_t *dst) __INTRODUCED_IN(21); /** * A 16-byte initialization vector */ -media_status_t AMediaCodecCryptoInfo_getIV(AMediaCodecCryptoInfo*, uint8_t *dst); +media_status_t AMediaCodecCryptoInfo_getIV(AMediaCodecCryptoInfo*, uint8_t *dst) __INTRODUCED_IN(21); /** * The type of encryption that has been applied, * one of AMEDIACODECRYPTOINFO_MODE_CLEAR or AMEDIACODECRYPTOINFO_MODE_AES_CTR. */ -cryptoinfo_mode_t AMediaCodecCryptoInfo_getMode(AMediaCodecCryptoInfo*); +cryptoinfo_mode_t AMediaCodecCryptoInfo_getMode(AMediaCodecCryptoInfo*) __INTRODUCED_IN(21); /** * The number of leading unencrypted bytes in each subsample. */ -media_status_t AMediaCodecCryptoInfo_getClearBytes(AMediaCodecCryptoInfo*, size_t *dst); +media_status_t AMediaCodecCryptoInfo_getClearBytes(AMediaCodecCryptoInfo*, size_t *dst) __INTRODUCED_IN(21); /** * The number of trailing encrypted bytes in each subsample. */ -media_status_t AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, size_t *dst); - -#endif /* __ANDROID_API__ >= 21 */ +media_status_t AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, size_t *dst) __INTRODUCED_IN(21); __END_DECLS diff --git a/media/ndk/include/media/NdkMediaCrypto.h b/media/ndk/include/media/NdkMediaCrypto.h index 6f2926eb36..b673adc6a4 100644 --- a/media/ndk/include/media/NdkMediaCrypto.h +++ b/media/ndk/include/media/NdkMediaCrypto.h @@ -47,17 +47,13 @@ typedef struct AMediaCrypto AMediaCrypto; typedef uint8_t AMediaUUID[16]; -#if __ANDROID_API__ >= 21 +bool AMediaCrypto_isCryptoSchemeSupported(const AMediaUUID uuid) __INTRODUCED_IN(21); -bool AMediaCrypto_isCryptoSchemeSupported(const AMediaUUID uuid); +bool AMediaCrypto_requiresSecureDecoderComponent(const char *mime) __INTRODUCED_IN(21); -bool AMediaCrypto_requiresSecureDecoderComponent(const char *mime); +AMediaCrypto* AMediaCrypto_new(const AMediaUUID uuid, const void *initData, size_t initDataSize) __INTRODUCED_IN(21); -AMediaCrypto* AMediaCrypto_new(const AMediaUUID uuid, const void *initData, size_t initDataSize); - -void AMediaCrypto_delete(AMediaCrypto* crypto); - -#endif /* __ANDROID_API__ >= 21 */ +void AMediaCrypto_delete(AMediaCrypto* crypto) __INTRODUCED_IN(21); __END_DECLS diff --git a/media/ndk/include/media/NdkMediaDataSource.h b/media/ndk/include/media/NdkMediaDataSource.h index 9e2e351aec..3a4373c8a1 100644 --- a/media/ndk/include/media/NdkMediaDataSource.h +++ b/media/ndk/include/media/NdkMediaDataSource.h @@ -38,8 +38,6 @@ __BEGIN_DECLS struct AMediaDataSource; typedef struct AMediaDataSource AMediaDataSource; -#if __ANDROID_API__ >= 28 - /* * AMediaDataSource's callbacks will be invoked on an implementation-defined thread * or thread pool. No guarantees are provided about which thread(s) will be used for @@ -84,19 +82,19 @@ typedef void (*AMediaDataSourceClose)(void *userdata); * Create new media data source. Returns NULL if memory allocation * for the new data source object fails. */ -AMediaDataSource* AMediaDataSource_new(); +AMediaDataSource* AMediaDataSource_new() __INTRODUCED_IN(28); /** * Delete a previously created media data source. */ -void AMediaDataSource_delete(AMediaDataSource*); +void AMediaDataSource_delete(AMediaDataSource*) __INTRODUCED_IN(28); /** * Set an user provided opaque handle. This opaque handle is passed as * the first argument to the data source callbacks. */ void AMediaDataSource_setUserdata( - AMediaDataSource*, void *userdata); + AMediaDataSource*, void *userdata) __INTRODUCED_IN(28); /** * Set a custom callback for supplying random access media data to the @@ -111,7 +109,7 @@ void AMediaDataSource_setUserdata( */ void AMediaDataSource_setReadAt( AMediaDataSource*, - AMediaDataSourceReadAt); + AMediaDataSourceReadAt) __INTRODUCED_IN(28); /** * Set a custom callback for supplying the size of the data source to the @@ -122,7 +120,7 @@ void AMediaDataSource_setReadAt( */ void AMediaDataSource_setGetSize( AMediaDataSource*, - AMediaDataSourceGetSize); + AMediaDataSourceGetSize) __INTRODUCED_IN(28); /** * Set a custom callback to receive signal from the NDK media framework @@ -133,9 +131,7 @@ void AMediaDataSource_setGetSize( */ void AMediaDataSource_setClose( AMediaDataSource*, - AMediaDataSourceClose); - -#endif /*__ANDROID_API__ >= 28 */ + AMediaDataSourceClose) __INTRODUCED_IN(28); __END_DECLS diff --git a/media/ndk/include/media/NdkMediaDrm.h b/media/ndk/include/media/NdkMediaDrm.h index d45dc209fc..24c0d6d86f 100644 --- a/media/ndk/include/media/NdkMediaDrm.h +++ b/media/ndk/include/media/NdkMediaDrm.h @@ -87,8 +87,6 @@ typedef enum AMediaDrmEventType { typedef void (*AMediaDrmEventListener)(AMediaDrm *, const AMediaDrmSessionId *sessionId, AMediaDrmEventType eventType, int extra, const uint8_t *data, size_t dataSize); -#if __ANDROID_API__ >= 21 - /** * Query if the given scheme identified by its UUID is supported on this device, and * whether the drm plugin is able to handle the media container format specified by mimeType. @@ -97,25 +95,27 @@ typedef void (*AMediaDrmEventListener)(AMediaDrm *, const AMediaDrmSessionId *se * mimeType is the MIME type of the media container, e.g. "video/mp4". If mimeType * is not known or required, it can be provided as NULL. */ -bool AMediaDrm_isCryptoSchemeSupported(const uint8_t *uuid, const char *mimeType); +bool AMediaDrm_isCryptoSchemeSupported(const uint8_t *uuid, + const char *mimeType) __INTRODUCED_IN(21); /** * Create a MediaDrm instance from a UUID * uuid identifies the universal unique ID of the crypto scheme. uuid must be 16 bytes. */ -AMediaDrm* AMediaDrm_createByUUID(const uint8_t *uuid); +AMediaDrm* AMediaDrm_createByUUID(const uint8_t *uuid) __INTRODUCED_IN(21); /** * Release a MediaDrm object */ -void AMediaDrm_release(AMediaDrm *); +void AMediaDrm_release(AMediaDrm *) __INTRODUCED_IN(21); /** * Register a callback to be invoked when an event occurs * * listener is the callback that will be invoked on event */ -media_status_t AMediaDrm_setOnEventListener(AMediaDrm *, AMediaDrmEventListener listener); +media_status_t AMediaDrm_setOnEventListener(AMediaDrm *, + AMediaDrmEventListener listener) __INTRODUCED_IN(21); /** * Open a new session with the MediaDrm object. A session ID is returned. @@ -123,13 +123,15 @@ media_status_t AMediaDrm_setOnEventListener(AMediaDrm *, AMediaDrmEventListener * returns MEDIADRM_NOT_PROVISIONED_ERROR if provisioning is needed * returns MEDIADRM_RESOURCE_BUSY_ERROR if required resources are in use */ -media_status_t AMediaDrm_openSession(AMediaDrm *, AMediaDrmSessionId *sessionId); +media_status_t AMediaDrm_openSession(AMediaDrm *, + AMediaDrmSessionId *sessionId) __INTRODUCED_IN(21); /** * Close a session on the MediaDrm object that was previously opened * with AMediaDrm_openSession. */ -media_status_t AMediaDrm_closeSession(AMediaDrm *, const AMediaDrmSessionId *sessionId); +media_status_t AMediaDrm_closeSession(AMediaDrm *, + const AMediaDrmSessionId *sessionId) __INTRODUCED_IN(21); typedef enum AMediaDrmKeyType { /** @@ -208,7 +210,7 @@ typedef struct AMediaDrmKeyValuePair { media_status_t AMediaDrm_getKeyRequest(AMediaDrm *, const AMediaDrmScope *scope, const uint8_t *init, size_t initSize, const char *mimeType, AMediaDrmKeyType keyType, const AMediaDrmKeyValue *optionalParameters, size_t numOptionalParameters, - const uint8_t **keyRequest, size_t *keyRequestSize); + const uint8_t **keyRequest, size_t *keyRequestSize) __INTRODUCED_IN(21); /** * A key response is received from the license server by the app, then it is @@ -228,7 +230,8 @@ media_status_t AMediaDrm_getKeyRequest(AMediaDrm *, const AMediaDrmScope *scope, */ media_status_t AMediaDrm_provideKeyResponse(AMediaDrm *, const AMediaDrmScope *scope, - const uint8_t *response, size_t responseSize, AMediaDrmKeySetId *keySetId); + const uint8_t *response, size_t responseSize, + AMediaDrmKeySetId *keySetId) __INTRODUCED_IN(21); /** * Restore persisted offline keys into a new session. keySetId identifies the @@ -238,14 +241,15 @@ media_status_t AMediaDrm_provideKeyResponse(AMediaDrm *, const AMediaDrmScope *s * keySetId identifies the saved key set to restore */ media_status_t AMediaDrm_restoreKeys(AMediaDrm *, const AMediaDrmSessionId *sessionId, - const AMediaDrmKeySetId *keySetId); + const AMediaDrmKeySetId *keySetId) __INTRODUCED_IN(21); /** * Remove the current keys from a session. * * keySetId identifies keys to remove */ -media_status_t AMediaDrm_removeKeys(AMediaDrm *, const AMediaDrmSessionId *keySetId); +media_status_t AMediaDrm_removeKeys(AMediaDrm *, + const AMediaDrmSessionId *keySetId) __INTRODUCED_IN(21); /** * Request an informative description of the key status for the session. The status is @@ -261,7 +265,7 @@ media_status_t AMediaDrm_removeKeys(AMediaDrm *, const AMediaDrmSessionId *keySe * and numPairs will be set to the number of pairs available. */ media_status_t AMediaDrm_queryKeyStatus(AMediaDrm *, const AMediaDrmSessionId *sessionId, - AMediaDrmKeyValue *keyValuePairs, size_t *numPairs); + AMediaDrmKeyValue *keyValuePairs, size_t *numPairs) __INTRODUCED_IN(21); /** @@ -280,7 +284,7 @@ media_status_t AMediaDrm_queryKeyStatus(AMediaDrm *, const AMediaDrmSessionId *s * the next call to getProvisionRequest. */ media_status_t AMediaDrm_getProvisionRequest(AMediaDrm *, const uint8_t **provisionRequest, - size_t *provisionRequestSize, const char **serverUrl); + size_t *provisionRequestSize, const char **serverUrl) __INTRODUCED_IN(21); /** @@ -295,7 +299,7 @@ media_status_t AMediaDrm_getProvisionRequest(AMediaDrm *, const uint8_t **provis * server rejected the request */ media_status_t AMediaDrm_provideProvisionResponse(AMediaDrm *, - const uint8_t *response, size_t responseSize); + const uint8_t *response, size_t responseSize) __INTRODUCED_IN(21); /** @@ -320,7 +324,7 @@ media_status_t AMediaDrm_provideProvisionResponse(AMediaDrm *, * number required. */ media_status_t AMediaDrm_getSecureStops(AMediaDrm *, - AMediaDrmSecureStop *secureStops, size_t *numSecureStops); + AMediaDrmSecureStop *secureStops, size_t *numSecureStops) __INTRODUCED_IN(21); /** * Process the SecureStop server response message ssRelease. After authenticating @@ -329,7 +333,7 @@ media_status_t AMediaDrm_getSecureStops(AMediaDrm *, * ssRelease is the server response indicating which secure stops to release */ media_status_t AMediaDrm_releaseSecureStops(AMediaDrm *, - const AMediaDrmSecureStop *ssRelease); + const AMediaDrmSecureStop *ssRelease) __INTRODUCED_IN(21); /** * String property name: identifies the maker of the DRM engine plugin @@ -362,7 +366,7 @@ media_status_t AMediaDrm_releaseSecureStops(AMediaDrm *, * will remain valid until the next call to AMediaDrm_getPropertyString. */ media_status_t AMediaDrm_getPropertyString(AMediaDrm *, const char *propertyName, - const char **propertyValue); + const char **propertyValue) __INTRODUCED_IN(21); /** * Byte array property name: the device unique identifier is established during @@ -377,19 +381,19 @@ media_status_t AMediaDrm_getPropertyString(AMediaDrm *, const char *propertyName * will remain valid until the next call to AMediaDrm_getPropertyByteArray. */ media_status_t AMediaDrm_getPropertyByteArray(AMediaDrm *, const char *propertyName, - AMediaDrmByteArray *propertyValue); + AMediaDrmByteArray *propertyValue) __INTRODUCED_IN(21); /** * Set a DRM engine plugin String property value. */ media_status_t AMediaDrm_setPropertyString(AMediaDrm *, const char *propertyName, - const char *value); + const char *value) __INTRODUCED_IN(21); /** * Set a DRM engine plugin byte array property value. */ media_status_t AMediaDrm_setPropertyByteArray(AMediaDrm *, const char *propertyName, - const uint8_t *value, size_t valueSize); + const uint8_t *value, size_t valueSize) __INTRODUCED_IN(21); /** * In addition to supporting decryption of DASH Common Encrypted Media, the @@ -418,7 +422,7 @@ media_status_t AMediaDrm_setPropertyByteArray(AMediaDrm *, const char *propertyN */ media_status_t AMediaDrm_encrypt(AMediaDrm *, const AMediaDrmSessionId *sessionId, const char *cipherAlgorithm, uint8_t *keyId, uint8_t *iv, - const uint8_t *input, uint8_t *output, size_t dataSize); + const uint8_t *input, uint8_t *output, size_t dataSize) __INTRODUCED_IN(21); /* * Decrypt the data referenced by input of length dataSize using algorithm specified @@ -429,7 +433,7 @@ media_status_t AMediaDrm_encrypt(AMediaDrm *, const AMediaDrmSessionId *sessionI */ media_status_t AMediaDrm_decrypt(AMediaDrm *, const AMediaDrmSessionId *sessionId, const char *cipherAlgorithm, uint8_t *keyId, uint8_t *iv, - const uint8_t *input, uint8_t *output, size_t dataSize); + const uint8_t *input, uint8_t *output, size_t dataSize) __INTRODUCED_IN(21); /* * Generate a signature using the specified macAlgorithm over the message data @@ -442,7 +446,7 @@ media_status_t AMediaDrm_decrypt(AMediaDrm *, const AMediaDrmSessionId *sessionI */ media_status_t AMediaDrm_sign(AMediaDrm *, const AMediaDrmSessionId *sessionId, const char *macAlgorithm, uint8_t *keyId, uint8_t *message, size_t messageSize, - uint8_t *signature, size_t *signatureSize); + uint8_t *signature, size_t *signatureSize) __INTRODUCED_IN(21); /* * Perform a signature verification using the specified macAlgorithm over the message @@ -453,9 +457,7 @@ media_status_t AMediaDrm_sign(AMediaDrm *, const AMediaDrmSessionId *sessionId, */ media_status_t AMediaDrm_verify(AMediaDrm *, const AMediaDrmSessionId *sessionId, const char *macAlgorithm, uint8_t *keyId, const uint8_t *message, size_t messageSize, - const uint8_t *signature, size_t signatureSize); - -#endif /* __ANDROID_API__ >= 21 */ + const uint8_t *signature, size_t signatureSize) __INTRODUCED_IN(21); __END_DECLS diff --git a/media/ndk/include/media/NdkMediaExtractor.h b/media/ndk/include/media/NdkMediaExtractor.h index 3452cc9dd9..9f6089182c 100644 --- a/media/ndk/include/media/NdkMediaExtractor.h +++ b/media/ndk/include/media/NdkMediaExtractor.h @@ -49,48 +49,44 @@ __BEGIN_DECLS struct AMediaExtractor; typedef struct AMediaExtractor AMediaExtractor; -#if __ANDROID_API__ >= 21 - /** * Create new media extractor */ -AMediaExtractor* AMediaExtractor_new(); +AMediaExtractor* AMediaExtractor_new() __INTRODUCED_IN(21); /** * Delete a previously created media extractor */ -media_status_t AMediaExtractor_delete(AMediaExtractor*); +media_status_t AMediaExtractor_delete(AMediaExtractor*) __INTRODUCED_IN(21); /** * Set the file descriptor from which the extractor will read. */ media_status_t AMediaExtractor_setDataSourceFd(AMediaExtractor*, int fd, off64_t offset, - off64_t length); + off64_t length) __INTRODUCED_IN(21); /** * Set the URI from which the extractor will read. */ -media_status_t AMediaExtractor_setDataSource(AMediaExtractor*, const char *location); +media_status_t AMediaExtractor_setDataSource(AMediaExtractor*, + const char *location) __INTRODUCED_IN(21); // TODO support headers -#if __ANDROID_API__ >= 28 - /** * Set the custom data source implementation from which the extractor will read. */ -media_status_t AMediaExtractor_setDataSourceCustom(AMediaExtractor*, AMediaDataSource *src); - -#endif /* __ANDROID_API__ >= 28 */ +media_status_t AMediaExtractor_setDataSourceCustom(AMediaExtractor*, + AMediaDataSource *src) __INTRODUCED_IN(28); /** * Return the number of tracks in the previously specified media file */ -size_t AMediaExtractor_getTrackCount(AMediaExtractor*); +size_t AMediaExtractor_getTrackCount(AMediaExtractor*) __INTRODUCED_IN(21); /** * Return the format of the specified track. The caller must free the returned format */ -AMediaFormat* AMediaExtractor_getTrackFormat(AMediaExtractor*, size_t idx); +AMediaFormat* AMediaExtractor_getTrackFormat(AMediaExtractor*, size_t idx) __INTRODUCED_IN(21); /** * Select the specified track. Subsequent calls to readSampleData, getSampleTrackIndex and @@ -98,41 +94,42 @@ AMediaFormat* AMediaExtractor_getTrackFormat(AMediaExtractor*, size_t idx); * Selecting the same track multiple times has no effect, the track is * only selected once. */ -media_status_t AMediaExtractor_selectTrack(AMediaExtractor*, size_t idx); +media_status_t AMediaExtractor_selectTrack(AMediaExtractor*, size_t idx) __INTRODUCED_IN(21); /** * Unselect the specified track. Subsequent calls to readSampleData, getSampleTrackIndex and * getSampleTime only retrieve information for the subset of tracks selected.. */ -media_status_t AMediaExtractor_unselectTrack(AMediaExtractor*, size_t idx); +media_status_t AMediaExtractor_unselectTrack(AMediaExtractor*, size_t idx) __INTRODUCED_IN(21); /** * Read the current sample. */ -ssize_t AMediaExtractor_readSampleData(AMediaExtractor*, uint8_t *buffer, size_t capacity); +ssize_t AMediaExtractor_readSampleData(AMediaExtractor*, + uint8_t *buffer, size_t capacity) __INTRODUCED_IN(21); /** * Read the current sample's flags. */ -uint32_t AMediaExtractor_getSampleFlags(AMediaExtractor*); // see definitions below +uint32_t AMediaExtractor_getSampleFlags(AMediaExtractor*) __INTRODUCED_IN(21); /** * Returns the track index the current sample originates from (or -1 * if no more samples are available) */ -int AMediaExtractor_getSampleTrackIndex(AMediaExtractor*); +int AMediaExtractor_getSampleTrackIndex(AMediaExtractor*) __INTRODUCED_IN(21); /** * Returns the current sample's presentation time in microseconds. * or -1 if no more samples are available. */ -int64_t AMediaExtractor_getSampleTime(AMediaExtractor*); +int64_t AMediaExtractor_getSampleTime(AMediaExtractor*) __INTRODUCED_IN(21); /** * Advance to the next sample. Returns false if no more sample data * is available (end of stream). */ -bool AMediaExtractor_advance(AMediaExtractor*); +bool AMediaExtractor_advance(AMediaExtractor*) __INTRODUCED_IN(21); typedef enum { AMEDIAEXTRACTOR_SEEK_PREVIOUS_SYNC, @@ -143,7 +140,8 @@ typedef enum { /** * */ -media_status_t AMediaExtractor_seekTo(AMediaExtractor*, int64_t seekPosUs, SeekMode mode); +media_status_t AMediaExtractor_seekTo(AMediaExtractor*, + int64_t seekPosUs, SeekMode mode) __INTRODUCED_IN(21); /** * mapping of crypto scheme uuid to the scheme specific data for that scheme @@ -165,18 +163,16 @@ typedef struct PsshInfo { /** * Get the PSSH info if present. */ -PsshInfo* AMediaExtractor_getPsshInfo(AMediaExtractor*); +PsshInfo* AMediaExtractor_getPsshInfo(AMediaExtractor*) __INTRODUCED_IN(21); -AMediaCodecCryptoInfo *AMediaExtractor_getSampleCryptoInfo(AMediaExtractor *); +AMediaCodecCryptoInfo *AMediaExtractor_getSampleCryptoInfo(AMediaExtractor *) __INTRODUCED_IN(21); enum { AMEDIAEXTRACTOR_SAMPLE_FLAG_SYNC = 1, AMEDIAEXTRACTOR_SAMPLE_FLAG_ENCRYPTED = 2, }; -#if __ANDROID_API__ >= 28 - /** * Returns the format of the extractor. The caller must free the returned format * using AMediaFormat_delete(format). @@ -184,7 +180,7 @@ enum { * This function will always return a format; however, the format could be empty * (no key-value pairs) if the media container does not provide format information. */ -AMediaFormat* AMediaExtractor_getFileFormat(AMediaExtractor*); +AMediaFormat* AMediaExtractor_getFileFormat(AMediaExtractor*) __INTRODUCED_IN(28); /** * Returns the size of the current sample in bytes, or -1 when no samples are @@ -196,7 +192,7 @@ AMediaFormat* AMediaExtractor_getFileFormat(AMediaExtractor*); * AMediaExtractor_readSampleData(ex, buf, sampleSize); * */ -ssize_t AMediaExtractor_getSampleSize(AMediaExtractor*); +ssize_t AMediaExtractor_getSampleSize(AMediaExtractor*) __INTRODUCED_IN(28); /** * Returns the duration of cached media samples downloaded from a network data source @@ -209,7 +205,7 @@ ssize_t AMediaExtractor_getSampleSize(AMediaExtractor*); * cached duration cannot be calculated (bitrate, duration, and file size information * not available). */ -int64_t AMediaExtractor_getCachedDuration(AMediaExtractor *); +int64_t AMediaExtractor_getCachedDuration(AMediaExtractor *) __INTRODUCED_IN(28); /** * Read the current sample's metadata format into |fmt|. Examples of sample metadata are @@ -220,11 +216,8 @@ int64_t AMediaExtractor_getCachedDuration(AMediaExtractor *); * Existing key-value pairs in |fmt| would be removed if this API returns AMEDIA_OK. * The contents of |fmt| is undefined if this API returns AMEDIA_ERROR_*. */ -media_status_t AMediaExtractor_getSampleFormat(AMediaExtractor *ex, AMediaFormat *fmt); - -#endif /* __ANDROID_API__ >= 28 */ - -#endif /* __ANDROID_API__ >= 21 */ +media_status_t AMediaExtractor_getSampleFormat(AMediaExtractor *ex, + AMediaFormat *fmt) __INTRODUCED_IN(28); __END_DECLS diff --git a/media/ndk/include/media/NdkMediaFormat.h b/media/ndk/include/media/NdkMediaFormat.h index f510dff082..dd39acff0d 100644 --- a/media/ndk/include/media/NdkMediaFormat.h +++ b/media/ndk/include/media/NdkMediaFormat.h @@ -46,44 +46,42 @@ __BEGIN_DECLS struct AMediaFormat; typedef struct AMediaFormat AMediaFormat; -#if __ANDROID_API__ >= 21 - -AMediaFormat *AMediaFormat_new(); -media_status_t AMediaFormat_delete(AMediaFormat*); +AMediaFormat *AMediaFormat_new() __INTRODUCED_IN(21); +media_status_t AMediaFormat_delete(AMediaFormat*) __INTRODUCED_IN(21); /** * Human readable representation of the format. The returned string is owned by the format, * and remains valid until the next call to toString, or until the format is deleted. */ -const char* AMediaFormat_toString(AMediaFormat*); +const char* AMediaFormat_toString(AMediaFormat*) __INTRODUCED_IN(21); -bool AMediaFormat_getInt32(AMediaFormat*, const char *name, int32_t *out); -bool AMediaFormat_getInt64(AMediaFormat*, const char *name, int64_t *out); -bool AMediaFormat_getFloat(AMediaFormat*, const char *name, float *out); -bool AMediaFormat_getSize(AMediaFormat*, const char *name, size_t *out); +bool AMediaFormat_getInt32(AMediaFormat*, const char *name, int32_t *out) __INTRODUCED_IN(21); +bool AMediaFormat_getInt64(AMediaFormat*, const char *name, int64_t *out) __INTRODUCED_IN(21); +bool AMediaFormat_getFloat(AMediaFormat*, const char *name, float *out) __INTRODUCED_IN(21); +bool AMediaFormat_getSize(AMediaFormat*, const char *name, size_t *out) __INTRODUCED_IN(21); /** * The returned data is owned by the format and remains valid as long as the named entry * is part of the format. */ -bool AMediaFormat_getBuffer(AMediaFormat*, const char *name, void** data, size_t *size); +bool AMediaFormat_getBuffer(AMediaFormat*, const char *name, void** data, size_t *size) __INTRODUCED_IN(21); /** * The returned string is owned by the format, and remains valid until the next call to getString, * or until the format is deleted. */ -bool AMediaFormat_getString(AMediaFormat*, const char *name, const char **out); +bool AMediaFormat_getString(AMediaFormat*, const char *name, const char **out) __INTRODUCED_IN(21); -void AMediaFormat_setInt32(AMediaFormat*, const char* name, int32_t value); -void AMediaFormat_setInt64(AMediaFormat*, const char* name, int64_t value); -void AMediaFormat_setFloat(AMediaFormat*, const char* name, float value); +void AMediaFormat_setInt32(AMediaFormat*, const char* name, int32_t value) __INTRODUCED_IN(21); +void AMediaFormat_setInt64(AMediaFormat*, const char* name, int64_t value) __INTRODUCED_IN(21); +void AMediaFormat_setFloat(AMediaFormat*, const char* name, float value) __INTRODUCED_IN(21); /** * The provided string is copied into the format. */ -void AMediaFormat_setString(AMediaFormat*, const char* name, const char* value); +void AMediaFormat_setString(AMediaFormat*, const char* name, const char* value) __INTRODUCED_IN(21); /** * The provided data is copied into the format. */ -void AMediaFormat_setBuffer(AMediaFormat*, const char* name, void* data, size_t size); +void AMediaFormat_setBuffer(AMediaFormat*, const char* name, void* data, size_t size) __INTRODUCED_IN(21); @@ -157,18 +155,14 @@ extern const char* AMEDIAFORMAT_KEY_TRACK_ID; extern const char* AMEDIAFORMAT_KEY_TRACK_INDEX; extern const char* AMEDIAFORMAT_KEY_WIDTH; -#endif /* __ANDROID_API__ >= 21 */ - -#if __ANDROID_API__ >= 28 -bool AMediaFormat_getDouble(AMediaFormat*, const char *name, double *out); +bool AMediaFormat_getDouble(AMediaFormat*, const char *name, double *out) __INTRODUCED_IN(28); bool AMediaFormat_getRect(AMediaFormat*, const char *name, - int32_t *left, int32_t *top, int32_t *right, int32_t *bottom); + int32_t *left, int32_t *top, int32_t *right, int32_t *bottom) __INTRODUCED_IN(28); -void AMediaFormat_setDouble(AMediaFormat*, const char* name, double value); -void AMediaFormat_setSize(AMediaFormat*, const char* name, size_t value); +void AMediaFormat_setDouble(AMediaFormat*, const char* name, double value) __INTRODUCED_IN(28); +void AMediaFormat_setSize(AMediaFormat*, const char* name, size_t value) __INTRODUCED_IN(28); void AMediaFormat_setRect(AMediaFormat*, const char* name, - int32_t left, int32_t top, int32_t right, int32_t bottom); -#endif /* __ANDROID_API__ >= 28 */ + int32_t left, int32_t top, int32_t right, int32_t bottom) __INTRODUCED_IN(28); __END_DECLS diff --git a/media/ndk/include/media/NdkMediaMuxer.h b/media/ndk/include/media/NdkMediaMuxer.h index dc9e0acfd7..75c70edba8 100644 --- a/media/ndk/include/media/NdkMediaMuxer.h +++ b/media/ndk/include/media/NdkMediaMuxer.h @@ -53,17 +53,15 @@ typedef enum { AMEDIAMUXER_OUTPUT_FORMAT_WEBM = 1, } OutputFormat; -#if __ANDROID_API__ >= 21 - /** * Create new media muxer */ -AMediaMuxer* AMediaMuxer_new(int fd, OutputFormat format); +AMediaMuxer* AMediaMuxer_new(int fd, OutputFormat format) __INTRODUCED_IN(21); /** * Delete a previously created media muxer */ -media_status_t AMediaMuxer_delete(AMediaMuxer*); +media_status_t AMediaMuxer_delete(AMediaMuxer*) __INTRODUCED_IN(21); /** * Set and store the geodata (latitude and longitude) in the output file. @@ -76,7 +74,8 @@ media_status_t AMediaMuxer_delete(AMediaMuxer*); * Latitude must be in the range [-90, 90]. * Longitude must be in the range [-180, 180]. */ -media_status_t AMediaMuxer_setLocation(AMediaMuxer*, float latitude, float longitude); +media_status_t AMediaMuxer_setLocation(AMediaMuxer*, + float latitude, float longitude) __INTRODUCED_IN(21); /** * Sets the orientation hint for output video playback. @@ -90,26 +89,26 @@ media_status_t AMediaMuxer_setLocation(AMediaMuxer*, float latitude, float longi * The angle is specified in degrees, clockwise. * The supported angles are 0, 90, 180, and 270 degrees. */ -media_status_t AMediaMuxer_setOrientationHint(AMediaMuxer*, int degrees); +media_status_t AMediaMuxer_setOrientationHint(AMediaMuxer*, int degrees) __INTRODUCED_IN(21); /** * Adds a track with the specified format. * Returns the index of the new track or a negative value in case of failure, * which can be interpreted as a media_status_t. */ -ssize_t AMediaMuxer_addTrack(AMediaMuxer*, const AMediaFormat* format); +ssize_t AMediaMuxer_addTrack(AMediaMuxer*, const AMediaFormat* format) __INTRODUCED_IN(21); /** * Start the muxer. Should be called after AMediaMuxer_addTrack and * before AMediaMuxer_writeSampleData. */ -media_status_t AMediaMuxer_start(AMediaMuxer*); +media_status_t AMediaMuxer_start(AMediaMuxer*) __INTRODUCED_IN(21); /** * Stops the muxer. * Once the muxer stops, it can not be restarted. */ -media_status_t AMediaMuxer_stop(AMediaMuxer*); +media_status_t AMediaMuxer_stop(AMediaMuxer*) __INTRODUCED_IN(21); /** * Writes an encoded sample into the muxer. @@ -119,9 +118,8 @@ media_status_t AMediaMuxer_stop(AMediaMuxer*); * by the encoder.) */ media_status_t AMediaMuxer_writeSampleData(AMediaMuxer *muxer, - size_t trackIdx, const uint8_t *data, const AMediaCodecBufferInfo *info); - -#endif /* __ANDROID_API__ >= 21 */ + size_t trackIdx, const uint8_t *data, + const AMediaCodecBufferInfo *info) __INTRODUCED_IN(21); __END_DECLS