From 728a9ac4e726707fd5d3c5aeac286382fdd68d0c Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Mon, 12 Oct 2020 10:34:05 -0400 Subject: Add AImageDecoder_getRepeatCount Bug: 160984428 Test: Ia09c95173d7e53dc2c0f6d170c67a3f3360275b9 Change-Id: Id16020360d19c5cd5a552a53b186c1e6d2caab59 --- include/android/imagedecoder.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'include/android/imagedecoder.h') diff --git a/include/android/imagedecoder.h b/include/android/imagedecoder.h index e8a63a7d6b..3dd1534f1d 100644 --- a/include/android/imagedecoder.h +++ b/include/android/imagedecoder.h @@ -557,6 +557,40 @@ int AImageDecoder_decodeImage(AImageDecoder* _Nonnull decoder, bool AImageDecoder_isAnimated(AImageDecoder* _Nonnull decoder) __INTRODUCED_IN(31); +enum { + /* + * Reported by {@link AImageDecoder_getRepeatCount} if the + * animation should repeat forever. + */ + ANDROID_IMAGE_DECODER_INFINITE = INT32_MAX, +}; + +/** + * Report how many times the animation should repeat. + * + * Introduced in API 31. + * + * This does not include the first play through. e.g. a repeat + * count of 4 means that each frame is played 5 times. + * + * {@link ANDROID_IMAGE_DECODER_INFINITE} means to repeat forever. + * + * This may require seeking. + * + * For non-animated formats, this returns 0. It may return non-zero for + * an image with only one frame (i.e. {@link AImageDecoder_isAnimated} returns + * false) if the encoded image contains a repeat count. + * + * @return Number of times to repeat on success or a value + * indicating the reason for the failure. + * + * Errors: + * - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}: The AImageDecoder + * is null. + */ +int32_t AImageDecoder_getRepeatCount(AImageDecoder* _Nonnull decoder); + __INTRODUCED_IN(31); + #endif // __ANDROID_API__ >= 31 #ifdef __cplusplus -- cgit v1.2.3-59-g8ed1b