ndk icon indicating copy to clipboard operation
ndk copied to clipboard

[DOC] AMediaCodecCryptoInfo_setPattern is available in 24+, not 21+

Open aosmond opened this issue 5 months ago • 2 comments

URL

https://developer.android.com/ndk/reference/group/media#amediacodeccryptoinfo_setpattern

Problem

The documentation claims that AMediaCodecCryptoInfo_setPattern is available in 21+. Downloading the latest NDK and checking android-ndk-r27d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/media/NdkMediaCodec.h, it confirms this:

/**
 * Set the crypto pattern on an AMediaCryptoInfo object.
 *
 * Available since API level 21.
 */
void AMediaCodecCryptoInfo_setPattern(
        AMediaCodecCryptoInfo *info,
        cryptoinfo_pattern_t *pattern) __INTRODUCED_IN(21);

But checking the libraries tells a different story, where you can see it isn't present in 21, 22 or 23. It actually only shows up in 24:

$ readelf -Ws --dyn-syms android-ndk-r27d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/21/libmediandk.so | grep -i AMediaCodecCryptoInfo_setPattern
readelf: Warning: section '.debug_str' has unsupported compress type: 2

$ readelf -Ws --dyn-syms android-ndk-r27d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/22/libmediandk.so | grep -i AMediaCodecCryptoInfo_setPattern
readelf: Warning: section '.debug_str' has unsupported compress type: 2

$ readelf -Ws --dyn-syms android-ndk-r27d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/23/libmediandk.so | grep -i AMediaCodecCryptoInfo_setPattern
readelf: Warning: section '.debug_str' has unsupported compress type: 2

$ readelf -Ws --dyn-syms android-ndk-r27d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/24/libmediandk.so | grep -i AMediaCodecCryptoInfo_setPattern
readelf: Warning: section '.debug_str' has unsupported compress type: 2
   121: 00000000000031c0     1 FUNC    GLOBAL DEFAULT    7 AMediaCodecCryptoInfo_setPattern
    31: 00000000000031c0     1 FUNC    GLOBAL DEFAULT    7 AMediaCodecCryptoInfo_setPattern

aosmond avatar Aug 05 '25 18:08 aosmond