[{"id":34676,"web_url":"https://patchwork.libcamera.org/comment/34676/","msgid":"<175101107720.3281735.14107176070325566591@ping.linuxembedded.co.uk>","date":"2025-06-27T07:57:57","subject":"Re: [PATCH 2/2] libcamera: gstreamer: Report mounting-rotation of\n\tcamera sensor","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Umang Jain (2025-06-27 08:42:08)\n> Report mounting-rotation of the camera sensor by reading the\n> property::Rotation property from libcamera. This is reported\n> in GstDevice properties for libcamerasrc element.\n> \n> Signed-off-by: Umang Jain <uajain@igalia.com>\n> ---\n>  src/gstreamer/gstlibcameraprovider.cpp | 14 ++++++++++++++\n>  1 file changed, 14 insertions(+)\n> \n> diff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp\n> index 5da96ea3..806a149a 100644\n> --- a/src/gstreamer/gstlibcameraprovider.cpp\n> +++ b/src/gstreamer/gstlibcameraprovider.cpp\n> @@ -12,6 +12,7 @@\n>  \n>  #include <libcamera/camera.h>\n>  #include <libcamera/camera_manager.h>\n> +#include <libcamera/property_ids.h>\n>  \n>  #include \"gstlibcamerasrc.h\"\n>  #include \"gstlibcamera-utils.h\"\n> @@ -131,6 +132,8 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n>         static const std::array roles{ StreamRole::VideoRecording };\n>         g_autoptr(GstCaps) caps = gst_caps_new_empty();\n>         const gchar *name = camera->id().c_str();\n> +       std::string rotation_str;\n> +       bool success;\n>  \n>         std::unique_ptr<CameraConfiguration> config = camera->generateConfiguration(roles);\n>         if (!config || config->size() != roles.size()) {\n> @@ -144,12 +147,23 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n>                         gst_caps_append(caps, sub_caps);\n>         }\n>  \n> +       const int32_t rotation = camera->properties().get(properties::Rotation).value_or(0);\n> +       Orientation mountingOrientation = orientationFromRotation(rotation, &success);\n> +       rotation_str = success ? orientationToString(mountingOrientation)\n> +                              : std::to_string(rotation);\n\nThis puts a 'libcamera style' string \"Rotate0\" into the results/output\nof the gstlibcamerasrc ... is there any equivalent for how other\ncomponents report the rotation? Is it just a numerical value or is this\na unique property to libcamera elements?\n\n--\nKieran\n\n> +\n> +       g_autoptr(GstStructure) props =\n> +               gst_structure_new(\"camera-properties\",\n> +                                 \"mounting-rotation\", G_TYPE_STRING, rotation_str.c_str(),\n> +                                 nullptr);\n> +\n>         return GST_DEVICE(g_object_new(GST_TYPE_LIBCAMERA_DEVICE,\n>                                        /* \\todo Use a unique identifier instead of camera name. */\n>                                        \"name\", name,\n>                                        \"display-name\", name,\n>                                        \"caps\", caps,\n>                                        \"device-class\", \"Source/Video\",\n> +                                      \"properties\", props,\n>                                        nullptr));\n>  }\n>  \n> -- \n> 2.50.0\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 471D2C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Jun 2025 07:58:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1138468DF4;\n\tFri, 27 Jun 2025 09:58:02 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6AD5262C43\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Jun 2025 09:58:00 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D4F3773B;\n\tFri, 27 Jun 2025 09:57:40 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"lS1/QDj+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1751011060;\n\tbh=8aQdfOQc7arvbpSxO0qYWXTBM+GhIm4nSFAu6iuc4As=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=lS1/QDj+BvHKGCbxNZDzZJtPOTrJ2TFbkXudYQ0/qgQpVBb3Jq6BVVWYtNrRLnHVI\n\tHjEQjOoJnnfTxgDASOknclntRKYr8mvtOuPn8afY6eDmX+mTTzCIOzrcftaM9h3j8l\n\tbn6ARa+L5X5yqXga94JHtMSuozpemS1MfrDuCgsU=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250627074208.49872-3-uajain@igalia.com>","References":"<20250627074208.49872-1-uajain@igalia.com>\n\t<20250627074208.49872-3-uajain@igalia.com>","Subject":"Re: [PATCH 2/2] libcamera: gstreamer: Report mounting-rotation of\n\tcamera sensor","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Giacomo Cappellini <giacomo.cappellini.87@gmail.com>,\n\tNicolas Dufresne <nicolas@ndufresne.ca>, Umang Jain <uajain@igalia.com>","To":"Umang Jain <uajain@igalia.com>, libcamera-devel@lists.libcamera.org","Date":"Fri, 27 Jun 2025 08:57:57 +0100","Message-ID":"<175101107720.3281735.14107176070325566591@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34677,"web_url":"https://patchwork.libcamera.org/comment/34677/","msgid":"<175101151867.3281735.12861820227810321443@ping.linuxembedded.co.uk>","date":"2025-06-27T08:05:18","subject":"Re: [PATCH 2/2] libcamera: gstreamer: Report mounting-rotation of\n\tcamera sensor","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Kieran Bingham (2025-06-27 08:57:57)\n> Quoting Umang Jain (2025-06-27 08:42:08)\n> > Report mounting-rotation of the camera sensor by reading the\n> > property::Rotation property from libcamera. This is reported\n> > in GstDevice properties for libcamerasrc element.\n> > \n> > Signed-off-by: Umang Jain <uajain@igalia.com>\n> > ---\n> >  src/gstreamer/gstlibcameraprovider.cpp | 14 ++++++++++++++\n> >  1 file changed, 14 insertions(+)\n> > \n> > diff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp\n> > index 5da96ea3..806a149a 100644\n> > --- a/src/gstreamer/gstlibcameraprovider.cpp\n> > +++ b/src/gstreamer/gstlibcameraprovider.cpp\n> > @@ -12,6 +12,7 @@\n> >  \n> >  #include <libcamera/camera.h>\n> >  #include <libcamera/camera_manager.h>\n> > +#include <libcamera/property_ids.h>\n> >  \n> >  #include \"gstlibcamerasrc.h\"\n> >  #include \"gstlibcamera-utils.h\"\n> > @@ -131,6 +132,8 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n> >         static const std::array roles{ StreamRole::VideoRecording };\n> >         g_autoptr(GstCaps) caps = gst_caps_new_empty();\n> >         const gchar *name = camera->id().c_str();\n> > +       std::string rotation_str;\n> > +       bool success;\n> >  \n> >         std::unique_ptr<CameraConfiguration> config = camera->generateConfiguration(roles);\n> >         if (!config || config->size() != roles.size()) {\n> > @@ -144,12 +147,23 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n> >                         gst_caps_append(caps, sub_caps);\n> >         }\n> >  \n> > +       const int32_t rotation = camera->properties().get(properties::Rotation).value_or(0);\n> > +       Orientation mountingOrientation = orientationFromRotation(rotation, &success);\n> > +       rotation_str = success ? orientationToString(mountingOrientation)\n> > +                              : std::to_string(rotation);\n> \n> This puts a 'libcamera style' string \"Rotate0\" into the results/output\n> of the gstlibcamerasrc ... is there any equivalent for how other\n> components report the rotation? Is it just a numerical value or is this\n> a unique property to libcamera elements?\n\nDigging deeper in here - orientationFromRotation will return only 0, 90,\n180, or 270... giving Rotate0, Rotate90, Rotate180, Rotate270, or\notherwise if that fails it will perfrom a std::string on the integer\nvalue.\n\nPerhaps we should just use the string representation of the integer\nvalue always - the property is caleld \"mounting-rotation\" - so a\nnumerical value seems correct already.\n\n--\nKieran\n\n\n\n> \n> --\n> Kieran\n> \n> > +\n> > +       g_autoptr(GstStructure) props =\n> > +               gst_structure_new(\"camera-properties\",\n> > +                                 \"mounting-rotation\", G_TYPE_STRING, rotation_str.c_str(),\n> > +                                 nullptr);\n> > +\n> >         return GST_DEVICE(g_object_new(GST_TYPE_LIBCAMERA_DEVICE,\n> >                                        /* \\todo Use a unique identifier instead of camera name. */\n> >                                        \"name\", name,\n> >                                        \"display-name\", name,\n> >                                        \"caps\", caps,\n> >                                        \"device-class\", \"Source/Video\",\n> > +                                      \"properties\", props,\n> >                                        nullptr));\n> >  }\n> >  \n> > -- \n> > 2.50.0\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 BDF92BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Jun 2025 08:05:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7919068DF4;\n\tFri, 27 Jun 2025 10:05:23 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7644D62C43\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Jun 2025 10:05:21 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B1307928;\n\tFri, 27 Jun 2025 10:05:01 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Zr6QsdQE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1751011501;\n\tbh=6rlkoHsnBOKq3LbJvfbJJod4IDjXPD6kcevNnLwOe2M=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=Zr6QsdQECSZbAv64SikbYKaD2CZdDr+MlAVraZRS7YFRHwkNJe2Q/irgsVolDJJJG\n\tk2hrRhyuYeE/pwUItZSBkeft7tosrHbMerEIfAYRhcUNaoCUaLRkhTy2GTumpZwYag\n\tyWzR6zOkq+s8l3WkRVXd9JDEiOlyoM0Tr2liw/iU=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<175101107720.3281735.14107176070325566591@ping.linuxembedded.co.uk>","References":"<20250627074208.49872-1-uajain@igalia.com>\n\t<20250627074208.49872-3-uajain@igalia.com>\n\t<175101107720.3281735.14107176070325566591@ping.linuxembedded.co.uk>","Subject":"Re: [PATCH 2/2] libcamera: gstreamer: Report mounting-rotation of\n\tcamera sensor","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Giacomo Cappellini <giacomo.cappellini.87@gmail.com>,\n\tNicolas Dufresne <nicolas@ndufresne.ca>, Umang Jain <uajain@igalia.com>","To":"Umang Jain <uajain@igalia.com>, libcamera-devel@lists.libcamera.org","Date":"Fri, 27 Jun 2025 09:05:18 +0100","Message-ID":"<175101151867.3281735.12861820227810321443@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34678,"web_url":"https://patchwork.libcamera.org/comment/34678/","msgid":"<ebbb33de-faff-4560-b43c-d1423319ea45@igalia.com>","date":"2025-06-27T08:10:08","subject":"Re: [PATCH 2/2] libcamera: gstreamer: Report mounting-rotation of\n\tcamera sensor","submitter":{"id":232,"url":"https://patchwork.libcamera.org/api/people/232/","name":"Umang Jain","email":"uajain@igalia.com"},"content":"On 6/27/25 1:27 PM, Kieran Bingham wrote:\n> Quoting Umang Jain (2025-06-27 08:42:08)\n>> Report mounting-rotation of the camera sensor by reading the\n>> property::Rotation property from libcamera. This is reported\n>> in GstDevice properties for libcamerasrc element.\n>>\n>> Signed-off-by: Umang Jain <uajain@igalia.com>\n>> ---\n>>   src/gstreamer/gstlibcameraprovider.cpp | 14 ++++++++++++++\n>>   1 file changed, 14 insertions(+)\n>>\n>> diff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp\n>> index 5da96ea3..806a149a 100644\n>> --- a/src/gstreamer/gstlibcameraprovider.cpp\n>> +++ b/src/gstreamer/gstlibcameraprovider.cpp\n>> @@ -12,6 +12,7 @@\n>>   \n>>   #include <libcamera/camera.h>\n>>   #include <libcamera/camera_manager.h>\n>> +#include <libcamera/property_ids.h>\n>>   \n>>   #include \"gstlibcamerasrc.h\"\n>>   #include \"gstlibcamera-utils.h\"\n>> @@ -131,6 +132,8 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n>>          static const std::array roles{ StreamRole::VideoRecording };\n>>          g_autoptr(GstCaps) caps = gst_caps_new_empty();\n>>          const gchar *name = camera->id().c_str();\n>> +       std::string rotation_str;\n>> +       bool success;\n>>   \n>>          std::unique_ptr<CameraConfiguration> config = camera->generateConfiguration(roles);\n>>          if (!config || config->size() != roles.size()) {\n>> @@ -144,12 +147,23 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n>>                          gst_caps_append(caps, sub_caps);\n>>          }\n>>   \n>> +       const int32_t rotation = camera->properties().get(properties::Rotation).value_or(0);\n>> +       Orientation mountingOrientation = orientationFromRotation(rotation, &success);\n>> +       rotation_str = success ? orientationToString(mountingOrientation)\n>> +                              : std::to_string(rotation);\n> This puts a 'libcamera style' string \"Rotate0\" into the results/output\n> of the gstlibcamerasrc ... is there any equivalent for how other\n> components report the rotation? Is it just a numerical value or is this\n> a unique property to libcamera elements?\n\n\nI think it's upto the element on how it wants to form the human readable \nstring.\n\nIf you expect, that some computations/transformations needs to be done \nand have\nvalid use case, you can append the GstStructure to contain additional\n\"mounting-rotation-angle\" property to report it numerically.\n\n\n>\n> --\n> Kieran\n>\n>> +\n>> +       g_autoptr(GstStructure) props =\n>> +               gst_structure_new(\"camera-properties\",\n>> +                                 \"mounting-rotation\", G_TYPE_STRING, rotation_str.c_str(),\n>> +                                 nullptr);\n>> +\n>>          return GST_DEVICE(g_object_new(GST_TYPE_LIBCAMERA_DEVICE,\n>>                                         /* \\todo Use a unique identifier instead of camera name. */\n>>                                         \"name\", name,\n>>                                         \"display-name\", name,\n>>                                         \"caps\", caps,\n>>                                         \"device-class\", \"Source/Video\",\n>> +                                      \"properties\", props,\n>>                                         nullptr));\n>>   }\n>>   \n>> -- \n>> 2.50.0\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 B6480C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Jun 2025 08:10:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7B84968DF4;\n\tFri, 27 Jun 2025 10:10:06 +0200 (CEST)","from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 47BAA62C43\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Jun 2025 10:10:05 +0200 (CEST)","from [49.36.69.141] (helo=[192.168.29.4])\n\tby fanzine2.igalia.com with esmtpsa \n\t(Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128)\n\t(Exim) id 1uV49r-009J2q-In; Fri, 27 Jun 2025 10:10:03 +0200"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=igalia.com header.i=@igalia.com\n\theader.b=\"d/i/DwB1\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n\ts=20170329;\n\th=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:\n\tReferences:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:\n\tContent-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:\n\tResent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:\n\tList-Subscribe:List-Post:List-Owner:List-Archive;\n\tbh=xl5+nZEtO2+6s2HXxvUpkdDJeZGUgFzQvX1mhCa/oEY=;\n\tb=d/i/DwB1gMQHL6p2JMZu9BWoH8\n\tH6tWiyDKvyYkxwu4ruv9TAsTLHfwBSa9avj8hh8T9PHokghl8HqpzJmlAcyBA2afB9r0yXpLhYyn0\n\txHHJCZyNYXmEeBE4w0ma1dZFxH8OA0JIsyVoLTK2JPv0z7LNuN0JTeuUZZ6pqFzpFaPJvhp96ioo4\n\tn4/8Klcts4Kx6baPiNY2Py0ha9TGDGgmzq4Gj7PQLfyEnEYfb3YU2uzcBPChAOapkRYlUA59NViaY\n\tgc4EOiRlmzoTuqLn0M2ap+fqQeP9Jl3bzZ62dYLIOIpatoqPKpa1X31H68C9WIe9nHSXRKCT+RPaw\n\tVYMJXOGw==;","Message-ID":"<ebbb33de-faff-4560-b43c-d1423319ea45@igalia.com>","Date":"Fri, 27 Jun 2025 13:40:08 +0530","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 2/2] libcamera: gstreamer: Report mounting-rotation of\n\tcamera sensor","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"Giacomo Cappellini <giacomo.cappellini.87@gmail.com>,\n\tNicolas Dufresne <nicolas@ndufresne.ca>","References":"<20250627074208.49872-1-uajain@igalia.com>\n\t<20250627074208.49872-3-uajain@igalia.com>\n\t<175101107720.3281735.14107176070325566591@ping.linuxembedded.co.uk>","Content-Language":"en-US","From":"Umang Jain <uajain@igalia.com>","In-Reply-To":"<175101107720.3281735.14107176070325566591@ping.linuxembedded.co.uk>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34704,"web_url":"https://patchwork.libcamera.org/comment/34704/","msgid":"<f2d9a36d65946e1a1b2ec02714078acd6eaa2ac7.camel@ndufresne.ca>","date":"2025-06-27T14:54:54","subject":"Re: [PATCH 2/2] libcamera: gstreamer: Report mounting-rotation of\n\tcamera sensor","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"content":"Le vendredi 27 juin 2025 à 08:57 +0100, Kieran Bingham a écrit :\n> Quoting Umang Jain (2025-06-27 08:42:08)\n> > Report mounting-rotation of the camera sensor by reading the\n> > property::Rotation property from libcamera. This is reported\n> > in GstDevice properties for libcamerasrc element.\n> > \n> > Signed-off-by: Umang Jain <uajain@igalia.com>\n> > ---\n> >  src/gstreamer/gstlibcameraprovider.cpp | 14 ++++++++++++++\n> >  1 file changed, 14 insertions(+)\n> > \n> > diff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp\n> > index 5da96ea3..806a149a 100644\n> > --- a/src/gstreamer/gstlibcameraprovider.cpp\n> > +++ b/src/gstreamer/gstlibcameraprovider.cpp\n> > @@ -12,6 +12,7 @@\n> >  \n> >  #include <libcamera/camera.h>\n> >  #include <libcamera/camera_manager.h>\n> > +#include <libcamera/property_ids.h>\n> >  \n> >  #include \"gstlibcamerasrc.h\"\n> >  #include \"gstlibcamera-utils.h\"\n> > @@ -131,6 +132,8 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n> >         static const std::array roles{ StreamRole::VideoRecording };\n> >         g_autoptr(GstCaps) caps = gst_caps_new_empty();\n> >         const gchar *name = camera->id().c_str();\n> > +       std::string rotation_str;\n> > +       bool success;\n> >  \n> >         std::unique_ptr<CameraConfiguration> config = camera->generateConfiguration(roles);\n> >         if (!config || config->size() != roles.size()) {\n> > @@ -144,12 +147,23 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n> >                         gst_caps_append(caps, sub_caps);\n> >         }\n> >  \n> > +       const int32_t rotation = camera->properties().get(properties::Rotation).value_or(0);\n> > +       Orientation mountingOrientation = orientationFromRotation(rotation, &success);\n> > +       rotation_str = success ? orientationToString(mountingOrientation)\n> > +                              : std::to_string(rotation);\n> \n> This puts a 'libcamera style' string \"Rotate0\" into the results/output\n> of the gstlibcamerasrc ... is there any equivalent for how other\n> components report the rotation? Is it just a numerical value or is this\n> a unique property to libcamera elements?\n\nI was looking around, and actually we have more options. The general style that\nhas been used on linux is udev style. Typically, udev have generic namespaces\nsuch as object.id = 87 / object.serial = 3264, and then API specific looks like\nalsa.long_card_name = LENOVO-21KCCTO1WW-ThinkPadX1CarbonGen12 (but also\napi.alsa.card.longname, I bet one of the two is deprecated),\napi.v4l2.cap.bus_info is what the V4L2 udev plugin do.\n\nSo with that in mind, we could go really simple and use libcamera.mounting-\nrotation = number, or api.libcamera.. if we figure-out what is the new standard.\n\nIn short, we have a way to place API specific stuff there in a way that if there\nis another standard later they can coexist. Would you prefer this simple\napproach ?\n\nNicolas\n\n> \n> --\n> Kieran\n> \n> > +\n> > +       g_autoptr(GstStructure) props =\n> > +               gst_structure_new(\"camera-properties\",\n> > +                                 \"mounting-rotation\", G_TYPE_STRING, rotation_str.c_str(),\n> > +                                 nullptr);\n> > +\n> >         return GST_DEVICE(g_object_new(GST_TYPE_LIBCAMERA_DEVICE,\n> >                                        /* \\todo Use a unique identifier instead of camera name. */\n> >                                        \"name\", name,\n> >                                        \"display-name\", name,\n> >                                        \"caps\", caps,\n> >                                        \"device-class\", \"Source/Video\",\n> > +                                      \"properties\", props,\n> >                                        nullptr));\n> >  }\n> >  \n> > -- \n> > 2.50.0\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 51C15BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Jun 2025 14:55:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 169A268E05;\n\tFri, 27 Jun 2025 16:55:00 +0200 (CEST)","from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com\n\t[IPv6:2607:f8b0:4864:20::82c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D682E68DE5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Jun 2025 16:54:57 +0200 (CEST)","by mail-qt1-x82c.google.com with SMTP id\n\td75a77b69052e-4a4312b4849so25993881cf.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Jun 2025 07:54:57 -0700 (PDT)","from ?IPv6:2606:6d00:17:b699::bad? ([2606:6d00:17:b699::bad])\n\tby smtp.gmail.com with ESMTPSA id\n\td75a77b69052e-4a7fc55d92esm13515931cf.49.2025.06.27.07.54.55\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 27 Jun 2025 07:54:55 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=ndufresne-ca.20230601.gappssmtp.com\n\theader.i=@ndufresne-ca.20230601.gappssmtp.com\n\theader.b=\"JQ8xL/zr\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ndufresne-ca.20230601.gappssmtp.com; s=20230601; t=1751036097;\n\tx=1751640897; darn=lists.libcamera.org; \n\th=mime-version:user-agent:autocrypt:references:in-reply-to:date:cc:to\n\t:from:subject:message-id:from:to:cc:subject:date:message-id:reply-to; \n\tbh=/9Gn1eTmLWqpVq96+AU3AERrmZ1aLE8wkaRhOEm8Akw=;\n\tb=JQ8xL/zr4/XX3e0tyEj/dZ2AAHRC2gN2kYuHfZsvM4SplWmN0TFRC+irvqz9xSY35G\n\t7dKVYeYDe8XPZ7mouEGoi2vPg97gS8gAaQPq3qL1gZz9xCmOFkNrUUsKLDWyF8fLzZzV\n\tcIzyuz3o9pnfJjWtw9q0RN4v5qRXaRdTnI66/HV0ZV9G2TeLNuVo23nn++uuqbJtOz3m\n\tFdujj4saUs8Cd8J+/2Q+eW70g8wgxjchFTRk1TGtCO9Oe5wDzAo6pTi2qo3YquBp+wcv\n\tevbtPSVTyvlUK2HETw1lZHfYEzdsvdiz4vQC5jDqexKHnwXjO+OLcP/EVBpNBhrIYYfN\n\tZwpA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1751036097; x=1751640897;\n\th=mime-version:user-agent:autocrypt:references:in-reply-to:date:cc:to\n\t:from:subject:message-id:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=/9Gn1eTmLWqpVq96+AU3AERrmZ1aLE8wkaRhOEm8Akw=;\n\tb=FjkAF+GfySA6uQca1XSLa8Ze1qXIGmx7Kztnc79LTHXJPWUrzkRjR5gFLRCEbqVfk2\n\tCNpeTMwZXCpYt/hWvSshdRsbjoyDDsQ5PQvN1DK2AFxVxWyjXUknurqpqHAHOUb1sckF\n\tMB2b/Tvg62hwBVk62UKMMtU7E2g81HLMV156jGnz78TimuKMFCdiY+ygu9W7uIwN+PVJ\n\trS/Gbv1vYoLCnY83kSB8ozsdozsAuT696yehS1QgB2zUssRiPMRCxYgWNx1412UsCGi5\n\ts6ep77ZQHZEt03pmv0cYscCu/AurUZOXGXNH170m+Rir1E1GNlJiTii7WFRcogN/xAHz\n\tI5TQ==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCVQEkccZBrcmULzU5omjQkFnjfQNfLOA4l+esDpbZF2SVKQeeUHHoCFKwj6X4U0wd8vCsk93HAqz7nRq3IgUKE=@lists.libcamera.org","X-Gm-Message-State":"AOJu0YwAajnAuMdEzoN1H21HjF4y4xZhn2OyBsEpHqafI6BFNpGVRzta\n\ttWRgOMIpmUB6b1QGP9Xj9ORSqN1s0/hQiPeIzDn+fL2PB2NQ9/yFnkN7WaSN4YlH/KM=","X-Gm-Gg":"ASbGncs1YJWPO/3zzEV1VMv/BMsXRSMVie7TDCMgLnP5iDtM06H1pfcNghSWNjzelh/\n\tsav/9j4xu8hwd7OIaTxjjssTSmQ/sm8m9RSOORlzabHQiZVUoaYvo/PZNFXke4hzmH1uawq69lv\n\tR/t2SIAVjVCsx8kilPgZs329/vEv7wsWHSU9VXPE5C2X+Y/cysr/cTodEudz6Zx9JZh4P60BywI\n\tNGy7HhsVr/o45X1UynHIbi2CLcQlCST77R+jJCnXMtRqK5KqTKn4yonQ7Bv0nALVc/O9+yeOJLF\n\teWntG1BbUodAi/jZCbwombGrQvwHgcs2K1TOp3Zw+2P0OdlRkLWHn+3D0X2vM0cANj8=","X-Google-Smtp-Source":"AGHT+IHEoaJeR1YZRhS/tfQE7JGvNFWHhO8hwGXRrQ5yeZ0S5+qMCWDFC13AHKFnUFwMFL6S64EQbA==","X-Received":"by 2002:ac8:5895:0:b0:499:5503:7b2c with SMTP id\n\td75a77b69052e-4a7fcaefcccmr56475061cf.43.1751036096562; \n\tFri, 27 Jun 2025 07:54:56 -0700 (PDT)","Message-ID":"<f2d9a36d65946e1a1b2ec02714078acd6eaa2ac7.camel@ndufresne.ca>","Subject":"Re: [PATCH 2/2] libcamera: gstreamer: Report mounting-rotation of\n\tcamera sensor","From":"Nicolas Dufresne <nicolas@ndufresne.ca>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>, Umang Jain\n\t<uajain@igalia.com>, libcamera-devel@lists.libcamera.org","Cc":"Giacomo Cappellini <giacomo.cappellini.87@gmail.com>","Date":"Fri, 27 Jun 2025 10:54:54 -0400","In-Reply-To":"<175101107720.3281735.14107176070325566591@ping.linuxembedded.co.uk>","References":"<20250627074208.49872-1-uajain@igalia.com>\n\t<20250627074208.49872-3-uajain@igalia.com>\n\t<175101107720.3281735.14107176070325566591@ping.linuxembedded.co.uk>","Autocrypt":"addr=nicolas@ndufresne.ca; prefer-encrypt=mutual;\n\tkeydata=mDMEaCN2ixYJKwYBBAHaRw8BAQdAM0EHepTful3JOIzcPv6ekHOenE1u0vDG1gdHFrChD\n\t/e0MU5pY29sYXMgRHVmcmVzbmUgPG5pY29sYXMuZHVmcmVzbmVAY29sbGFib3JhLmNvbT6ImQQTFg\n\toAQQIbAwULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgBYhBO8NUoEVxMPCGgRvEtlBlFEpYHL0BQJ\n\toLLLGBQkJZfd1AAoJENlBlFEpYHL0BEkA/3qkWYt99myYFSmTJUF8UB/7OroEm3vr1HRqXeQe9Qp2\n\tAP0bsoAe6KjEPa/pJfuJ2khrOPPHxvyt/PBNbI5BYcIABLQnTmljb2xhcyBEdWZyZXNuZSA8bmljb\n\t2xhc0BuZHVmcmVzbmUuY2E+iJkEExYKAEECGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AWIQ\n\tTvDVKBFcTDwhoEbxLZQZRRKWBy9AUCaCyy+AUJCWX3dQAKCRDZQZRRKWBy9FJ5AQCNy8SX8DpHbLa\n\tcy58vgDwyIpB89mok9eWGGejY9mqpRwEAhHzs+/n5xlVlM3bqy1yHnAzJqVwqBE1D0jG0a9V6VQI=","Content-Type":"multipart/signed; micalg=\"pgp-sha512\";\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"=-LO/pVipUZvGB3enE+7zT\"","User-Agent":"Evolution 3.56.2 (3.56.2-1.fc42) ","MIME-Version":"1.0","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34724,"web_url":"https://patchwork.libcamera.org/comment/34724/","msgid":"<20250629230358.GB20732@pendragon.ideasonboard.com>","date":"2025-06-29T23:03:58","subject":"Re: [PATCH 2/2] libcamera: gstreamer: Report mounting-rotation of\n\tcamera sensor","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Fri, Jun 27, 2025 at 10:54:54AM -0400, Nicolas Dufresne wrote:\n> Le vendredi 27 juin 2025 à 08:57 +0100, Kieran Bingham a écrit :\n> > Quoting Umang Jain (2025-06-27 08:42:08)\n> > > Report mounting-rotation of the camera sensor by reading the\n> > > property::Rotation property from libcamera. This is reported\n> > > in GstDevice properties for libcamerasrc element.\n> > > \n> > > Signed-off-by: Umang Jain <uajain@igalia.com>\n> > > ---\n> > >  src/gstreamer/gstlibcameraprovider.cpp | 14 ++++++++++++++\n> > >  1 file changed, 14 insertions(+)\n> > > \n> > > diff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp\n> > > index 5da96ea3..806a149a 100644\n> > > --- a/src/gstreamer/gstlibcameraprovider.cpp\n> > > +++ b/src/gstreamer/gstlibcameraprovider.cpp\n> > > @@ -12,6 +12,7 @@\n> > >  \n> > >  #include <libcamera/camera.h>\n> > >  #include <libcamera/camera_manager.h>\n> > > +#include <libcamera/property_ids.h>\n> > >  \n> > >  #include \"gstlibcamerasrc.h\"\n> > >  #include \"gstlibcamera-utils.h\"\n> > > @@ -131,6 +132,8 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n> > >         static const std::array roles{ StreamRole::VideoRecording };\n> > >         g_autoptr(GstCaps) caps = gst_caps_new_empty();\n> > >         const gchar *name = camera->id().c_str();\n> > > +       std::string rotation_str;\n> > > +       bool success;\n> > >  \n> > >         std::unique_ptr<CameraConfiguration> config = camera->generateConfiguration(roles);\n> > >         if (!config || config->size() != roles.size()) {\n> > > @@ -144,12 +147,23 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n> > >                         gst_caps_append(caps, sub_caps);\n> > >         }\n> > >  \n> > > +       const int32_t rotation = camera->properties().get(properties::Rotation).value_or(0);\n> > > +       Orientation mountingOrientation = orientationFromRotation(rotation, &success);\n> > > +       rotation_str = success ? orientationToString(mountingOrientation)\n> > > +                              : std::to_string(rotation);\n> > \n> > This puts a 'libcamera style' string \"Rotate0\" into the results/output\n> > of the gstlibcamerasrc ... is there any equivalent for how other\n> > components report the rotation? Is it just a numerical value or is this\n> > a unique property to libcamera elements?\n> \n> I was looking around, and actually we have more options. The general style that\n> has been used on linux is udev style. Typically, udev have generic namespaces\n> such as object.id = 87 / object.serial = 3264, and then API specific looks like\n> alsa.long_card_name = LENOVO-21KCCTO1WW-ThinkPadX1CarbonGen12 (but also\n> api.alsa.card.longname, I bet one of the two is deprecated),\n> api.v4l2.cap.bus_info is what the V4L2 udev plugin do.\n> \n> So with that in mind, we could go really simple and use libcamera.mounting-\n> rotation = number, or api.libcamera.. if we figure-out what is the new standard.\n> \n> In short, we have a way to place API specific stuff there in a way that if there\n> is another standard later they can coexist. Would you prefer this simple\n> approach ?\n\nI don't mind much either way, if you recommend this, I'm fine with it.\n\nRegarding the property value, given that the rotation is an angle in\ndegrees, I think reporting it as a numerical value would be better than\na string.\n\n> > > +\n> > > +       g_autoptr(GstStructure) props =\n> > > +               gst_structure_new(\"camera-properties\",\n> > > +                                 \"mounting-rotation\", G_TYPE_STRING, rotation_str.c_str(),\n> > > +                                 nullptr);\n> > > +\n> > >         return GST_DEVICE(g_object_new(GST_TYPE_LIBCAMERA_DEVICE,\n> > >                                        /* \\todo Use a unique identifier instead of camera name. */\n> > >                                        \"name\", name,\n> > >                                        \"display-name\", name,\n> > >                                        \"caps\", caps,\n> > >                                        \"device-class\", \"Source/Video\",\n> > > +                                      \"properties\", props,\n> > >                                        nullptr));\n> > >  }\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 E0A6DBDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 29 Jun 2025 23:04:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C39A268E00;\n\tMon, 30 Jun 2025 01:04:25 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9698C68DF5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Jun 2025 01:04:23 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id BD88EC75;\n\tMon, 30 Jun 2025 01:04:01 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"gi7utRAj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1751238242;\n\tbh=40JoUXwrrqhQ2f8FsOdf15M7EK9SQFOH19eQnFAzKxE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=gi7utRAjytlrXJpAIJo+vjpf4PWP8N0LGdVsjvu5THiI9WiPw1vh/XDdBj9hDJ7eR\n\tVYLFKFk/tlYvbRin4o/hqrd5gK6ppvUqA7JGJzvqvP2Vbyj9JibdjzPivc/z3uVGP6\n\twLyIGJ1yuYTmdlC0BFCPPAUDMISP4BMKCus7sm4g=","Date":"Mon, 30 Jun 2025 02:03:58 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Nicolas Dufresne <nicolas@ndufresne.ca>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tUmang Jain <uajain@igalia.com>, libcamera-devel@lists.libcamera.org, \n\tGiacomo Cappellini <giacomo.cappellini.87@gmail.com>","Subject":"Re: [PATCH 2/2] libcamera: gstreamer: Report mounting-rotation of\n\tcamera sensor","Message-ID":"<20250629230358.GB20732@pendragon.ideasonboard.com>","References":"<20250627074208.49872-1-uajain@igalia.com>\n\t<20250627074208.49872-3-uajain@igalia.com>\n\t<175101107720.3281735.14107176070325566591@ping.linuxembedded.co.uk>\n\t<f2d9a36d65946e1a1b2ec02714078acd6eaa2ac7.camel@ndufresne.ca>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<f2d9a36d65946e1a1b2ec02714078acd6eaa2ac7.camel@ndufresne.ca>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34773,"web_url":"https://patchwork.libcamera.org/comment/34773/","msgid":"<zgrwr3vfwwtw4hj3q6wm25hkcnktvciyr42xardycy37a7h62k@zkh6bnuofc5y>","date":"2025-07-02T04:17:51","subject":"Re: [PATCH 2/2] libcamera: gstreamer: Report mounting-rotation of\n\tcamera sensor","submitter":{"id":232,"url":"https://patchwork.libcamera.org/api/people/232/","name":"Umang Jain","email":"uajain@igalia.com"},"content":"Hi Nicolas,\n\nOn Fri, Jun 27, 2025 at 10:54:54AM -0400, Nicolas Dufresne wrote:\n> Le vendredi 27 juin 2025 à 08:57 +0100, Kieran Bingham a écrit :\n> > Quoting Umang Jain (2025-06-27 08:42:08)\n> > > Report mounting-rotation of the camera sensor by reading the\n> > > property::Rotation property from libcamera. This is reported\n> > > in GstDevice properties for libcamerasrc element.\n> > > \n> > > Signed-off-by: Umang Jain <uajain@igalia.com>\n> > > ---\n> > >  src/gstreamer/gstlibcameraprovider.cpp | 14 ++++++++++++++\n> > >  1 file changed, 14 insertions(+)\n> > > \n> > > diff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp\n> > > index 5da96ea3..806a149a 100644\n> > > --- a/src/gstreamer/gstlibcameraprovider.cpp\n> > > +++ b/src/gstreamer/gstlibcameraprovider.cpp\n> > > @@ -12,6 +12,7 @@\n> > >  \n> > >  #include <libcamera/camera.h>\n> > >  #include <libcamera/camera_manager.h>\n> > > +#include <libcamera/property_ids.h>\n> > >  \n> > >  #include \"gstlibcamerasrc.h\"\n> > >  #include \"gstlibcamera-utils.h\"\n> > > @@ -131,6 +132,8 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n> > >         static const std::array roles{ StreamRole::VideoRecording };\n> > >         g_autoptr(GstCaps) caps = gst_caps_new_empty();\n> > >         const gchar *name = camera->id().c_str();\n> > > +       std::string rotation_str;\n> > > +       bool success;\n> > >  \n> > >         std::unique_ptr<CameraConfiguration> config = camera->generateConfiguration(roles);\n> > >         if (!config || config->size() != roles.size()) {\n> > > @@ -144,12 +147,23 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n> > >                         gst_caps_append(caps, sub_caps);\n> > >         }\n> > >  \n> > > +       const int32_t rotation = camera->properties().get(properties::Rotation).value_or(0);\n> > > +       Orientation mountingOrientation = orientationFromRotation(rotation, &success);\n> > > +       rotation_str = success ? orientationToString(mountingOrientation)\n> > > +                              : std::to_string(rotation);\n> > \n> > This puts a 'libcamera style' string \"Rotate0\" into the results/output\n> > of the gstlibcamerasrc ... is there any equivalent for how other\n> > components report the rotation? Is it just a numerical value or is this\n> > a unique property to libcamera elements?\n> \n> I was looking around, and actually we have more options. The general style that\n> has been used on linux is udev style. Typically, udev have generic namespaces\n> such as object.id = 87 / object.serial = 3264, and then API specific looks like\n> alsa.long_card_name = LENOVO-21KCCTO1WW-ThinkPadX1CarbonGen12 (but also\n> api.alsa.card.longname, I bet one of the two is deprecated),\n> api.v4l2.cap.bus_info is what the V4L2 udev plugin do.\n> \n> So with that in mind, we could go really simple and use libcamera.mounting-\n> rotation = number, or api.libcamera.. if we figure-out what is the new standard.\n\nI am tempted to go with the api.libcamera.mounting-rotation = number,\nsimilar to what pipewire SPA keys have (although it's\napi.libcamera.rotation there).\n\nhttps://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/spa/include/spa/utils/keys.h#L98\n> \n> In short, we have a way to place API specific stuff there in a way that if there\n> is another standard later they can coexist. Would you prefer this simple\n> approach ?\n> \n> Nicolas\n> \n> > \n> > --\n> > Kieran\n> > \n> > > +\n> > > +       g_autoptr(GstStructure) props =\n> > > +               gst_structure_new(\"camera-properties\",\n> > > +                                 \"mounting-rotation\", G_TYPE_STRING, rotation_str.c_str(),\n> > > +                                 nullptr);\n> > > +\n> > >         return GST_DEVICE(g_object_new(GST_TYPE_LIBCAMERA_DEVICE,\n> > >                                        /* \\todo Use a unique identifier instead of camera name. */\n> > >                                        \"name\", name,\n> > >                                        \"display-name\", name,\n> > >                                        \"caps\", caps,\n> > >                                        \"device-class\", \"Source/Video\",\n> > > +                                      \"properties\", props,\n> > >                                        nullptr));\n> > >  }\n> > >  \n> > > -- \n> > > 2.50.0\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 52E70BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Jul 2025 04:17:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6F8B46151E;\n\tWed,  2 Jul 2025 06:17:56 +0200 (CEST)","from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 039216151E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Jul 2025 06:17:53 +0200 (CEST)","from [49.36.69.17] (helo=uajain) by fanzine2.igalia.com with\n\tesmtpsa \n\t(Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim) id 1uWous-00BINe-LL; Wed, 02 Jul 2025 06:17:51 +0200"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=igalia.com header.i=@igalia.com\n\theader.b=\"UIEdFLb/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n\ts=20170329;\n\th=In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version\n\t:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=xbcSe8dV3tOb5oOPhwgCouaB/gfDOqkmUjk7U9ZDOqw=;\n\tb=UIEdFLb//Wv5p4n9PitzQ4jWRP\n\tZOLDJEjqWnHgJq4KpFPYtcrj4uE4/9Y+/xYTVjjlZxvb1XiXKZLImldBqiSpidwW/05vYBvnb6WbS\n\tvA5sQECnL83msPNjm2xBANIyG33zxX/7ZgxNjazTsbHD1zCrB75MOgnc5T/xIpoqwdOuvt7YNdeqj\n\tODq8UrdLDTBYO1UwgdQZVPX/Y2g4gRnSEtTSwr6r7V7oHiy3t8Eyw9sTQAqmdWLVRsk04HO0F+wls\n\tJo+geRbGh4Jf5vyLkO4YzHjZNT5GGhEay+mkpxuUt6IL9aV9kPE2TMGKjegiXbq+B/BJNZVJCOXJQ\n\tgtZuSUEQ==;","Date":"Wed, 2 Jul 2025 09:47:51 +0530","From":"Umang Jain <uajain@igalia.com>","To":"Nicolas Dufresne <nicolas@ndufresne.ca>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org,\n\tGiacomo Cappellini <giacomo.cappellini.87@gmail.com>","Subject":"Re: [PATCH 2/2] libcamera: gstreamer: Report mounting-rotation of\n\tcamera sensor","Message-ID":"<zgrwr3vfwwtw4hj3q6wm25hkcnktvciyr42xardycy37a7h62k@zkh6bnuofc5y>","References":"<20250627074208.49872-1-uajain@igalia.com>\n\t<20250627074208.49872-3-uajain@igalia.com>\n\t<175101107720.3281735.14107176070325566591@ping.linuxembedded.co.uk>\n\t<f2d9a36d65946e1a1b2ec02714078acd6eaa2ac7.camel@ndufresne.ca>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<f2d9a36d65946e1a1b2ec02714078acd6eaa2ac7.camel@ndufresne.ca>","User-Agent":"NeoMutt/20250510-dirty","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]