[{"id":3199,"web_url":"https://patchwork.libcamera.org/comment/3199/","msgid":"<20191206215531.GN28879@bigcity.dyn.berto.se>","date":"2019-12-06T21:55:31","subject":"Re: [libcamera-devel] [PATCH v2 04/10] libcamera: controls: Add\n\tdefault to ControlRange","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your patch.\n\nOn 2019-12-05 21:43:44 +0100, Jacopo Mondi wrote:\n> Augment the the ControlRange class to store the control default value.\n> \n> This is particularly relevant for v4l2 controls used to create\n> Camera properties, which are constructed using immutable video device\n> properties, whose value won't change at runtime.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  include/libcamera/controls.h |  5 ++++-\n>  src/libcamera/controls.cpp   | 17 +++++++++++++++--\n>  2 files changed, 19 insertions(+), 3 deletions(-)\n> \n> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\n> index b1b73367e874..458b84e8fa8c 100644\n> --- a/include/libcamera/controls.h\n> +++ b/include/libcamera/controls.h\n> @@ -114,10 +114,12 @@ class ControlRange\n>  {\n>  public:\n>  \texplicit ControlRange(const ControlValue &min = 0,\n> -\t\t\t      const ControlValue &max = 0);\n> +\t\t\t      const ControlValue &max = 0,\n> +\t\t\t      const ControlValue &def = 0);\n>  \n>  \tconst ControlValue &min() const { return min_; }\n>  \tconst ControlValue &max() const { return max_; }\n> +\tconst ControlValue &def() const { return def_; }\n>  \n>  \tstd::string toString() const;\n>  \n> @@ -134,6 +136,7 @@ public:\n>  private:\n>  \tControlValue min_;\n>  \tControlValue max_;\n> +\tControlValue def_;\n>  };\n>  \n>  using ControlIdMap = std::unordered_map<unsigned int, const ControlId *>;\n> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\n> index 7d8a0e97ee3a..1678d3cba4f3 100644\n> --- a/src/libcamera/controls.cpp\n> +++ b/src/libcamera/controls.cpp\n> @@ -353,14 +353,21 @@ Control<int64_t>::Control(unsigned int id, const char *name)\n>   * pipeline handlers to describe the controls they support.\n>   */\n>  \n> +/**\n> + * \\var ControlRange::def_\n> + * \\brief The control default value\n> + */\n> +\n>  /**\n>   * \\brief Construct a ControlRange with minimum and maximum range parameters\n>   * \\param[in] min The control minimum value\n>   * \\param[in] max The control maximum value\n> + * \\param[in] def The control default value\n>   */\n>  ControlRange::ControlRange(const ControlValue &min,\n> -\t\t\t   const ControlValue &max)\n> -\t: min_(min), max_(max)\n> +\t\t\t   const ControlValue &max,\n> +\t\t\t   const ControlValue &def)\n> +\t: min_(min), max_(max), def_(def)\n>  {\n>  }\n>  \n> @@ -376,6 +383,12 @@ ControlRange::ControlRange(const ControlValue &min,\n>   * \\return A ControlValue with the maximum value for the control\n>   */\n>  \n> +/**\n> + * \\fn ControlRange::def()\n> + * \\brief Retrieve the default value of the control\n> + * \\return A ControlValue with the default value for the control\n> + */\n> +\n>  /**\n>   * \\brief Provide a string representation of the ControlRange\n>   */\n> -- \n> 2.23.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x144.google.com (mail-lf1-x144.google.com\n\t[IPv6:2a00:1450:4864:20::144])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DBD8B60BBC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Dec 2019 22:55:32 +0100 (CET)","by mail-lf1-x144.google.com with SMTP id 15so6387715lfr.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 06 Dec 2019 13:55:32 -0800 (PST)","from localhost (h-93-159.A463.priv.bahnhof.se. [46.59.93.159])\n\tby smtp.gmail.com with ESMTPSA id\n\ti2sm2787882lfl.20.2019.12.06.13.55.31\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 06 Dec 2019 13:55:31 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=UNDEyYgFAnxsApvEvK1jkQwfyRseOxzJxAfQuLUL5jQ=;\n\tb=wiv4fLjenSoYnGmnCvt3nRleezlRlrWnHv2dyZgDNgeP1YvuG3idv0yyo/BFwh4CyO\n\tyw4ediQP03ERDru4oE7bYFMgwJrXAvRM85LGfCabgTyJfeK3bdzKtFrUY/8qjdAoKaNB\n\tFd5+Obynswamof+dHuYDKBKiPSH9Ggm5kP9f9wOZLKqtjHsh/xf3PwTgLDJtGouptQig\n\tymHbKphc3VWM5WU8BCCAoBjNHWOzRHMkA+2fpxb8ZWLkeP+PnIJQmYQh0DTYQsk/xcYB\n\t0oQ3wwigv4dEOIPfQlAd4Sq0xdxi5ejAh3JruGGViFvwmFs3/7XPYzkiva7JFbfT+lSV\n\t6zRA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=UNDEyYgFAnxsApvEvK1jkQwfyRseOxzJxAfQuLUL5jQ=;\n\tb=ubP9vKH22b+TUrFnBJRyWq4c/LzARqWCTTEz5ALEyETPPkZ56Qr0EnwpMyKW0S2hWO\n\tTbfN40mAuxq9zf/iQsnXcKty6HkuGKSBy97DEGfeJPQ89Y8R4DepdXo+qEyKjlWQQHdV\n\tDhehhifWxT31AJvlJ7yR1riPefGSxfZ0EEp22fy4x/BnGXrbq5M3gR+FW1+c7FLQTv2Y\n\tqok024W2RDcfQW8OQYxX5zpr+VUo9gqUG5u3wb5tHmfqCDw91BqAqlsfNE8EzdomYbC/\n\tYfDtXRQjlCva4Gox6yl0UEnId+LakW0a4E6dlYm3E+nd22AJ9s2zooCyQv1zG9+B5iph\n\tjrew==","X-Gm-Message-State":"APjAAAXn+Kg21LByyp1XH1vHzrm8qkwOqNqpvxBuKQqDrNJMWLDJe57l\n\tR36wA7ejjd4miA8xi5EAl+r8nA==","X-Google-Smtp-Source":"APXvYqxmVE7/bcn31w3O4Bgs5iBjIld0jyPFLZXiKpNDD2LLqwFnMF7GE1SYWCleV8OhFgX3pAj43w==","X-Received":"by 2002:a19:7502:: with SMTP id y2mr8466993lfe.55.1575669332093; \n\tFri, 06 Dec 2019 13:55:32 -0800 (PST)","Date":"Fri, 6 Dec 2019 22:55:31 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191206215531.GN28879@bigcity.dyn.berto.se>","References":"<20191205204350.28196-1-jacopo@jmondi.org>\n\t<20191205204350.28196-5-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20191205204350.28196-5-jacopo@jmondi.org>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v2 04/10] libcamera: controls: Add\n\tdefault to ControlRange","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 06 Dec 2019 21:55:33 -0000"}}]