Restore __ANDROID_API__ guards for camera/media headers

Partial revert of "Add __INTRODUCED_IN to audio/camera/media headers.",
commit 85a41536a4.

Restore the API guards where they used to exist. I *could* add
__ANDROID_API__ around only the function declarations, which is what the
versioner would do, but the function declarations are mixed up with the
types and constants, so I'd need to add a bunch of __ANDROID_API__ checks
or reorganize the headers.

NdkMediaFormat.h and AAudio.h still have __INTRODUCED_IN symbols that
aren't guarded by __ANDROID_API__. Maybe those files should be reorganized
so they don't alternate between APIs so much.

Test: builds
Bug: http://b/111668906
Change-Id: I757a6097f7840ea50e2fc92db7defef493097672
Exempt-From-Owner-Approval: cherrypick
(cherry picked from commit 0c9470cec2)
gugelfrei
Ryan Prichard 6 years ago
parent 6f1e11ecba
commit 6ae90b1c6e

@ -45,6 +45,8 @@
__BEGIN_DECLS __BEGIN_DECLS
#if __ANDROID_API__ >= 24
/** /**
* ACameraCaptureSession is an opaque type that manages frame captures of a camera device. * ACameraCaptureSession is an opaque type that manages frame captures of a camera device.
* *
@ -591,6 +593,10 @@ camera_status_t ACameraCaptureSession_stopRepeating(ACameraCaptureSession* sessi
camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* session) camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* session)
__INTRODUCED_IN(24); __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */
#if __ANDROID_API__ >= 28
typedef struct ACaptureSessionOutput ACaptureSessionOutput; typedef struct ACaptureSessionOutput ACaptureSessionOutput;
/** /**
@ -635,6 +641,7 @@ typedef struct ACaptureSessionOutput ACaptureSessionOutput;
*/ */
camera_status_t ACameraCaptureSession_updateSharedOutput(ACameraCaptureSession* session, camera_status_t ACameraCaptureSession_updateSharedOutput(ACameraCaptureSession* session,
ACaptureSessionOutput* output) __INTRODUCED_IN(28); ACaptureSessionOutput* output) __INTRODUCED_IN(28);
#endif /* __ANDROID_API__ >= 28 */
__END_DECLS __END_DECLS

@ -44,6 +44,8 @@
__BEGIN_DECLS __BEGIN_DECLS
#if __ANDROID_API__ >= 24
/** /**
* ACameraDevice is opaque type that provides access to a camera device. * ACameraDevice is opaque type that provides access to a camera device.
* *
@ -666,6 +668,10 @@ camera_status_t ACameraDevice_createCaptureSession(
const ACameraCaptureSession_stateCallbacks* callbacks, const ACameraCaptureSession_stateCallbacks* callbacks,
/*out*/ACameraCaptureSession** session) __INTRODUCED_IN(24); /*out*/ACameraCaptureSession** session) __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */
#if __ANDROID_API__ >= 28
/** /**
* Create a shared ACaptureSessionOutput object. * Create a shared ACaptureSessionOutput object.
* *
@ -757,6 +763,8 @@ camera_status_t ACameraDevice_createCaptureSessionWithSessionParameters(
const ACameraCaptureSession_stateCallbacks* callbacks, const ACameraCaptureSession_stateCallbacks* callbacks,
/*out*/ACameraCaptureSession** session) __INTRODUCED_IN(28); /*out*/ACameraCaptureSession** session) __INTRODUCED_IN(28);
#endif /* __ANDROID_API__ >= 28 */
__END_DECLS __END_DECLS
#endif /* _NDK_CAMERA_DEVICE_H */ #endif /* _NDK_CAMERA_DEVICE_H */

