diff --git a/config/purism,librem5.conf b/config/purism,librem5.conf index 2d8bb43..86e7006 100644 --- a/config/purism,librem5.conf +++ b/config/purism,librem5.conf @@ -13,11 +13,11 @@ Rear: { Rate: 15; Format: "GRBG8"; Rotate: 270; + Transfer: "srgb"; # All the links on this platform are immutable Pipeline: ( {Type: "Mode", Entity: "s5k3l6xx"}, - {Type: "Rate", Entity: "s5k3l6xx"}, {Type: "Mode", Entity: "imx8mq-mipi-csi2"}, {Type: "Mode", Entity: "csi"}, ); @@ -28,9 +28,10 @@ Rear: { Rate: 30; Format: "GRBG8"; Rotate: 270; + Transfer: "srgb"; + Pipeline: ( {Type: "Mode", Entity: "s5k3l6xx"}, - {Type: "Rate", Entity: "s5k3l6xx"}, {Type: "Mode", Entity: "imx8mq-mipi-csi2"}, {Type: "Mode", Entity: "csi"}, ); diff --git a/include/libmegapixels.h b/include/libmegapixels.h index 63eb5ef..8b3432f 100644 --- a/include/libmegapixels.h +++ b/include/libmegapixels.h @@ -21,6 +21,9 @@ libmegapixels_find_config(char *configfile); #define LIBMEGAPIXELS_CFA_GRBG 3 #define LIBMEGAPIXELS_CFA_RGGB 4 +#define LIBMEGAPIXELS_XFER_RAW 0; +#define LIBMEGAPIXELS_XFER_SRGB 8; + struct _lmp_cmd { int type; const char *entity_from; @@ -48,6 +51,7 @@ struct _lmp_mode { int format; int rotation; int mirrored; + int xfer; double focal_length; double f_number; diff --git a/src/parse.c b/src/parse.c index 63ea680..d072221 100644 --- a/src/parse.c +++ b/src/parse.c @@ -249,6 +249,17 @@ load_camera(libmegapixels_devconfig *config, config_t *cfg, const char *name) mm->v4l_pixfmt = libmegapixels_format_to_v4l_pixfmt(mm->format); mm->media_busfmt = libmegapixels_format_to_media_busfmt(mm->format); + const char *xfer; + if (config_setting_lookup_string(mode, "Transfer", &xfer)) { + if (strcmp(xfer, "srgb") == 0) { + mm->xfer = LIBMEGAPIXELS_XFER_SRGB; + } else { + mm->xfer = LIBMEGAPIXELS_XFER_RAW; + } + } else { + mm->xfer = LIBMEGAPIXELS_XFER_RAW; + } + if (!config_setting_lookup_int(mode, "Rotate", &mm->rotation)) { mm->rotation = 0; }