Fix format parsing

This commit is contained in:
Martijn Braam
2023-07-12 13:59:51 +02:00
parent 72032906ba
commit 9c1e758053

View File

@@ -241,13 +241,13 @@ load_camera(libmegapixels_devconfig *config, config_t *cfg, const char *name)
const char *fmt;
config_setting_lookup_string(mode, "Format", &fmt);
int format = libmegapixels_format_name_to_index(fmt);
if (!format) {
mm->format = libmegapixels_format_name_to_index(fmt);
if (!mm->format) {
log_error("Unknown format '%s'\n", fmt);
return -1;
}
mm->v4l_pixfmt = libmegapixels_format_to_v4l_pixfmt(format);
mm->media_busfmt = libmegapixels_format_to_media_busfmt(format);
mm->v4l_pixfmt = libmegapixels_format_to_v4l_pixfmt(mm->format);
mm->media_busfmt = libmegapixels_format_to_media_busfmt(mm->format);
if (!config_setting_lookup_int(mode, "Rotate", &mm->rotation)) {
mm->rotation = 0;