@ -40,6 +40,8 @@
__BEGIN_DECLS __BEGIN_DECLS
#if __ANDROID_API__ >= 24
typedef enum { typedef enum {
ACAMERA_OK = 0, ACAMERA_OK = 0,
@ -130,6 +132,8 @@ typedef enum {
ACAMERA_ERROR_PERMISSION_DENIED = ACAMERA_ERROR_BASE - 13, ACAMERA_ERROR_PERMISSION_DENIED = ACAMERA_ERROR_BASE - 13,
} camera_status_t; } camera_status_t;
#endif /* __ANDROID_API__ >= 24 */
__END_DECLS __END_DECLS
#endif /* _NDK_CAMERA_ERROR_H */ #endif /* _NDK_CAMERA_ERROR_H */

@ -44,6 +44,8 @@
__BEGIN_DECLS __BEGIN_DECLS
#if __ANDROID_API__ >= 24
/** /**
* ACameraManager is opaque type that provides access to camera service. * ACameraManager is opaque type that provides access to camera service.
* *
@ -274,6 +276,8 @@ camera_status_t ACameraManager_openCamera(
ACameraDevice_StateCallbacks* callback, ACameraDevice_StateCallbacks* callback,
/*out*/ACameraDevice** device) __INTRODUCED_IN(24); /*out*/ACameraDevice** device) __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */
__END_DECLS __END_DECLS
#endif /* _NDK_CAMERA_MANAGER_H */ #endif /* _NDK_CAMERA_MANAGER_H */

@ -44,6 +44,8 @@
__BEGIN_DECLS __BEGIN_DECLS
#if __ANDROID_API__ >= 24
/** /**
* ACameraMetadata is opaque type that provides access to read-only camera metadata like camera * ACameraMetadata is opaque type that provides access to read-only camera metadata like camera
* characteristics (via {@link ACameraManager_getCameraCharacteristics}) or capture results (via * characteristics (via {@link ACameraManager_getCameraCharacteristics}) or capture results (via
@ -229,6 +231,8 @@ ACameraMetadata* ACameraMetadata_copy(const ACameraMetadata* src) __INTRODUCED_I
*/ */
void ACameraMetadata_free(ACameraMetadata* metadata) __INTRODUCED_IN(24); void ACameraMetadata_free(ACameraMetadata* metadata) __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */
__END_DECLS __END_DECLS
#endif /* _NDK_CAMERA_METADATA_H */ #endif /* _NDK_CAMERA_METADATA_H */

