SDL: camera: Public API functions should say "Format" not "Spec" to match audio.

From 87e7046fcaa281119df25df8e5b63af398a6ed98 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sat, 16 Dec 2023 16:12:19 -0500
Subject: [PATCH] camera: Public API functions should say "Format" not "Spec"
 to match audio.

---
 include/SDL3/SDL_camera.h         | 10 +++++-----
 src/camera/SDL_camera.c           |  4 ++--
 src/camera/v4l2/SDL_camera_v4l2.c | 12 ++++++------
 src/dynapi/SDL_dynapi.sym         |  4 ++--
 src/dynapi/SDL_dynapi_overrides.h |  4 ++--
 src/dynapi/SDL_dynapi_procs.h     |  4 ++--
 test/testcamera.c                 |  2 +-
 test/testcameraminimal.c          |  2 +-
 8 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/include/SDL3/SDL_camera.h b/include/SDL3/SDL_camera.h
index eb6a9f2d8295..d31e04550826 100644
--- a/include/SDL3/SDL_camera.h
+++ b/include/SDL3/SDL_camera.h
@@ -57,8 +57,8 @@ typedef struct SDL_Camera SDL_Camera;
 /**
  *  SDL_CameraSpec structure
  *
- * \sa SDL_GetCameraDeviceSupportedSpecs
- * \sa SDL_GetCameraSpec
+ * \sa SDL_GetCameraDeviceSupportedFormats
+ * \sa SDL_GetCameraFormat
  *
  */
 typedef struct SDL_CameraSpec
@@ -182,7 +182,7 @@ extern DECLSPEC SDL_CameraDeviceID *SDLCALL SDL_GetCameraDevices(int *count);
  * \sa SDL_GetCameraDevices
  * \sa SDL_OpenCameraDevice
  */
-extern DECLSPEC SDL_CameraSpec *SDLCALL SDL_GetCameraDeviceSupportedSpecs(SDL_CameraDeviceID devid, int *count);
+extern DECLSPEC SDL_CameraSpec *SDLCALL SDL_GetCameraDeviceSupportedFormats(SDL_CameraDeviceID devid, int *count);
 
 /**
  * Get human-readable device name for a camera.
@@ -212,7 +212,7 @@ extern DECLSPEC char * SDLCALL SDL_GetCameraDeviceName(SDL_CameraDeviceID instan
  * pass a NULL spec here and it will choose one for you (and you can use
  * SDL_Surface's conversion/scaling functions directly if necessary).
  *
- * You can call SDL_GetCameraSpec() to get the actual data format if
+ * You can call SDL_GetCameraFormat() to get the actual data format if
  * passing a NULL spec here. You can see the exact specs a device can
  * support without conversion with SDL_GetCameraSupportedSpecs().
  *
@@ -279,7 +279,7 @@ extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera *cam
  *
  * \sa SDL_OpenCameraDevice
  */
