gif: fix incorrect loop_count calculation#726
Draft
jsm174 wants to merge 1 commit intolibsdl-org:mainfrom
Draft
Conversation
Author
I guess some of the confusion is that it's not really loop count but "repeats after the first play". With what I provided, SDL_image would now abstract this concept away. So I'm definitely fine with changing to IMG_PROP_METADATA_NETSCAPE_EXTENSION, just let me know what the name should be and what type of value it should be. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR supersedes #725 with new logic.
The GIF89a spec has no concept of looping. When the NETSCAPE extension is present, the stored value is the number of repeats after the first play.
As of now, if the NETSCAPE extension is not present,
loop_countwill be0which means users trying to use this value would think they need to loop indefinitely.The value for the
IMG_PROP_METADATA_LOOP_COUNT_NUMBERproperty could be:This also updates the encoder to skip writing the NETSCAPE extension if loop_count=1, ie:
see here, here, and here
(If this is not acceptable, and we need a new
IMG_PROP_METADATAproperty, I can modify this commit. At the end of the day, I just need an accurate way to know if I need to loop, and if so, how many times.)