@ -40,6 +40,8 @@
__BEGIN_DECLS __BEGIN_DECLS
#if __ANDROID_API__ >= 24
typedef enum acamera_metadata_section { typedef enum acamera_metadata_section {
ACAMERA_COLOR_CORRECTION, ACAMERA_COLOR_CORRECTION,
ACAMERA_CONTROL, ACAMERA_CONTROL,
@ -7894,6 +7896,9 @@ typedef enum acamera_metadata_enum_acamera_distortion_correction_mode {
} acamera_metadata_enum_android_distortion_correction_mode_t; } acamera_metadata_enum_android_distortion_correction_mode_t;
#endif /* __ANDROID_API__ >= 24 */
__END_DECLS __END_DECLS
#endif /* _NDK_CAMERA_METADATA_TAGS_H */ #endif /* _NDK_CAMERA_METADATA_TAGS_H */

@ -44,6 +44,8 @@
__BEGIN_DECLS __BEGIN_DECLS
#if __ANDROID_API__ >= 24
// Container for output targets // Container for output targets
typedef struct ACameraOutputTargets ACameraOutputTargets; typedef struct ACameraOutputTargets ACameraOutputTargets;
@ -302,6 +304,10 @@ camera_status_t ACaptureRequest_setEntry_rational(
*/ */
void ACaptureRequest_free(ACaptureRequest* request) __INTRODUCED_IN(24); void ACaptureRequest_free(ACaptureRequest* request) __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */
#if __ANDROID_API__ >= 28
/** /**
* Associate an arbitrary user context pointer to the {@link ACaptureRequest} * Associate an arbitrary user context pointer to the {@link ACaptureRequest}
* *
@ -350,6 +356,8 @@ camera_status_t ACaptureRequest_getUserContext(
*/ */
ACaptureRequest* ACaptureRequest_copy(const ACaptureRequest* src) __INTRODUCED_IN(28); ACaptureRequest* ACaptureRequest_copy(const ACaptureRequest* src) __INTRODUCED_IN(28);
#endif /* __ANDROID_API__ >= 28 */
__END_DECLS __END_DECLS
#endif /* _NDK_CAPTURE_REQUEST_H */ #endif /* _NDK_CAPTURE_REQUEST_H */

@ -516,6 +516,8 @@ typedef struct AImageCropRect {
int32_t bottom; int32_t bottom;
} AImageCropRect; } AImageCropRect;
#if __ANDROID_API__ >= 24
/** /**
* Return the image back the the system and delete the AImage object from memory. * Return the image back the the system and delete the AImage object from memory.
* *
@ -712,6 +714,10 @@ media_status_t AImage_getPlaneData(
const AImage* image, int planeIdx, const AImage* image, int planeIdx,
/*out*/uint8_t** data, /*out*/int* dataLength) __INTRODUCED_IN(24); /*out*/uint8_t** data, /*out*/int* dataLength) __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */
#if __ANDROID_API__ >= 26
/** /**
* Return the image back the the system and delete the AImage object from memory asynchronously. * Return the image back the the system and delete the AImage object from memory asynchronously.
* *
@ -756,6 +762,8 @@ void AImage_deleteAsync(AImage* image, int releaseFenceFd) __INTRODUCED_IN(26);
*/ */
media_status_t AImage_getHardwareBuffer(const AImage* image, /*out*/AHardwareBuffer** buffer) __INTRODUCED_IN(26); media_status_t AImage_getHardwareBuffer(const AImage* image, /*out*/AHardwareBuffer** buffer) __INTRODUCED_IN(26);
#endif /* __ANDROID_API__ >= 26 */
__END_DECLS __END_DECLS
#endif //_NDK_IMAGE_H #endif //_NDK_IMAGE_H

@ -50,6 +50,8 @@ __BEGIN_DECLS
*/ */
typedef struct AImageReader AImageReader; typedef struct AImageReader AImageReader;
#if __ANDROID_API__ >= 24
/** /**
* Create a new reader for images of the desired size and format. * Create a new reader for images of the desired size and format.
* *
@ -296,6 +298,10 @@ typedef struct AImageReader_ImageListener {
media_status_t AImageReader_setImageListener( media_status_t AImageReader_setImageListener(
AImageReader* reader, AImageReader_ImageListener* listener) __INTRODUCED_IN(24); AImageReader* reader, AImageReader_ImageListener* listener) __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */
#if __ANDROID_API__ >= 26
/** /**
* AImageReader constructor similar to {@link AImageReader_new} that takes an additional parameter * AImageReader constructor similar to {@link AImageReader_new} that takes an additional parameter
* for the consumer usage. All other parameters and the return values are identical to those passed * for the consumer usage. All other parameters and the return values are identical to those passed
@ -455,6 +461,8 @@ typedef struct AImageReader_BufferRemovedListener {
media_status_t AImageReader_setBufferRemovedListener( media_status_t AImageReader_setBufferRemovedListener(
AImageReader* reader, AImageReader_BufferRemovedListener* listener) __INTRODUCED_IN(26); AImageReader* reader, AImageReader_BufferRemovedListener* listener) __INTRODUCED_IN(26);
#endif /* __ANDROID_API__ >= 26 */
__END_DECLS __END_DECLS
#endif //_NDK_IMAGE_READER_H #endif //_NDK_IMAGE_READER_H

