-
Notifications
You must be signed in to change notification settings - Fork 233
IMG_CODER_STATUS Feature For En/De-coders #611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Maybe we can rename |
Okay if we only need this for the decoder part I'll update it all soon to only reflect this change for our decoder. |
I suggested IMG_DecodeStatus above. Could be IMG_AnimationDecodeStatus? |
Alright IMG_AnimationDecodeStatus it is then, will make those soon. |
typedef enum IMG_CoderStatus
{
IMG_DECODE_STATUS_OK, /**< Decoded the frame successfully. */
IMG_DECODE_STATUS_FAILED, /**< Decoding the frame failed. Call SDL_GetError for more information. */
IMG_DECODE_STATUS_COMPLETE, /**< No more frames available. */
IMG_DECODE_STATUS_INVALID, /**< Invalid decoder status that does not represent any valid status. */
} IMG_CoderStatus; @slouken should we keep IMG_DECODE_STATUS_INVALID? if we won't, what will it be when the user gives NULL to decoder pointer while calling the GetAnimationDecoderStatus? Do you want function to be still named GetAnimationDecoderStatus? If not, what do you want it to be named? Please let me know these. (Ignore the enum name, haven't changed that yet, just check the fields) FYI: IMG_AnimationDecodeStatus sounds grammatically incorrect; should it be IMG_AnimationDecoderStatus or IMG_AnimationFrameDecodeStatus? Or do you want to keep DecodeStatus as-is? |
Yes, keeping it seems correct.
Sure, that sounds good.
It sounds grammatically correct to me, but IMG_AnimationDecoderStatus is probably better. It's the current status of the decoder. |
…Status along with its fields
…Status with IMG_AnimationDecoderStatus
Done, also fixed a bug in the encoder part where we weren't checking the result before increasing the accumulated_pts and last_delay with the given duration, it was getting increased even when the function failed, now that won't be the case. |
Co-authored-by: Sam Lantinga <[email protected]>
Co-authored-by: Sam Lantinga <[email protected]>
Co-authored-by: Sam Lantinga <[email protected]>
Merged, thanks! |
Thanks to you as well. |
Introducing
IMG_CODER_STATUS
, which is used in symmetry by both encoders and decoders for animation.Here's a brief list:
IMG_CODER_STATUS
enum.IMG_CODER_STATUS_OK
for stating that the coder was successful.IMG_CODER_STATUS_FAILED
for stating that the coder was unsuccessful.IMG_CODER_STATUS_MAX
for stating that we either hit max available frames (for decoders) or that we are not allowed to add more frames (for encoders).IMG_CODER_STATUS_INVALID
for stating whenIMG_GetAnimationEncoderStatus
orIMG_GetAnimationDecoderStatus
is called with an invalid coder parameter. It can be used in other similar cases as well.IMG_AddAnimationEncoderFrame
andIMG_GetAnimationDecoderFrame
to first assignIMG_CODER_STATUS_OK
and then, after the call to the underlying function, check if the status is still OK, but if an error has been provided by the underlying coder, we setIMG_CODER_STATUS_FAILED
automatically. This smoothly handles statuses at the coder level without having to interfere with the existingSDL_SetError
calls. However, calls forIMG_CODER_STATUS_MAX
and such are still provided by the underlying coders.IMG_CODER_STATUS
(e.g.,IMG_CODER_STATUS_MAX
).This does not interfere with the execution and can safely be merged in after an approval for the design.