[libcamera-devel] [PATCH v5 4/7] ipa: raspberrypi: Add RPiController::Metadata::mergeCopy

David Plowman david.plowman at raspberrypi.com
Tue Nov 8 11:02:45 CET 2022


Hi Naush

Thanks for updating this patch!

On Mon, 31 Oct 2022 at 11:45, Naushir Patuck via libcamera-devel
<libcamera-devel at lists.libcamera.org> wrote:
>
> Add a new member function to RPiController::Metadata that copies unique
> key/value pairs from one object to the other. This is different from
> std::map::merge that would remove the key/value pairs from the source object.
>
> Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

Reviewed-by: David Plowman <david.plowman at raspberrypi.com>

Thanks
David

> ---
>  src/ipa/raspberrypi/controller/metadata.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/ipa/raspberrypi/controller/metadata.h b/src/ipa/raspberrypi/controller/metadata.h
> index 0f7ebfaf4c25..ddce491784e9 100644
> --- a/src/ipa/raspberrypi/controller/metadata.h
> +++ b/src/ipa/raspberrypi/controller/metadata.h
> @@ -78,6 +78,16 @@ public:
>                 data_.merge(other.data_);
>         }
>
> +       void mergeCopy(const Metadata &other)
> +       {
> +               std::scoped_lock lock(mutex_, other.mutex_);
> +               /*
> +                * If the metadata key exists, ignore this item and copy only
> +                * unique key/value pairs.
> +                */
> +               data_.insert(other.data_.begin(), other.data_.end());
> +       }
> +
>         template<typename T>
>         T *getLocked(std::string const &tag)
>         {
> --
> 2.25.1
>


More information about the libcamera-devel mailing list