{"id":17362,"url":"https://patchwork.libcamera.org/api/1.1/patches/17362/?format=json","web_url":"https://patchwork.libcamera.org/patch/17362/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220912095656.19013-2-rishikeshdonadkar@gmail.com>","date":"2022-09-12T09:56:55","name":"[libcamera-devel,v4,1/2] gstreamer: Configure the camera before exposing the caps.","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"cc638d259667d72c6eb2b0d91175993e693d9e93","submitter":{"id":118,"url":"https://patchwork.libcamera.org/api/1.1/people/118/?format=json","name":"Rishikesh Donadkar","email":"rishikeshdonadkar@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17362/mbox/","series":[{"id":3482,"url":"https://patchwork.libcamera.org/api/1.1/series/3482/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3482","date":"2022-09-12T09:56:54","name":"Provide framerate support for libcamerasrc","version":4,"mbox":"https://patchwork.libcamera.org/series/3482/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17362/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17362/checks/","tags":{},"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 BB81FC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Sep 2022 09:57:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 76DBA61F91;\n\tMon, 12 Sep 2022 11:57:31 +0200 (CEST)","from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com\n\t[IPv6:2607:f8b0:4864:20::52c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5A36E6099F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Sep 2022 11:57:30 +0200 (CEST)","by mail-pg1-x52c.google.com with SMTP id bh13so7785688pgb.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Sep 2022 02:57:30 -0700 (PDT)","from localhost.localdomain ([49.36.99.4])\n\tby smtp.googlemail.com with ESMTPSA id\n\tt14-20020aa7946e000000b00540dbae6272sm4959495pfq.213.2022.09.12.02.57.26\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 12 Sep 2022 02:57:28 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662976651;\n\tbh=lQJSaQUTc8orZsX78oB9WnufDadrd7DfitQsi3JpdTo=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=yRkrVc2MbcKQN8UihCASowFt05O2ktWCygG+m+9jHfNFQgcK9X34fun9k02tZC1fq\n\taSHJPMISRjIDwMSAr3ShBnUfuINf+0+G1+SKK7JwjVnspdZgJo8eUi+la1hqOVSo7Y\n\tbpwjyyM7xfwZiaddGyC88w20fFrl9BQRhbTh+v9IQxiRSLN8LLRr5Se66H/t1ezCHF\n\t8/3PrlzPzoZU6trYvfTPuC1DTFg5kNuCl9DsvBPs6ZCESIkVQ8jduCuG7TNulTIGzv\n\tQpsO0Fw4asN4WltDLJZ4xjFXtJB+vBzshGqT5XJmYHOB8++veQzz1b5TkhE+O/55W1\n\tgd2fxpJvL2Tew==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date;\n\tbh=5+ghm+efHEtiWjyQKatJom7BmBXXmwJFSAjK5d4VpSQ=;\n\tb=HtveaVHBytp3clHpdVEOc0XlFQb8zu5MdzXCKxJc0rnj0ezp0w1uFga3SrZJKC5S1x\n\tdVWu+xGjcuX+8BPykFOptglBpHPC+yIKkVvqZ9nuBoOR8kNM1vyygL6/+fSzvxKIY+eP\n\tMnz2UkomxIZtVw3U5MakTLD4Rn0+UKN3ooXn6J29VzXEbMpHNnQs611ttGlF2FYHXNQ7\n\tT0ARPJs2+iJWd7hUIQPf6WwuM5tUa3+9QKqp3+OACSpcE2NRVqrone44T8xjkLWs0LUb\n\tdLEhdYse3V2c13aAK+GXBPZt4daOCooCsgyqY8VYWM5MspKL0H17BLiWKTNuRhwQ7B55\n\tNilQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"HtveaVHB\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date;\n\tbh=5+ghm+efHEtiWjyQKatJom7BmBXXmwJFSAjK5d4VpSQ=;\n\tb=bVyNrwA4u+PdLv0IvR1JAK7hz+Dzmy8ZQSoFJWDkgxRYbxi0I60j4d0Dwmnv1jmnGk\n\toc/Lxe6YiN7gRtcdzlUspOu9kkxZ80r7Dt5YwKraL91C0/E5HsSANVxbNwg+4nqbX5F4\n\tiaKq9+sE1CdI0LhGbV76eqEnPKmZZ4m9qRIuzqWX6Ag5gGLlg63g/HvG7SZNnQnWYNpT\n\ttYB9dl9NzGznaRRVW/P1RtTiCzTKR4QsATIb3Kd4TxeOOIsTCNUSUhPjmxoyMKqKtmIB\n\tNTdnV72Tpz8pDjXliW5GOM5V8XFCL3BSLIROuoLOoWoh629G+r56e0CkwMXsYV7G0She\n\tYbvQ==","X-Gm-Message-State":"ACgBeo1J9pdLxJV1hP2p74Md6L/yFfMB38PylHB8vEts1A5AKYKkIrn/\n\tdXjurg7jWTnXlA4j9BWu3ivfL40JBf0T1g==","X-Google-Smtp-Source":"AA6agR7RmT2wfV4THNh5wpCfV2FhYDWqmqDLhnGKcwuh+Bfzkgiu5OUuAJBwISGQfZRXX9jM9wNI9A==","X-Received":"by 2002:a63:8241:0:b0:435:fa7:f0f1 with SMTP id\n\tw62-20020a638241000000b004350fa7f0f1mr19819270pgd.155.1662976648727; \n\tMon, 12 Sep 2022 02:57:28 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 12 Sep 2022 15:26:55 +0530","Message-Id":"<20220912095656.19013-2-rishikeshdonadkar@gmail.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220912095656.19013-1-rishikeshdonadkar@gmail.com>","References":"<20220912095656.19013-1-rishikeshdonadkar@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 1/2] gstreamer: Configure the camera\n\tbefore exposing the caps.","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>","From":"Rishikesh Donadkar via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Rishikesh Donadkar <rishikeshdonadkar@gmail.com>","Cc":"nicolas.dufresne@collabora.com, vedantparanjape160201@gmail.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"In libcamerasrc capabilities are exposed on the src pad before\nconfiguring the camera. To add support to control and\nnegotiate the framerate, the controls::FrameDuration needs to be\nbound checked between the min/max values that camera can support\nand later the applied framerate needs to be exposed along with\nresolutions and colorimetry through caps. Valid bounds of the\ncontrols::FrameDuration cannot be known before the\nconfiguration of the camera.\n\nShift the camera::configure() before the for loop that is exposing\nresolutions, colorimetry to the GStreamer through a new CAPS event.\nThrough this we can know the valid bounds of the FrameDuration and\nclam the frame_duration accordingly before applying to the camera.\nThrough this caps can be exposed without a need of additional new\nCAPS event for framerate.\n\nSigned-off-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com>\n---\n src/gstreamer/gstlibcamerasrc.cpp | 18 +++++++++---------\n 1 file changed, 9 insertions(+), 9 deletions(-)","diff":"diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex 16d70fea..1ee1d08a 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -515,6 +515,15 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread,\n \t\tgoto done;\n \t}\n \n+\tret = state->cam_->configure(state->config_.get());\n+\tif (ret) {\n+\t\tGST_ELEMENT_ERROR(self, RESOURCE, SETTINGS,\n+\t\t\t\t  (\"Failed to configure camera: %s\", g_strerror(-ret)),\n+\t\t\t\t  (\"Camera::configure() failed with error code %i\", ret));\n+\t\tgst_task_stop(task);\n+\t\treturn;\n+\t}\n+\n \t/*\n \t * Regardless if it has been modified, create clean caps and push the\n \t * caps event. Downstream will decide if the caps are acceptable.\n@@ -535,15 +544,6 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread,\n \t\tgst_pad_push_event(srcpad, gst_event_new_segment(&segment));\n \t}\n \n-\tret = state->cam_->configure(state->config_.get());\n-\tif (ret) {\n-\t\tGST_ELEMENT_ERROR(self, RESOURCE, SETTINGS,\n-\t\t\t\t  (\"Failed to configure camera: %s\", g_strerror(-ret)),\n-\t\t\t\t  (\"Camera::configure() failed with error code %i\", ret));\n-\t\tgst_task_stop(task);\n-\t\treturn;\n-\t}\n-\n \tself->allocator = gst_libcamera_allocator_new(state->cam_, state->config_.get());\n \tif (!self->allocator) {\n \t\tGST_ELEMENT_ERROR(self, RESOURCE, NO_SPACE_LEFT,\n","prefixes":["libcamera-devel","v4","1/2"]}