logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_GetCameraSupportedFormats - Get the list of native formats/sizes a camera supports.

Availability

       This function is available since SDL 3.2.0.

Description

       This  returns  a  list of all formats and frame sizes that a specific camera can offer. This is useful if
       your app can accept a variety of image formats and sizes and so  want  to  find  the  optimal  spec  that
       doesn't require conversion.

       This function isn't strictly required; if you call

       SDL_OpenCamera
        with  a NULL spec, SDL will choose a native format for you, and if you instead specify a desired format,
       it will transparently convert to the requested format on your behalf.

       If count is not NULL, it will be filled with the number of elements in the returned array.

       Note that it's legal for a camera to supply an empty list. This is what will happen on Emscripten builds,
       since that platform won't tell _anything_ about available cameras until you've opened one, and won't even
       tell if there _is_ a camera until the user has given you permission to  check  through  a  scary  warning
       popup.

Function Parameters

instance_id
              the camera device instance ID.

       count  a pointer filled in with the number of elements in the list, may be NULL.

Header File

       Defined in SDL3/SDL_camera.h

Name

       SDL_GetCameraSupportedFormats - Get the list of native formats/sizes a camera supports.

Return Value

       ( SDL_CameraSpec)ReturnsaNULLterminatedarrayof pointers to SDL_CameraSpec
        or NULL on failure; call

       SDL_GetError  ()  for more information. This is a single allocation that should be freed with SDL_free ()
       when it is no longer needed.

See Also

(3), SDL_GetCameras(3), (3), SDL_OpenCamera(3)

Simple Directmedia Layer                           SDL 3.2.10                   SDL_GetCameraSupportedFormats(3)

Synopsis

#include"SDL3/SDL.h"SDL_CameraSpec**SDL_GetCameraSupportedFormats(SDL_CameraIDinstance_id,int*count);

Thread Safety

       It is safe to call this function from any thread.

See Also