From 15d8ae17cd9d4133edc8c22a1983764238b0d20f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 31 Dec 2025 19:38:08 -0800
Subject: [PATCH] Added IMG_PROP_METADATA_FRAME_COUNT_NUMBER
---
include/SDL3_image/SDL_image.h | 1 +
src/IMG_ani.c | 2 +-
src/IMG_avif.c | 2 +-
src/IMG_libpng.c | 2 +-
src/IMG_webp.c | 2 +-
5 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/include/SDL3_image/SDL_image.h b/include/SDL3_image/SDL_image.h
index b07607a2..9f45cd38 100644
--- a/include/SDL3_image/SDL_image.h
+++ b/include/SDL3_image/SDL_image.h
@@ -3088,6 +3088,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL IMG_GetAnimationDecoderProperties(I
#define IMG_PROP_METADATA_TITLE_STRING "SDL_image.metadata.title"
#define IMG_PROP_METADATA_AUTHOR_STRING "SDL_image.metadata.author"
#define IMG_PROP_METADATA_CREATION_TIME_STRING "SDL_image.metadata.creation_time"
+#define IMG_PROP_METADATA_FRAME_COUNT_NUMBER "SDL_image.metadata.frame_count"
#define IMG_PROP_METADATA_LOOP_COUNT_NUMBER "SDL_image.metadata.loop_count"
/**
diff --git a/src/IMG_ani.c b/src/IMG_ani.c
index 8f7f9b42..bbfc2dc5 100644
--- a/src/IMG_ani.c
+++ b/src/IMG_ani.c
@@ -445,7 +445,7 @@ bool IMG_CreateANIAnimationDecoder(IMG_AnimationDecoder *decoder, SDL_Properties
bool ignoreProps = SDL_GetBooleanProperty(props, IMG_PROP_METADATA_IGNORE_PROPS_BOOLEAN, false);
if (!ignoreProps) {
// Allow implicit properties to be set which are not globalized but specific to the decoder.
- SDL_SetNumberProperty(decoder->props, "IMG_PROP_METADATA_FRAME_COUNT_NUMBER", ctx->frame_count);
+ SDL_SetNumberProperty(decoder->props, IMG_PROP_METADATA_FRAME_COUNT_NUMBER, ctx->frame_count);
if (parse.title && *parse.title) {
SDL_SetStringProperty(decoder->props, IMG_PROP_METADATA_TITLE_STRING, parse.title);
diff --git a/src/IMG_avif.c b/src/IMG_avif.c
index 75baf098..1704f373 100644
--- a/src/IMG_avif.c
+++ b/src/IMG_avif.c
@@ -1138,7 +1138,7 @@ bool IMG_CreateAVIFAnimationDecoder(IMG_AnimationDecoder *decoder, SDL_Propertie
if (!ignoreProps) {
// Allow implicit properties to be set which are not globalized but specific to the decoder.
- SDL_SetNumberProperty(decoder->props, "IMG_PROP_METADATA_FRAME_COUNT_NUMBER", ctx->total_frames);
+ SDL_SetNumberProperty(decoder->props, IMG_PROP_METADATA_FRAME_COUNT_NUMBER, ctx->total_frames);
// Set well-defined properties.
SDL_SetNumberProperty(decoder->props, IMG_PROP_METADATA_LOOP_COUNT_NUMBER, ctx->decoder->repetitionCount);
diff --git a/src/IMG_libpng.c b/src/IMG_libpng.c
index 1d3b6584..6877f433 100644
--- a/src/IMG_libpng.c
+++ b/src/IMG_libpng.c
@@ -1666,7 +1666,7 @@ bool IMG_CreateAPNGAnimationDecoder(IMG_AnimationDecoder *decoder, SDL_Propertie
bool ignoreProps = SDL_GetBooleanProperty(props, IMG_PROP_METADATA_IGNORE_PROPS_BOOLEAN, false);
if (!ignoreProps) {
// Allow implicit properties to be set which are not globalized but specific to the decoder.
- SDL_SetNumberProperty(decoder->props, "IMG_PROP_METADATA_FRAME_COUNT_NUMBER", ctx->actl.num_frames);
+ SDL_SetNumberProperty(decoder->props, IMG_PROP_METADATA_FRAME_COUNT_NUMBER, ctx->actl.num_frames);
// Set well-defined properties.
SDL_SetNumberProperty(decoder->props, IMG_PROP_METADATA_LOOP_COUNT_NUMBER, ctx->actl.num_plays);
diff --git a/src/IMG_webp.c b/src/IMG_webp.c
index 2c5b345c..31994242 100644
--- a/src/IMG_webp.c
+++ b/src/IMG_webp.c
@@ -611,7 +611,7 @@ bool IMG_CreateWEBPAnimationDecoder(IMG_AnimationDecoder *decoder, SDL_Propertie
bool ignoreProps = SDL_GetBooleanProperty(props, IMG_PROP_METADATA_IGNORE_PROPS_BOOLEAN, false);
if (!ignoreProps) {
// Allow implicit properties to be set which are not globalized but specific to the decoder.
- SDL_SetNumberProperty(decoder->props, "IMG_PROP_METADATA_FRAME_COUNT_NUMBER", lib.WebPDemuxGetI(decoder->ctx->demuxer, WEBP_FF_FRAME_COUNT));
+ SDL_SetNumberProperty(decoder->props, IMG_PROP_METADATA_FRAME_COUNT_NUMBER, lib.WebPDemuxGetI(decoder->ctx->demuxer, WEBP_FF_FRAME_COUNT));
// Set well-defined properties.
SDL_SetNumberProperty(decoder->props, IMG_PROP_METADATA_LOOP_COUNT_NUMBER, lib.WebPDemuxGetI(decoder->ctx->demuxer, WEBP_FF_LOOP_COUNT));