oops, refactoring that out of AppInit needed an early return
This commit is contained in:
parent
e93e222c52
commit
a687f0bed0
1 changed files with 6 additions and 0 deletions
6
main.c
6
main.c
|
@ -172,6 +172,7 @@ bool SelectCamera(struct AppState* st) {
|
||||||
SDL_RenderDebugText(renderer, 4, 4, "connect a camera");
|
SDL_RenderDebugText(renderer, 4, 4, "connect a camera");
|
||||||
|
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SDL_CameraID device = devices[st->cam_idx];
|
const SDL_CameraID device = devices[st->cam_idx];
|
||||||
|
@ -185,6 +186,11 @@ bool SelectCamera(struct AppState* st) {
|
||||||
int formats_len = 0;
|
int formats_len = 0;
|
||||||
|
|
||||||
SDL_CameraSpec** formats = SDL_GetCameraSupportedFormats(device, &formats_len);
|
SDL_CameraSpec** formats = SDL_GetCameraSupportedFormats(device, &formats_len);
|
||||||
|
if (!formats) {
|
||||||
|
SDL_Log("SDL_GetCameraSupportedFormats failed: %s", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (st->spec_idx >= formats_len) {
|
if (st->spec_idx >= formats_len) {
|
||||||
st->spec_idx = 0;
|
st->spec_idx = 0;
|
||||||
} else if (st->spec_idx < 0) {
|
} else if (st->spec_idx < 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue