sdlGetCameraFormat function

bool sdlGetCameraFormat(
  1. Pointer<SdlCamera> camera,
  2. Pointer<SdlCameraSpec> spec
)

Get the spec that a camera is using when generating images.

Note that this might not be the native format of the hardware, as SDL might be converting to this format behind the scenes.

If the system is waiting for the user to approve access to the camera, as some platforms require, this will return false, but this isn't necessarily a fatal error; you should either wait for an SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event, or poll SDL_GetCameraPermissionState() occasionally until it returns non-zero.

\param camera opened camera device. \param spec the SDL_CameraSpec to be initialized by this function. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

\sa SDL_OpenCamera

extern SDL_DECLSPEC bool SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec)

Implementation

bool sdlGetCameraFormat(
    Pointer<SdlCamera> camera, Pointer<SdlCameraSpec> spec) {
  final sdlGetCameraFormatLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlCamera> camera, Pointer<SdlCameraSpec> spec),
      int Function(Pointer<SdlCamera> camera,
          Pointer<SdlCameraSpec> spec)>('SDL_GetCameraFormat');
  return sdlGetCameraFormatLookupFunction(camera, spec) == 1;
}