[{"id":2755,"web_url":"https://patchwork.libcamera.org/comment/2755/","msgid":"<20191003193456.GJ1322@bigcity.dyn.berto.se>","date":"2019-10-03T19:34:56","subject":"Re: [libcamera-devel] [PATCH v2 07/13] libcamera: controls: Remove\n\tControlInfo::id","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your work.\n\nOn 2019-09-29 22:02:48 +0300, Laurent Pinchart wrote:\n> The ControlInfo id member is only used in the toString() method of the\n> class, and nowhere else externally. The same way that ControlValue\n> doesn't store a ControlId, ControlInfo shouldn't. Remove it.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  include/libcamera/controls.h        |  4 +---\n>  src/libcamera/controls.cpp          | 13 +++----------\n>  src/libcamera/pipeline/uvcvideo.cpp |  2 +-\n>  src/libcamera/pipeline/vimc.cpp     |  2 +-\n>  test/controls/control_info.cpp      | 18 ++----------------\n>  5 files changed, 8 insertions(+), 31 deletions(-)\n> \n> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\n> index d4a74ada1b6a..854ea3b84267 100644\n> --- a/include/libcamera/controls.h\n> +++ b/include/libcamera/controls.h\n> @@ -98,17 +98,15 @@ private:\n>  class ControlInfo\n>  {\n>  public:\n> -\texplicit ControlInfo(const ControlId &id, const ControlValue &min = 0,\n> +\texplicit ControlInfo(const ControlValue &min = 0,\n>  \t\t\t     const ControlValue &max = 0);\n>  \n> -\tconst ControlId &id() const { return id_; }\n>  \tconst ControlValue &min() const { return min_; }\n>  \tconst ControlValue &max() const { return max_; }\n>  \n>  \tstd::string toString() const;\n>  \n>  private:\n> -\tconst ControlId &id_;\n>  \tControlValue min_;\n>  \tControlValue max_;\n>  };\n> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\n> index 5e8b3a9b5184..526b7755b390 100644\n> --- a/src/libcamera/controls.cpp\n> +++ b/src/libcamera/controls.cpp\n> @@ -323,22 +323,15 @@ Control<int64_t>::Control(unsigned int id, const char *name)\n>  \n>  /**\n>   * \\brief Construct a ControlInfo with minimum and maximum range parameters\n> - * \\param[in] id The control ID\n>   * \\param[in] min The control minimum value\n>   * \\param[in] max The control maximum value\n>   */\n> -ControlInfo::ControlInfo(const ControlId &id, const ControlValue &min,\n> +ControlInfo::ControlInfo(const ControlValue &min,\n>  \t\t\t const ControlValue &max)\n> -\t: id_(id), min_(min), max_(max)\n> +\t: min_(min), max_(max)\n>  {\n>  }\n>  \n> -/**\n> - * \\fn ControlInfo::id()\n> - * \\brief Retrieve the control ID\n> - * \\return The control ID\n> - */\n> -\n>  /**\n>   * \\fn ControlInfo::min()\n>   * \\brief Retrieve the minimum value of the control\n> @@ -358,7 +351,7 @@ std::string ControlInfo::toString() const\n>  {\n>  \tstd::stringstream ss;\n>  \n> -\tss << id_.name() << \"[\" << min_.toString() << \"..\" << max_.toString() << \"]\";\n> +\tss << \"[\" << min_.toString() << \"..\" << max_.toString() << \"]\";\n>  \n>  \treturn ss.str();\n>  }\n> diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\n> index d5d30932870a..2ac582d77801 100644\n> --- a/src/libcamera/pipeline/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo.cpp\n> @@ -364,7 +364,7 @@ int UVCCameraData::init(MediaEntity *entity)\n>  \n>  \t\tcontrolInfo_.emplace(std::piecewise_construct,\n>  \t\t\t\t     std::forward_as_tuple(id),\n> -\t\t\t\t     std::forward_as_tuple(*id, info.min(), info.max()));\n> +\t\t\t\t     std::forward_as_tuple(info.min(), info.max()));\n>  \t}\n>  \n>  \treturn 0;\n> diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\n> index 608a47aecf76..ec9c1cd2d484 100644\n> --- a/src/libcamera/pipeline/vimc.cpp\n> +++ b/src/libcamera/pipeline/vimc.cpp\n> @@ -437,7 +437,7 @@ int VimcCameraData::init(MediaDevice *media)\n>  \n>  \t\tcontrolInfo_.emplace(std::piecewise_construct,\n>  \t\t\t\t     std::forward_as_tuple(id),\n> -\t\t\t\t     std::forward_as_tuple(*id, info.min(), info.max()));\n> +\t\t\t\t     std::forward_as_tuple(info.min(), info.max()));\n>  \t}\n>  \n>  \treturn 0;\n> diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp\n> index dbc43df8e3d3..9cf59185e459 100644\n> --- a/test/controls/control_info.cpp\n> +++ b/test/controls/control_info.cpp\n> @@ -24,14 +24,7 @@ protected:\n>  \t\t * Test information retrieval from a control with no minimum\n>  \t\t * and maximum.\n>  \t\t */\n> -\t\tControlInfo brightness(controls::Brightness);\n> -\n> -\t\tif (brightness.id() != controls::Brightness ||\n> -\t\t    brightness.id().type() != ControlTypeInteger32 ||\n> -\t\t    brightness.id().name() != std::string(\"Brightness\")) {\n> -\t\t\tcout << \"Invalid control identification for Brightness\" << endl;\n> -\t\t\treturn TestFail;\n> -\t\t}\n> +\t\tControlInfo brightness;\n>  \n>  \t\tif (brightness.min().get<int32_t>() != 0 ||\n>  \t\t    brightness.max().get<int32_t>() != 0) {\n> @@ -43,14 +36,7 @@ protected:\n>  \t\t * Test information retrieval from a control with a minimum and\n>  \t\t * a maximum value.\n>  \t\t */\n> -\t\tControlInfo contrast(controls::Contrast, 10, 200);\n> -\n> -\t\tif (contrast.id() != controls::Contrast ||\n> -\t\t    contrast.id().type() != ControlTypeInteger32 ||\n> -\t\t    contrast.id().name() != std::string(\"Contrast\")) {\n> -\t\t\tcout << \"Invalid control identification for Contrast\" << endl;\n> -\t\t\treturn TestFail;\n> -\t\t}\n> +\t\tControlInfo contrast(10, 200);\n>  \n>  \t\tif (contrast.min().get<int32_t>() != 10 ||\n>  \t\t    contrast.max().get<int32_t>() != 200) {\n> -- \n> Regards,\n> \n> Laurent Pinchart\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-lj1-x244.google.com (mail-lj1-x244.google.com\n\t[IPv6:2a00:1450:4864:20::244])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7081E60BE8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  3 Oct 2019 21:34:58 +0200 (CEST)","by mail-lj1-x244.google.com with SMTP id v24so4067144ljj.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 03 Oct 2019 12:34:58 -0700 (PDT)","from localhost (h-93-159.A463.priv.bahnhof.se. [46.59.93.159])\n\tby smtp.gmail.com with ESMTPSA id\n\tt8sm920935ljd.18.2019.10.03.12.34.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 03 Oct 2019 12:34:57 -0700 (PDT)"],"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=tQiCV4CMenV8cqzNe+f8VqyAUyXVLSBoeE9edmhyyB0=;\n\tb=vy5hymiUMRbGjqk4gTKfM6zfg/tzgM3XIBzbSE579hkGvawCLREWIJc7Cfx40JpQ9K\n\tHhdnp237J72P5R8DRwadwr5pOryp7TFL6B2fE0IXy2etpV7jpqXhdL/9QTJZEsJMnm9H\n\tU5YYit1I0cv8sRMWzw4X75oWaJyRsG3yO9Dwk6eXYSvhLSaNbnE4fth97nAjJuQP4S3+\n\tbuR2XPEglnl0J1+IAdNifnH2XKXhgw9U5T970og4wlfDowb3s7lgrJ6Y6jtMqWVA9dJB\n\t+tHsMc5czOZtaOizq+Fi+uMgtjTmZ9toXKyRB/dhCPIb/+GA9NawqRCNvnZYRjSOztZK\n\t6+4g==","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=tQiCV4CMenV8cqzNe+f8VqyAUyXVLSBoeE9edmhyyB0=;\n\tb=KFIEYi/3Yo4z8WWVEDzNo4qTLQb6e4VIrR1fsO4jxD51MHF/MDrmHEBydUxv7W5Bsd\n\thHLcDXOsaQiFRY31JDtSSIOxRNDriICeM/m2RKEc6jyp+MjQ/KusZicW9F15gWQSZLR3\n\tE3s/RFE15EFsajnWyNeLFKKNRvBxYiEvrTJZ8x41SgvYbYlFaxLXLBeXLHbnPnfkfbjs\n\t6NX8a0qh9vEVWwYmiVW8wUKeNd9YEzIwZP1Zbrlqq4tqVw3jZXFzbS9baRuNzmq8TQbl\n\teLTGcxUfB6D8o2uPVdr/LjgoKs0oyEoS4o/4koB7/LsnJpPA6lEilVgw/zZmuTYQ/HF0\n\t9MRg==","X-Gm-Message-State":"APjAAAXgqr+RrR+UOwjaEkPOLbJE40lhAyvAxJgai250CMxgYpVpG4gR\n\tlFIbDRV6u9klzkzpAL2qUY3Y9c+ytdI=","X-Google-Smtp-Source":"APXvYqyDxAPlKKOwOUSspCJxxSoq8+cTJX7YEe06To05FMOrevdVUYltj6AkcuhBJhxIxMvs2nfp2Q==","X-Received":"by 2002:a2e:1409:: with SMTP id u9mr7156372ljd.162.1570131297779;\n\tThu, 03 Oct 2019 12:34:57 -0700 (PDT)","Date":"Thu, 3 Oct 2019 21:34:56 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191003193456.GJ1322@bigcity.dyn.berto.se>","References":"<20190929190254.18920-1-laurent.pinchart@ideasonboard.com>\n\t<20190929190254.18920-8-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190929190254.18920-8-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v2 07/13] libcamera: controls: Remove\n\tControlInfo::id","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":"Thu, 03 Oct 2019 19:34:58 -0000"}}]