avif: Do not rewind in jumpToNextImage()

This commit is contained in:
Daniel Novomeský
2026-08-10 20:10:46 +02:00
parent c57af25d36
commit c7baa057a6
+4 -10
View File
@@ -1160,25 +1160,19 @@ bool QAVIFHandler::jumpToNextImage()
return false; return false;
} }
avifResult decodeResult;
if (m_decoder->imageIndex >= 0) { if (m_decoder->imageIndex >= 0) {
if (m_decoder->imageCount < 2) { if (m_decoder->imageCount < 2) {
m_parseState = ParseAvifSuccess; // single image, there is no next image
return false; return false;
} }
if (m_decoder->imageIndex >= m_decoder->imageCount - 1) { // start from beginning if (m_decoder->imageIndex >= m_decoder->imageCount - 1) {
decodeResult = avifDecoderReset(m_decoder); // do not start from beginning when at the end already
if (decodeResult != AVIF_RESULT_OK) {
qCWarning(LOG_AVIFPLUGIN, "ERROR in avifDecoderReset: %s", avifResultToString(decodeResult));
m_parseState = ParseAvifError;
return false; return false;
} }
} }
}
decodeResult = avifDecoderNextImage(m_decoder); avifResult decodeResult = avifDecoderNextImage(m_decoder);
if (decodeResult != AVIF_RESULT_OK) { if (decodeResult != AVIF_RESULT_OK) {
qCWarning(LOG_AVIFPLUGIN, "ERROR: Failed to decode Next image in sequence: %s", avifResultToString(decodeResult)); qCWarning(LOG_AVIFPLUGIN, "ERROR: Failed to decode Next image in sequence: %s", avifResultToString(decodeResult));