---
name: "SDL_GetCameraSupportedFormats"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_GetCameraSupportedFormats"
---

# SDL\_GetCameraSupportedFormats(3)

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

## NAME

SDL\_GetCameraSupportedFormats - Get the list of native formats/sizes a camera supports.

## HEADER FILE

Defined in SDL3/SDL\_camera.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**SDL\_CameraSpec \*\* SDL\_GetCameraSupportedFormats(SDL\_CameraID instance\_id, int \*count);**

## 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.

## RETURN VALUE

( **SDL\_CameraSpec** *) Returns a NULL terminated array of* 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.

## THREAD SAFETY

It is safe to call this function from any thread.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_GetCameras**(3)](/SDL_GetCameras/3.md), **•**(3), [**SDL\_OpenCamera**(3)](/SDL_OpenCamera/3.md)
