From 9a38078c728de413cf02ecb0857c89c471e3a2b7 Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Tue, 5 Mar 2019 10:47:43 +0300 Subject: [PATCH] Added backlight_compensation, white_balance and gain --- src/device.c | 15 +++++++++------ src/device.h | 3 +++ src/main.c | 31 +++++++++++++++++++++++-------- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/device.c b/src/device.c index 5ef620c..0f48cd0 100644 --- a/src/device.c +++ b/src/device.c @@ -383,12 +383,15 @@ static void _device_open_set_image_settings(struct device_t *dev) { } \ } - SET_CID_AUTO (V4L2_CID_AUTOBRIGHTNESS, V4L2_CID_BRIGHTNESS, brightness); - SET_CID_MANUAL ( V4L2_CID_CONTRAST, contrast); - SET_CID_MANUAL ( V4L2_CID_SATURATION, saturation); - SET_CID_AUTO (V4L2_CID_HUE_AUTO, V4L2_CID_HUE, hue); - SET_CID_MANUAL ( V4L2_CID_GAMMA, gamma); - SET_CID_MANUAL ( V4L2_CID_SHARPNESS, sharpness); + SET_CID_AUTO (V4L2_CID_AUTOBRIGHTNESS, V4L2_CID_BRIGHTNESS, brightness); + SET_CID_MANUAL ( V4L2_CID_CONTRAST, contrast); + SET_CID_MANUAL ( V4L2_CID_SATURATION, saturation); + SET_CID_AUTO (V4L2_CID_HUE_AUTO, V4L2_CID_HUE, hue); + SET_CID_MANUAL ( V4L2_CID_GAMMA, gamma); + SET_CID_MANUAL ( V4L2_CID_SHARPNESS, sharpness); + SET_CID_MANUAL ( V4L2_CID_BACKLIGHT_COMPENSATION, backlight_compensation); + SET_CID_AUTO (V4L2_CID_AUTO_WHITE_BALANCE, V4L2_CID_WHITE_BALANCE_TEMPERATURE, white_balance); + SET_CID_AUTO (V4L2_CID_AUTOGAIN, V4L2_CID_GAIN, gain); # undef SET_CID_AUTO # undef SET_CID_MANUAL diff --git a/src/device.h b/src/device.h index cc6e007..d6742df 100644 --- a/src/device.h +++ b/src/device.h @@ -79,6 +79,9 @@ struct image_settings_t { S_AUTO (hue); S_MANUAL (gamma); S_MANUAL (sharpness); + S_MANUAL (backlight_compensation); + S_AUTO (white_balance); + S_AUTO (gain); }; #undef S_AUTO diff --git a/src/main.c b/src/main.c index 43a4e18..758aa50 100644 --- a/src/main.c +++ b/src/main.c @@ -68,6 +68,11 @@ static const struct option _long_opts[] = { {"image-hue-auto", no_argument, NULL, 2005}, {"image-gamma", required_argument, NULL, 2006}, {"image-sharpness", required_argument, NULL, 2007}, + {"image-backlight-compensation", required_argument, NULL, 2008}, + {"image-white-balance", required_argument, NULL, 2009}, + {"image-white-balance-auto", no_argument, NULL, 2010}, + {"image-gain", required_argument, NULL, 2011}, + {"image-gain-auto", no_argument, NULL, 2012}, {"host", required_argument, NULL, 's'}, {"port", required_argument, NULL, 'p'}, @@ -133,14 +138,19 @@ static void _help(struct device_t *dev, struct encoder_t *encoder, struct http_s printf(" after a timeout. Default: %u\n\n", dev->error_delay); printf("Image options:\n"); printf("---------------\n"); - printf(" --image-brightness -- Set brightness. Default: no change.\n\n"); - printf(" --image-brightness-auto -- Enable automatic brightness control. Default: no change.\n\n"); - printf(" --image-contrast -- Set contrast. Default: no change.\n\n"); - printf(" --image-saturation -- Set saturation. Default: no change.\n\n"); - printf(" --image-hue -- Set hue. Default: no change.\n\n"); - printf(" --image-hue-auto -- Enable automatic hue control. Default: no change.\n\n"); - printf(" --image-gamma -- Set gamma. Default: no change.\n\n"); - printf(" --image-sharpness -- Set sharpness. Default: no change.\n\n"); + printf(" --image-brightness -- Set brightness. Default: no change.\n\n"); + printf(" --image-brightness-auto -- Enable automatic brightness control. Default: no change.\n\n"); + printf(" --image-contrast -- Set contrast. Default: no change.\n\n"); + printf(" --image-saturation -- Set saturation. Default: no change.\n\n"); + printf(" --image-hue -- Set hue. Default: no change.\n\n"); + printf(" --image-hue-auto -- Enable automatic hue control. Default: no change.\n\n"); + printf(" --image-gamma -- Set gamma. Default: no change.\n\n"); + printf(" --image-sharpness -- Set sharpness. Default: no change.\n\n"); + printf(" --image-backlight-compensation -- Set backlight compensation. Default: no change.\n\n"); + printf(" --image-white-combalance -- Set white balance. Default: no change.\n\n"); + printf(" --image-white-combalance-auto -- Enable automatic white balance control. Default: no change.\n\n"); + printf(" --image-gain -- Set gain. Default: no change.\n\n"); + printf(" --image-gain-auto -- Enable automatic gain control. Default: no change.\n\n"); printf("HTTP server options:\n"); printf("--------------------\n"); printf(" -s|--host
-- Listen on Hostname or IP. Default: %s\n\n", server->host); @@ -241,6 +251,11 @@ static int _parse_options(int argc, char *argv[], struct device_t *dev, struct e case 2005: OPT_IMG_AUTO(hue); case 2006: OPT_IMG(gamma); case 2007: OPT_IMG(sharpness); + case 2008: OPT_IMG(backlight_compensation); + case 2009: OPT_IMG(white_balance); + case 2010: OPT_IMG_AUTO(white_balance); + case 2011: OPT_IMG(gain); + case 2012: OPT_IMG_AUTO(gain); case 's': OPT_SET(server->host, optarg); case 'p': OPT_UNSIGNED(server->port, "--port", 1, 65535);