mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-21 14:55:39 +00:00
SDL_GetCameraSupportedFormats() follows the SDL_GetStringRule
Also changed the function to return an array of pointers and added example usage to testcamera
This commit is contained in:
@@ -26,6 +26,20 @@ static SDL_Surface *frame_current = NULL;
|
||||
static SDL_CameraID front_camera = 0;
|
||||
static SDL_CameraID back_camera = 0;
|
||||
|
||||
static void PrintCameraSpecs(SDL_CameraID camera_id)
|
||||
{
|
||||
const SDL_CameraSpec *const *specs = SDL_GetCameraSupportedFormats(camera_id, NULL);
|
||||
if (specs) {
|
||||
int i;
|
||||
|
||||
SDL_Log("Available formats:\n");
|
||||
for (i = 0; specs[i]; ++i) {
|
||||
const SDL_CameraSpec *s = specs[i];
|
||||
SDL_Log(" %dx%d %.2f FPS %s\n", s->width, s->height, (float)s->framerate_numerator / s->framerate_denominator, SDL_GetPixelFormatName(s->format));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||
{
|
||||
char window_title[128];
|
||||
@@ -133,6 +147,8 @@ int SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||
return SDL_APP_FAILURE;
|
||||
}
|
||||
|
||||
PrintCameraSpecs(camera_id);
|
||||
|
||||
SDL_CameraSpec *pspec = &spec;
|
||||
spec.framerate_numerator = 1000;
|
||||
spec.framerate_denominator = 1;
|
||||
|
||||
Reference in New Issue
Block a user