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

Commit 728a9ac4 authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

Add AImageDecoder_getRepeatCount

Bug: 160984428
Test: Ia09c95173d7e53dc2c0f6d170c67a3f3360275b9
Change-Id: Id16020360d19c5cd5a552a53b186c1e6d2caab59
parent 1b389716
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -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