-extern DECLSPEC int SDLCALL SDL_GetCameraSpec(SDL_Camera *camera, SDL_CameraSpec *spec);
+extern DECLSPEC int SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec);
 
 /**
  * Acquire a frame.
diff --git a/src/camera/SDL_camera.c b/src/camera/SDL_camera.c
index 6cbd453628b0..18efa3f282e7 100644
--- a/src/camera/SDL_camera.c
+++ b/src/camera/SDL_camera.c
@@ -407,7 +407,7 @@ void SDL_CloseCamera(SDL_Camera *camera)
     ClosePhysicalCameraDevice(device);
 }
 
-int SDL_GetCameraSpec(SDL_Camera *camera, SDL_CameraSpec *spec)
+int SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec)
 {
     if (!camera) {
         return SDL_InvalidParamError("camera");
@@ -469,7 +469,7 @@ SDL_CameraDeviceID *SDL_GetCameraDevices(int *count)
 
 }
 
-SDL_CameraSpec *SDL_GetCameraDeviceSupportedSpecs(SDL_CameraDeviceID instance_id, int *count)
+SDL_CameraSpec *SDL_GetCameraDeviceSupportedFormats(SDL_CameraDeviceID instance_id, int *count)
 {
     if (count) {
         *count = 0;
diff --git a/src/camera/v4l2/SDL_camera_v4l2.c b/src/camera/v4l2/SDL_camera_v4l2.c
index c43762a466b3..7b68378fd442 100644
--- a/src/camera/v4l2/SDL_camera_v4l2.c
+++ b/src/camera/v4l2/SDL_camera_v4l2.c
@@ -611,14 +611,14 @@ static SDL_bool FindV4L2CameraDeviceByBusInfoCallback(SDL_CameraDevice *device,
     return (SDL_strcmp(handle->bus_info, (const char *) userdata) == 0);
 }
 
-typedef struct SpecAddData
+typedef struct FormatAddData
 {
     SDL_CameraSpec *specs;
     int num_specs;
     int allocated_specs;
-} SpecAddData;
+} FormatAddData;
 
-static int AddCameraSpec(SpecAddData *data, Uint32 fmt, int w, int h)
+static int AddCameraFormat(FormatAddData *data, Uint32 fmt, int w, int h)
 {
     SDL_assert(data != NULL);
     if (data->allocated_specs <= data->num_specs) {
@@ -676,7 +676,7 @@ static void MaybeAddDevice(const char *path)
     SDL_Log("CAMERA: V4L2 camera path='%s' bus_info='%s' name='%s'", path, (const char *) vcap.bus_info, vcap.card);
     #endif
 
-    SpecAddData add_data;
+    FormatAddData add_data;
     SDL_zero(add_data);
 
     struct v4l2_fmtdesc fmtdesc;
@@ -709,7 +709,7 @@ static void MaybeAddDevice(const char *path)
                 #if DEBUG_CAMERA
                 SDL_Log("CAMERA:     * Has discrete size %dx%d", w, h);
                 #endif
-                if (AddCameraSpec(&add_data, sdlfmt, w, h) == -1) {
+                if (AddCameraFormat(&add_data, sdlfmt, w, h) == -1) {
                     break;  // Probably out of memory; we'll go with what we have, if anything.
                 }
                 frmsizeenum.index++;  // set up for the next one.
@@ -725,7 +725,7 @@ static void MaybeAddDevice(const char *path)
                         #if DEBUG_CAMERA
                         SDL_Log("CAMERA:     * Has %s size %dx%d", (frmsizeenum.type == V4L2_FRMSIZE_TYPE_STEPWISE) ? "stepwise" : "continuous", w, h);
                         #endif
-                        if (AddCameraSpec(&add_data, sdlfmt, w, h) == -1) {
+                        if (AddCameraFormat(&add_data, sdlfmt, w, h) == -1) {
                             break;  // Probably out of memory; we'll go with what we have, if anything.
                         }
 
diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym
index 9943d9d0f8f6..a098f270972d 100644
--- a/src/dynapi/SDL_dynapi.sym
+++ b/src/dynapi/SDL_dynapi.sym
@@ -961,12 +961,12 @@ SDL3_0.0.0 {
     SDL_GetCameraDriver;
     SDL_GetCurrentCameraDriver;
     SDL_GetCameraDevices;
-    SDL_GetCameraDeviceSupportedSpecs;
+    SDL_GetCameraDeviceSupportedFormats;
     SDL_GetCameraDeviceName;
     SDL_OpenCameraDevice;
     SDL_GetCameraInstanceID;
     SDL_GetCameraProperties;
-    SDL_GetCameraSpec;
+    SDL_GetCameraFormat;
     SDL_AcquireCameraFrame;
     SDL_ReleaseCameraFrame;
     SDL_CloseCamera;
diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index e7f050c0358f..db16355d7927 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -986,12 +986,12 @@
 #define SDL_GetCameraDriver SDL_GetCameraDriver_REAL
 #define SDL_GetCurrentCameraDriver SDL_GetCurrentCameraDriver_REAL
 #define SDL_GetCameraDevices SDL_GetCameraDevices_REAL
-#define SDL_GetCameraDeviceSupportedSpecs SDL_GetCameraDeviceSupportedSpecs_REAL
+#define SDL_GetCameraDeviceSupportedFormats SDL_GetCameraDeviceSupportedFormats_REAL
 #define SDL_GetCameraDeviceName SDL_GetCameraDeviceName_REAL
 #define SDL_OpenCameraDevice SDL_OpenCameraDevice_REAL
 #define SDL_GetCameraInstanceID SDL_GetCameraInstanceID_REAL
 #define SDL_GetCameraProperties SDL_GetCameraProperties_REAL
-#define SDL_GetCameraSpec SDL_GetCameraSpec_REAL
+#define SDL_GetCameraFormat SDL_GetCameraFormat_REAL
 #define SDL_AcquireCameraFrame SDL_AcquireCameraFrame_REAL
 #define SDL_ReleaseCameraFrame SDL_ReleaseCameraFrame_REAL
 #define SDL_CloseCamera SDL_CloseCamera_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index 9f1f735891d9..49d5e1a7532c 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -1011,12 +1011,12 @@ SDL_DYNAPI_PROC(int,SDL_GetNumCameraDrivers,(void),(),return)
 SDL_DYNAPI_PROC(const char*,SDL_GetCameraDriver,(int a),(a),return)
 SDL_DYNAPI_PROC(const char*,SDL_GetCurrentCameraDriver,(void),(),return)
 SDL_DYNAPI_PROC(SDL_CameraDeviceID*,SDL_GetCameraDevices,(int *a),(a),return)
-SDL_DYNAPI_PROC(SDL_CameraSpec*,SDL_GetCameraDeviceSupportedSpecs,(SDL_CameraDeviceID a, int *b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_CameraSpec*,SDL_GetCameraDeviceSupportedFormats,(SDL_CameraDeviceID a, int *b),(a,b),return)
 SDL_DYNAPI_PROC(char*,SDL_GetCameraDeviceName,(SDL_CameraDeviceID a),(a),return)
 SDL_DYNAPI_PROC(SDL_Camera*,SDL_OpenCameraDevice,(SDL_CameraDeviceID a, const SDL_CameraSpec *b),(a,b),return)
 SDL_DYNAPI_PROC(SDL_CameraDeviceID,SDL_GetCameraInstanceID,(SDL_Camera *a),(a),return)
 SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetCameraProperties,(SDL_Camera *a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_GetCameraSpec,(SDL_Camera *a, SDL_CameraSpec *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetCameraFormat,(SDL_Camera *a, SDL_CameraSpec *b),(a,b),return)
 SDL_DYNAPI_PROC(SDL_Surface*,SDL_AcquireCameraFrame,(SDL_Camera *a, Uint64 *b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_ReleaseCameraFrame,(SDL_Camera *a, SDL_Surface *b),(a,b),return)
 SDL_DYNAPI_PROC(void,SDL_CloseCamera,(SDL_Camera *a),(a),)
diff --git a/test/testcamera.c b/test/testcamera.c
index c524a13fae46..e5389d218fc2 100644
--- a/test/testcamera.c
+++ b/test/testcamera.c
@@ -284,7 +284,7 @@ int main(int argc, char **argv)
 
     {
         SDL_CameraSpec spec;
-        if (SDL_GetCameraSpec(device, &spec) == 0) {
+        if (SDL_GetCameraFormat(device, &spec) == 0) {
             SDL_Log("Read spec: size=%d x %d format=%s",
                     spec.width, spec.height, SDL_GetPixelFormatName(spec.format));
         } else {
diff --git a/test/testcameraminimal.c b/test/testcameraminimal.c
index 57ce1830da6f..df8a08b17585 100644
--- a/test/testcameraminimal.c
+++ b/test/testcameraminimal.c
@@ -94,7 +94,7 @@ int main(int argc, char **argv)
         return 1;
     }
 
-   if (SDL_GetCameraSpec(camera, &spec) < 0) {
+   if (SDL_GetCameraFormat(camera, &spec) < 0) {
         SDL_Log("Couldn't get camera spec: %s", SDL_GetError());
         return 1;
     }