@ -121,6 +121,8 @@ struct AMediaCodecOnAsyncNotifyCallback {
AMediaCodecOnAsyncError onAsyncError; AMediaCodecOnAsyncError onAsyncError;
}; };
#if __ANDROID_API__ >= 21
/** /**
* Create codec by name. Use this if you know the exact codec you want to use. * 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 * When configuring, you will need to specify whether to use the codec as an
@ -274,6 +276,8 @@ media_status_t AMediaCodec_setOutputSurface(AMediaCodec*, ANativeWindow* surface
media_status_t AMediaCodec_releaseOutputBufferAtTime( media_status_t AMediaCodec_releaseOutputBufferAtTime(
AMediaCodec *mData, size_t idx, int64_t timestampNs) __INTRODUCED_IN(21); AMediaCodec *mData, size_t idx, int64_t timestampNs) __INTRODUCED_IN(21);
#if __ANDROID_API__ >= 26
/** /**
* Creates a Surface that can be used as the input to encoder, in place of input buffers * Creates a Surface that can be used as the input to encoder, in place of input buffers
* *
@ -344,6 +348,10 @@ media_status_t AMediaCodec_setParameters(
*/ */
media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData) __INTRODUCED_IN(26); media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData) __INTRODUCED_IN(26);
#endif /* __ANDROID_API__ >= 26 */
#if __ANDROID_API__ >= 28
/** /**
* Get the component name. If the codec was created by createDecoderByType * Get the component name. If the codec was created by createDecoderByType
* or createEncoderByType, what component is chosen is not known beforehand. * or createEncoderByType, what component is chosen is not known beforehand.
@ -405,6 +413,8 @@ bool AMediaCodecActionCode_isRecoverable(int32_t actionCode) __INTRODUCED_IN(28)
*/ */
bool AMediaCodecActionCode_isTransient(int32_t actionCode) __INTRODUCED_IN(28); bool AMediaCodecActionCode_isTransient(int32_t actionCode) __INTRODUCED_IN(28);
#endif /* __ANDROID_API__ >= 28 */
typedef enum { typedef enum {
AMEDIACODECRYPTOINFO_MODE_CLEAR = 0, AMEDIACODECRYPTOINFO_MODE_CLEAR = 0,
AMEDIACODECRYPTOINFO_MODE_AES_CTR = 1, AMEDIACODECRYPTOINFO_MODE_AES_CTR = 1,
@ -483,6 +493,8 @@ media_status_t AMediaCodecCryptoInfo_getClearBytes(AMediaCodecCryptoInfo*, size_
*/ */
media_status_t AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, size_t *dst) __INTRODUCED_IN(21); media_status_t AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, size_t *dst) __INTRODUCED_IN(21);
#endif /* __ANDROID_API__ >= 21 */
__END_DECLS __END_DECLS
#endif //_NDK_MEDIA_CODEC_H #endif //_NDK_MEDIA_CODEC_H

@ -47,6 +47,8 @@ typedef struct AMediaCrypto AMediaCrypto;
typedef uint8_t AMediaUUID[16]; typedef uint8_t AMediaUUID[16];
#if __ANDROID_API__ >= 21
bool AMediaCrypto_isCryptoSchemeSupported(const AMediaUUID uuid) __INTRODUCED_IN(21); bool AMediaCrypto_isCryptoSchemeSupported(const AMediaUUID uuid) __INTRODUCED_IN(21);
bool AMediaCrypto_requiresSecureDecoderComponent(const char *mime) __INTRODUCED_IN(21); bool AMediaCrypto_requiresSecureDecoderComponent(const char *mime) __INTRODUCED_IN(21);
@ -55,6 +57,8 @@ AMediaCrypto* AMediaCrypto_new(const AMediaUUID uuid, const void *initData, size
void AMediaCrypto_delete(AMediaCrypto* crypto) __INTRODUCED_IN(21); void AMediaCrypto_delete(AMediaCrypto* crypto) __INTRODUCED_IN(21);
#endif /* __ANDROID_API__ >= 21 */
__END_DECLS __END_DECLS
#endif // _NDK_MEDIA_CRYPTO_H #endif // _NDK_MEDIA_CRYPTO_H

@ -38,6 +38,8 @@ __BEGIN_DECLS
struct AMediaDataSource; struct AMediaDataSource;
typedef struct AMediaDataSource AMediaDataSource; typedef struct AMediaDataSource AMediaDataSource;
#if __ANDROID_API__ >= 28
/* /*
* AMediaDataSource's callbacks will be invoked on an implementation-defined thread * 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 * or thread pool. No guarantees are provided about which thread(s) will be used for
@ -133,6 +135,8 @@ void AMediaDataSource_setClose(
AMediaDataSource*, AMediaDataSource*,
AMediaDataSourceClose) __INTRODUCED_IN(28); AMediaDataSourceClose) __INTRODUCED_IN(28);
#endif /*__ANDROID_API__ >= 28 */
__END_DECLS __END_DECLS
#endif // _NDK_MEDIA_DATASOURCE_H #endif // _NDK_MEDIA_DATASOURCE_H

@ -87,6 +87,8 @@ typedef enum AMediaDrmEventType {
typedef void (*AMediaDrmEventListener)(AMediaDrm *, const AMediaDrmSessionId *sessionId, typedef void (*AMediaDrmEventListener)(AMediaDrm *, const AMediaDrmSessionId *sessionId,
AMediaDrmEventType eventType, int extra, const uint8_t *data, size_t dataSize); 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 * 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. * whether the drm plugin is able to handle the media container format specified by mimeType.
@ -459,6 +461,8 @@ media_status_t AMediaDrm_verify(AMediaDrm *, const AMediaDrmSessionId *sessionId
const char *macAlgorithm, uint8_t *keyId, const uint8_t *message, size_t messageSize, const char *macAlgorithm, uint8_t *keyId, const uint8_t *message, size_t messageSize,
const uint8_t *signature, size_t signatureSize) __INTRODUCED_IN(21); const uint8_t *signature, size_t signatureSize) __INTRODUCED_IN(21);
#endif /* __ANDROID_API__ >= 21 */
__END_DECLS __END_DECLS
#endif //_NDK_MEDIA_DRM_H #endif //_NDK_MEDIA_DRM_H

@ -49,6 +49,8 @@ __BEGIN_DECLS
struct AMediaExtractor; struct AMediaExtractor;
typedef struct AMediaExtractor AMediaExtractor; typedef struct AMediaExtractor AMediaExtractor;
#if __ANDROID_API__ >= 21
/** /**
* Create new media extractor * Create new media extractor
*/ */
@ -72,12 +74,16 @@ media_status_t AMediaExtractor_setDataSource(AMediaExtractor*,
const char *location) __INTRODUCED_IN(21); const char *location) __INTRODUCED_IN(21);
// TODO support headers // TODO support headers
#if __ANDROID_API__ >= 28
/** /**
* Set the custom data source implementation from which the extractor will read. * Set the custom data source implementation from which the extractor will read.
*/ */
media_status_t AMediaExtractor_setDataSourceCustom(AMediaExtractor*, media_status_t AMediaExtractor_setDataSourceCustom(AMediaExtractor*,
AMediaDataSource *src) __INTRODUCED_IN(28); AMediaDataSource *src) __INTRODUCED_IN(28);
#endif /* __ANDROID_API__ >= 28 */
/** /**
* Return the number of tracks in the previously specified media file * Return the number of tracks in the previously specified media file
*/ */
@ -173,6 +179,8 @@ enum {
AMEDIAEXTRACTOR_SAMPLE_FLAG_ENCRYPTED = 2, AMEDIAEXTRACTOR_SAMPLE_FLAG_ENCRYPTED = 2,
}; };
#if __ANDROID_API__ >= 28
/** /**
* Returns the format of the extractor. The caller must free the returned format * Returns the format of the extractor. The caller must free the returned format
* using AMediaFormat_delete(format). * using AMediaFormat_delete(format).
@ -219,6 +227,10 @@ int64_t AMediaExtractor_getCachedDuration(AMediaExtractor *) __INTRODUCED_IN(28)
media_status_t AMediaExtractor_getSampleFormat(AMediaExtractor *ex, media_status_t AMediaExtractor_getSampleFormat(AMediaExtractor *ex,
AMediaFormat *fmt) __INTRODUCED_IN(28); AMediaFormat *fmt) __INTRODUCED_IN(28);
#endif /* __ANDROID_API__ >= 28 */
#endif /* __ANDROID_API__ >= 21 */
__END_DECLS __END_DECLS
#endif // _NDK_MEDIA_EXTRACTOR_H #endif // _NDK_MEDIA_EXTRACTOR_H

@ -46,6 +46,8 @@ __BEGIN_DECLS
struct AMediaFormat; struct AMediaFormat;
typedef struct AMediaFormat AMediaFormat; typedef struct AMediaFormat AMediaFormat;
#if __ANDROID_API__ >= 21
AMediaFormat *AMediaFormat_new() __INTRODUCED_IN(21); AMediaFormat *AMediaFormat_new() __INTRODUCED_IN(21);
media_status_t AMediaFormat_delete(AMediaFormat*) __INTRODUCED_IN(21); media_status_t AMediaFormat_delete(AMediaFormat*) __INTRODUCED_IN(21);
@ -155,6 +157,9 @@ extern const char* AMEDIAFORMAT_KEY_TRACK_ID __INTRODUCED_IN(28);
extern const char* AMEDIAFORMAT_KEY_TRACK_INDEX __INTRODUCED_IN(28); extern const char* AMEDIAFORMAT_KEY_TRACK_INDEX __INTRODUCED_IN(28);
extern const char* AMEDIAFORMAT_KEY_WIDTH __INTRODUCED_IN(21); extern const char* AMEDIAFORMAT_KEY_WIDTH __INTRODUCED_IN(21);
#endif /* __ANDROID_API__ >= 21 */
#if __ANDROID_API__ >= 28
bool AMediaFormat_getDouble(AMediaFormat*, const char *name, double *out) __INTRODUCED_IN(28); bool AMediaFormat_getDouble(AMediaFormat*, const char *name, double *out) __INTRODUCED_IN(28);
bool AMediaFormat_getRect(AMediaFormat*, const char *name, bool AMediaFormat_getRect(AMediaFormat*, const char *name,
int32_t *left, int32_t *top, int32_t *right, int32_t *bottom) __INTRODUCED_IN(28); int32_t *left, int32_t *top, int32_t *right, int32_t *bottom) __INTRODUCED_IN(28);
@ -163,6 +168,7 @@ void AMediaFormat_setDouble(AMediaFormat*, const char* name, double value) __INT
void AMediaFormat_setSize(AMediaFormat*, const char* name, size_t value) __INTRODUCED_IN(28); void AMediaFormat_setSize(AMediaFormat*, const char* name, size_t value) __INTRODUCED_IN(28);
void AMediaFormat_setRect(AMediaFormat*, const char* name, void AMediaFormat_setRect(AMediaFormat*, const char* name,
int32_t left, int32_t top, int32_t right, int32_t bottom) __INTRODUCED_IN(28); int32_t left, int32_t top, int32_t right, int32_t bottom) __INTRODUCED_IN(28);
#endif /* __ANDROID_API__ >= 28 */
__END_DECLS __END_DECLS

@ -53,6 +53,8 @@ typedef enum {
AMEDIAMUXER_OUTPUT_FORMAT_WEBM = 1, AMEDIAMUXER_OUTPUT_FORMAT_WEBM = 1,
} OutputFormat; } OutputFormat;
#if __ANDROID_API__ >= 21
/** /**
* Create new media muxer * Create new media muxer
*/ */
@ -121,6 +123,8 @@ media_status_t AMediaMuxer_writeSampleData(AMediaMuxer *muxer,
size_t trackIdx, const uint8_t *data, size_t trackIdx, const uint8_t *data,
const AMediaCodecBufferInfo *info) __INTRODUCED_IN(21); const AMediaCodecBufferInfo *info) __INTRODUCED_IN(21);
#endif /* __ANDROID_API__ >= 21 */
__END_DECLS __END_DECLS
#endif // _NDK_MEDIA_MUXER_H #endif // _NDK_MEDIA_MUXER_H

Loading…
Cancel
Save