summaryrefslogtreecommitdiff
path: root/include/android/imagedecoder.h
diff options
context:
space:
mode:
author Leon Scroggins III <scroggo@google.com> 2020-10-12 10:34:05 -0400
committer Leon Scroggins III <scroggo@google.com> 2020-10-12 10:34:05 -0400
commit728a9ac4e726707fd5d3c5aeac286382fdd68d0c (patch)
treebc004832774fc3853b0749f61086d9696b9d6f46 /include/android/imagedecoder.h
parent1b3897163eccbfd75ed7e4a40de3537afad458b1 (diff)
Add AImageDecoder_getRepeatCount
Bug: 160984428 Test: Ia09c95173d7e53dc2c0f6d170c67a3f3360275b9 Change-Id: Id16020360d19c5cd5a552a53b186c1e6d2caab59
Diffstat (limited to 'include/android/imagedecoder.h')
-rw-r--r--include/android/imagedecoder.h34
1 files changed, 34 insertions, 0 deletions
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