SDL_GetCameras(3)
π SDL_GetCameras π
okay bestie, so this is a page from the SDL3 FUNCTIONS manual β the whole thing lives in the Simple Directmedia Layer docs, and it's all about cameras. Let's get into it π
β¨ NAME β¨
SDL_GetCameras β get a list of currently connected camera devices ππ·
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_camera.h>
SDL_CameraID * SDL_GetCameras(int *count);
π¦ FUNCTION PARAMETERS π¦
countβ a pointer that gets filled in with the number of cameras that were returned. and listen, it's totally fine if this isNULL, no pressure π
π RETURN VALUE π
So what do you get back? Either:
- a 0 terminated array of camera instance IDs, slay β¨ β the array ends with a zero, that's how you know it's done
- or
NULLif it failed π in which case you gotta callSDL_GetError()for more info, she'll tell you what went wrong
and when you're done with that array, free it with SDL_free(). don't just leave it lying around, that's not the vibe. free your stuff, periodt π«Ά
π§ THREAD SAFETY π§
It is safe to call this function from any thread. no cap. every thread, all at once, she doesn't care π
β AVAILABILITY β
This function has been available since SDL 3.2.0 β so if you're on something older... babe. upgrade π
π SEE ALSO π
SDL_OpenCamera(3)β like, obviously, you get the list and then you open one π
and that's the whole page!! mwah π this one shipped as part of Simple Directmedia Layer, SDL 3.4.18, dated the same β so go forth, enumerate your webcams, and stay iconic ππ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms