avifenc: Fix an off by one error
Computation of isImageSequence in avifenc has an off by one error.
Since there is an encode before the while loop, >0 check is incorrect
and it must be >=0. A simpler way to check for image sequence is to
simply see if we enter the while loop or not.
Also, fix a typo in CHANGELOG.md.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c7acf22..f10b3e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,7 +14,7 @@
* Add STATIC library target avif_internal to allow tests to access functions
from internal.h when BUILD_SHARED_LIBS is ON.
* Add clli metadata read and write support
-* repetitionCount member added to avifEncoder and avifDecoder struct to specify
+* Add repetitionCount member to avifEncoder and avifDecoder structs to specify
the number of repetitions for animated image sequences.
### Changed
diff --git a/apps/avifenc.c b/apps/avifenc.c
index 81765a0..d9c2d8e 100644
--- a/apps/avifenc.c
+++ b/apps/avifenc.c
@@ -1256,6 +1256,7 @@
int nextImageIndex = -1;
while ((nextFile = avifInputGetNextFile(&input)) != NULL) {
++nextImageIndex;
+ isImageSequence = AVIF_TRUE;
uint64_t nextDurationInTimescales = nextFile->duration ? nextFile->duration : outputTiming.duration;
@@ -1335,9 +1336,6 @@
goto cleanup;
}
}
- if (nextImageIndex > 0) {
- isImageSequence = AVIF_TRUE;
- }
}
avifResult finishResult = avifEncoderFinish(encoder, &raw);