Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e496db4 authored by Dan Albert's avatar Dan Albert
Browse files

Don't hide NDK types behind API level guards.

The types are still needed if you want to target a lower API level
and use dlsym to conditionally access new APIs when running on new
devices.

Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/529
Change-Id: If5e41102b1badfd47f3625656058196373f119b3
parent 16f2c155
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -44,11 +44,7 @@
#include <android/hardware_buffer.h>
#endif /* __ANDROID_API__ >= 26 */

#ifdef __cplusplus
extern "C" {
#endif

#if __ANDROID_API__ >= 24
__BEGIN_DECLS

/**
 * AImage is an opaque type that provides access to image generated by {@link AImageReader}.
@@ -513,6 +509,8 @@ 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.
 *
@@ -758,9 +756,7 @@ media_status_t AImage_getHardwareBuffer(const AImage* image, /*out*/AHardwareBuf

#endif /* __ANDROID_API__ >= 26 */

#ifdef __cplusplus
} // extern "C"
#endif
__END_DECLS

#endif //_NDK_IMAGE_H

+4 −9
Original line number Diff line number Diff line
@@ -42,11 +42,7 @@
#include "NdkMediaError.h"
#include "NdkImage.h"

#ifdef __cplusplus
extern "C" {
#endif

#if __ANDROID_API__ >= 24
__BEGIN_DECLS

/**
 * AImage is an opaque type that allows direct application access to image data rendered into a
@@ -54,6 +50,8 @@ extern "C" {
 */
typedef struct AImageReader AImageReader;

#if __ANDROID_API__ >= 24

/**
 * Create a new reader for images of the desired size and format.
 *
@@ -436,10 +434,7 @@ media_status_t AImageReader_setBufferRemovedListener(

#endif /* __ANDROID_API__ >= 26 */


#ifdef __cplusplus
} // extern "C"
#endif
__END_DECLS

#endif //_NDK_IMAGE_READER_H

+4 −7
Original line number Diff line number Diff line
@@ -34,14 +34,11 @@
#include "NdkMediaError.h"
#include "NdkMediaFormat.h"

#ifdef __cplusplus
extern "C" {
#endif
__BEGIN_DECLS

struct ANativeWindow;
typedef struct ANativeWindow ANativeWindow;

#if __ANDROID_API__ >= 21

struct AMediaCodec;
typedef struct AMediaCodec AMediaCodec;
@@ -63,6 +60,8 @@ enum {
    AMEDIACODEC_INFO_TRY_AGAIN_LATER = -1
};

#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
@@ -364,8 +363,6 @@ media_status_t AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, s

#endif /* __ANDROID_API__ >= 21 */

#ifdef __cplusplus
} // extern "C"
#endif
__END_DECLS

#endif //_NDK_MEDIA_CODEC_H
+4 −8
Original line number Diff line number Diff line
@@ -32,17 +32,15 @@
#include <sys/types.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

#if __ANDROID_API__ >= 21
__BEGIN_DECLS

struct AMediaCrypto;
typedef struct AMediaCrypto AMediaCrypto;

typedef uint8_t AMediaUUID[16];

#if __ANDROID_API__ >= 21

bool AMediaCrypto_isCryptoSchemeSupported(const AMediaUUID uuid);

bool AMediaCrypto_requiresSecureDecoderComponent(const char *mime);
@@ -53,8 +51,6 @@ void AMediaCrypto_delete(AMediaCrypto* crypto);

#endif /* __ANDROID_API__ >= 21 */

#ifdef __cplusplus
} // extern "C"
#endif
__END_DECLS

#endif // _NDK_MEDIA_CRYPTO_H
+3 −9
Original line number Diff line number Diff line
@@ -33,11 +33,7 @@

#include "NdkMediaError.h"

#ifdef __cplusplus
extern "C" {
#endif

#if __ANDROID_API__ >= 21
__BEGIN_DECLS

struct AMediaDrm;
typedef struct AMediaDrm AMediaDrm;
@@ -52,7 +48,6 @@ typedef AMediaDrmByteArray AMediaDrmScope;
typedef AMediaDrmByteArray AMediaDrmKeySetId;
typedef AMediaDrmByteArray AMediaDrmSecureStop;


typedef enum AMediaDrmEventType {
    /**
     * This event type indicates that the app needs to request a certificate from
@@ -83,6 +78,7 @@ 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
@@ -452,8 +448,6 @@ media_status_t AMediaDrm_verify(AMediaDrm *, const AMediaDrmSessionId *sessionId

#endif /* __ANDROID_API__ >= 21 */

#ifdef __cplusplus
} // extern "C"
#endif
__END_DECLS

#endif //_NDK_MEDIA_DRM_H
Loading