[{"id":21588,"web_url":"https://patchwork.libcamera.org/comment/21588/","msgid":"<YaqwVjdOc3eBFd+N@pendragon.ideasonboard.com>","date":"2021-12-04T00:03:34","subject":"Re: [libcamera-devel] [PATCH v2 1/7] libcamera: Add members to\n\tMediaEntity to support ancillary entities","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Daniel,\n\nThank you for the patch.\n\nOn Fri, Dec 03, 2021 at 10:42:24PM +0000, Daniel Scally wrote:\n> With kernel support for ancillary links, we can describe the\n> relationship between two devices represented individually as instances\n> of MediaEntity. As the only property of that relationship is its\n> existence, describe those relationships in libcamera simply as a\n> vector of MediaEntity pointers to the ancillary devices.\n> \n> Signed-off-by: Daniel Scally <djrscally@gmail.com>\n> ---\n> Changes in v2:\n> \n> \t- Switched from additional members against MediaLink pointing to the\n> \tprimary and ancillary entity to a vector against MediaEntity holding\n> \tpointers to the ancillary entities linked to that MediaEntity (Laurent)\n> \n>  include/libcamera/internal/media_object.h |  4 ++++\n>  src/libcamera/media_object.cpp            | 16 ++++++++++++++++\n>  2 files changed, 20 insertions(+)\n> \n> diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h\n> index 90c63598..48616a43 100644\n> --- a/include/libcamera/internal/media_object.h\n> +++ b/include/libcamera/internal/media_object.h\n> @@ -104,6 +104,9 @@ public:\n>  \tunsigned int deviceMinor() const { return minor_; }\n>  \n>  \tconst std::vector<MediaPad *> &pads() const { return pads_; }\n> +\tconst std::vector<MediaEntity *> ancillaryEntities() const {return ancillaryEntities_; }\n\nMissing space before return. checkstyle.py should have warned you (see\nDocumentation/coding-style.rst for instructions to automate style\nchecking with a git commit hook).\n\n> +\n> +\tvoid addAncillaryEntity(MediaEntity *ancillaryEntity);\n\nAs this is called by MediaDevice only, which is a friend of this class,\nyou can make the function private.\n\n>  \n>  \tconst MediaPad *getPadByIndex(unsigned int index) const;\n>  \tconst MediaPad *getPadById(unsigned int id) const;\n> @@ -129,6 +132,7 @@ private:\n>  \tunsigned int minor_;\n>  \n>  \tstd::vector<MediaPad *> pads_;\n> +\tstd::vector<MediaEntity *> ancillaryEntities_;\n>  };\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp\n> index f425d044..42b26b07 100644\n> --- a/src/libcamera/media_object.cpp\n> +++ b/src/libcamera/media_object.cpp\n> @@ -326,6 +326,22 @@ void MediaPad::addLink(MediaLink *link)\n>   * \\return The list of the entity's pads\n>   */\n>  \n> +/**\n> + * \\fn MediaEntity::ancillaryEntities()\n> + * \\brief Retrieve all ancillary entities of the entity\n> + * \\return The list of the entity's ancillary entities\n> + */\n> +\n> +/**\n> + * \\brief Add a MediaEntity to the list of ancillary entities\n> + * \\param[in] ancillaryEntity the instance of MediaEntity to add\n\ns/the/The/\n\n> + * \\return void\n\nNo need for \\return for functions that don't return anything.\n\n> + */\n> +void MediaEntity::addAncillaryEntity(MediaEntity *ancillaryEntity)\n> +{\n> +\tancillaryEntities_.push_back(ancillaryEntity);\n> +}\n> +\n>  /**\n>   * \\brief Get a pad in this entity by its index\n>   * \\param[in] index The 0-based pad index","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 7B7C1BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  4 Dec 2021 00:04:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CB97260832;\n\tSat,  4 Dec 2021 01:04:03 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 97FF06011A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Dec 2021 01:04:01 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0E75C1BC3;\n\tSat,  4 Dec 2021 01:04:00 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"LcPrKln4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638576241;\n\tbh=dKPmLTruo/JxcW4AySSItkjAqw7g7kZ38aVvc5kNmiM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=LcPrKln4IAL3I/DlQIq/F9kLc3Q2b90WdN8P1GS9i5ws+4WGGZR1GDv5VNUmUdd9z\n\tb9RmrrhERJJ16CAaXifn1OHAR2mN3eP1xcwFFCqocr8M9JKv60g3JpaGefCf2wk4JV\n\tWmLK99gSXyA2edxkfNTbrYTcFjjYPARMAXZ/a7Ok=","Date":"Sat, 4 Dec 2021 02:03:34 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Daniel Scally <djrscally@gmail.com>","Message-ID":"<YaqwVjdOc3eBFd+N@pendragon.ideasonboard.com>","References":"<20211203224230.38700-1-djrscally@gmail.com>\n\t<20211203224230.38700-2-djrscally@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211203224230.38700-2-djrscally@gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v2 1/7] libcamera: Add members to\n\tMediaEntity to support ancillary entities","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21596,"web_url":"https://patchwork.libcamera.org/comment/21596/","msgid":"<45e31495-dc2d-4eab-62eb-0293f1848809@gmail.com>","date":"2021-12-04T21:36:46","subject":"Re: [libcamera-devel] [PATCH v2 1/7] libcamera: Add members to\n\tMediaEntity to support ancillary entities","submitter":{"id":90,"url":"https://patchwork.libcamera.org/api/people/90/","name":"Daniel Scally","email":"djrscally@gmail.com"},"content":"Hi Laurent\n\nOn 04/12/2021 00:03, Laurent Pinchart wrote:\n> Hi Daniel,\n> \n> Thank you for the patch.\n> \n> On Fri, Dec 03, 2021 at 10:42:24PM +0000, Daniel Scally wrote:\n>> With kernel support for ancillary links, we can describe the\n>> relationship between two devices represented individually as instances\n>> of MediaEntity. As the only property of that relationship is its\n>> existence, describe those relationships in libcamera simply as a\n>> vector of MediaEntity pointers to the ancillary devices.\n>>\n>> Signed-off-by: Daniel Scally <djrscally@gmail.com>\n>> ---\n>> Changes in v2:\n>>\n>> \t- Switched from additional members against MediaLink pointing to the\n>> \tprimary and ancillary entity to a vector against MediaEntity holding\n>> \tpointers to the ancillary entities linked to that MediaEntity (Laurent)\n>>\n>>  include/libcamera/internal/media_object.h |  4 ++++\n>>  src/libcamera/media_object.cpp            | 16 ++++++++++++++++\n>>  2 files changed, 20 insertions(+)\n>>\n>> diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h\n>> index 90c63598..48616a43 100644\n>> --- a/include/libcamera/internal/media_object.h\n>> +++ b/include/libcamera/internal/media_object.h\n>> @@ -104,6 +104,9 @@ public:\n>>  \tunsigned int deviceMinor() const { return minor_; }\n>>  \n>>  \tconst std::vector<MediaPad *> &pads() const { return pads_; }\n>> +\tconst std::vector<MediaEntity *> ancillaryEntities() const {return ancillaryEntities_; }\n> \n> Missing space before return. checkstyle.py should have warned you (see\n> Documentation/coding-style.rst for instructions to automate style\n> checking with a git commit hook).\n\nOoh, that's quite a neat idea. Thanks\n\n> \n>> +\n>> +\tvoid addAncillaryEntity(MediaEntity *ancillaryEntity);\n> \n> As this is called by MediaDevice only, which is a friend of this class,\n> you can make the function private.\n> \n\nTIL of the friend concept - thanks. Still trying to get up to speed with\nthis whole cpp thing.\n\n>>  \n>>  \tconst MediaPad *getPadByIndex(unsigned int index) const;\n>>  \tconst MediaPad *getPadById(unsigned int id) const;\n>> @@ -129,6 +132,7 @@ private:\n>>  \tunsigned int minor_;\n>>  \n>>  \tstd::vector<MediaPad *> pads_;\n>> +\tstd::vector<MediaEntity *> ancillaryEntities_;\n>>  };\n>>  \n>>  } /* namespace libcamera */\n>> diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp\n>> index f425d044..42b26b07 100644\n>> --- a/src/libcamera/media_object.cpp\n>> +++ b/src/libcamera/media_object.cpp\n>> @@ -326,6 +326,22 @@ void MediaPad::addLink(MediaLink *link)\n>>   * \\return The list of the entity's pads\n>>   */\n>>  \n>> +/**\n>> + * \\fn MediaEntity::ancillaryEntities()\n>> + * \\brief Retrieve all ancillary entities of the entity\n>> + * \\return The list of the entity's ancillary entities\n>> + */\n>> +\n>> +/**\n>> + * \\brief Add a MediaEntity to the list of ancillary entities\n>> + * \\param[in] ancillaryEntity the instance of MediaEntity to add\n> \n> s/the/The/\n> \n>> + * \\return void\n> \n> No need for \\return for functions that don't return anything.\n> \n>> + */\n>> +void MediaEntity::addAncillaryEntity(MediaEntity *ancillaryEntity)\n>> +{\n>> +\tancillaryEntities_.push_back(ancillaryEntity);\n>> +}\n>> +\n>>  /**\n>>   * \\brief Get a pad in this entity by its index\n>>   * \\param[in] index The 0-based pad index\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A57AEBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  4 Dec 2021 21:36:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C6F9160868;\n\tSat,  4 Dec 2021 22:36:50 +0100 (CET)","from mail-wr1-x433.google.com (mail-wr1-x433.google.com\n\t[IPv6:2a00:1450:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CC27F605C4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Dec 2021 22:36:48 +0100 (CET)","by mail-wr1-x433.google.com with SMTP id u17so6298588wrt.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 04 Dec 2021 13:36:48 -0800 (PST)","from [192.168.0.16]\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161])\n\tby smtp.gmail.com with ESMTPSA id\n\te8sm6460323wrr.26.2021.12.04.13.36.47\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tSat, 04 Dec 2021 13:36:47 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"gf+J/aNF\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=tOBDjgC7aEZLJXkxrhHOCpMmTkHb0J8nZYjFqDus6zo=;\n\tb=gf+J/aNFzSPh03ZOylpApR2IoWIgInQ3mzFJXnvgCy/s7zC3+xZJzGL/u7RRU560FT\n\tIhtzHrWiv0d+Sfvu1QzdqqJWHyP6KoXuusN5jpVizNNyPqR14MQc1iI1e5WGH70+8Tul\n\thulUIrN6Yy+Ayx4H6mFV3zFNhPmPBCA286MTCsb/Q8/N3LNHQjaN0vJxXWWb7Zm5Ixqp\n\tgR4kH+V83+j+sTZiHtkkO+76YsoQ88suIC0Flh6TNSYuatMn9wtPECNZ4NfEOPC4Dz2x\n\tQafcaGBaGj0Et0VxXGjUWaI3vWZN0C55hebMeUltvwaX0l0Qi52ceBXnWa8Pb0PTbqlO\n\t1eSw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:subject:to:cc:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=tOBDjgC7aEZLJXkxrhHOCpMmTkHb0J8nZYjFqDus6zo=;\n\tb=K+V0Z+1LUB9cO3P36RUqI2ozmNOp9pzQfvU5DInShKI1EoJtOePZe+93nlGtpujkPG\n\t/y1s5Mv/vAmxIvCR0n66vAb3oWR06aePdha7ftJz1kxE4BiummWYR9PruRfnhxzSyy4u\n\tbKjpAPAj+H53u4+4vzQqHICYBPE9oWp4U5LaCn5qxpVobbjYAYLUrJrBUTyNcpsKD9/v\n\tUk1c9rHJUjpouewiHH4teSiaX9XBddTK06xvzIdO6Bsl5tBRcLpULggdiiGgGBLS3Z8z\n\txCnsd6EdZAqqjI7ZIGRmqCN9uvcRa14r8JBMRY/q9Ok/0S8XtP/waAYAFvF0u8NQCjs/\n\twUBA==","X-Gm-Message-State":"AOAM530zLtliURd6KyMWXd8LT0dWh6doQ8v8hEhexRqWHSb8xQQOI2jG\n\tGyn4kDdDtjIRWlk+DyiPb5PwldjcoxU=","X-Google-Smtp-Source":"ABdhPJxtbGyfbQrXPOeLQQPviRRbglhLfIKvh+fEKJd2lVKD8/5oQfz+jSZzsMu7rimXLMC6qG6z3Q==","X-Received":"by 2002:a5d:414a:: with SMTP id\n\tc10mr30853939wrq.493.1638653808400; \n\tSat, 04 Dec 2021 13:36:48 -0800 (PST)","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20211203224230.38700-1-djrscally@gmail.com>\n\t<20211203224230.38700-2-djrscally@gmail.com>\n\t<YaqwVjdOc3eBFd+N@pendragon.ideasonboard.com>","From":"Daniel Scally <djrscally@gmail.com>","Message-ID":"<45e31495-dc2d-4eab-62eb-0293f1848809@gmail.com>","Date":"Sat, 4 Dec 2021 21:36:46 +0000","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.14.0","MIME-Version":"1.0","In-Reply-To":"<YaqwVjdOc3eBFd+N@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v2 1/7] libcamera: Add members to\n\tMediaEntity to support ancillary entities","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]