{"id":20359,"url":"https://patchwork.libcamera.org/api/1.1/patches/20359/?format=json","web_url":"https://patchwork.libcamera.org/patch/20359/","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":"<20240620213607.32583-3-joelselvaraj.oss@gmail.com>","date":"2024-06-20T21:36:07","name":"[2/2] qcam: introduce a command line argument to rotate the viewfinder output","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a653717463284346bb0eb7fe827b7d7110eb8b7f","submitter":{"id":201,"url":"https://patchwork.libcamera.org/api/1.1/people/201/?format=json","name":"Joel Selvaraj","email":"joelselvaraj.oss@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20359/mbox/","series":[{"id":4409,"url":"https://patchwork.libcamera.org/api/1.1/series/4409/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4409","date":"2024-06-20T21:36:05","name":"qcam: rotate the viewfinder output as per camera properties","version":1,"mbox":"https://patchwork.libcamera.org/series/4409/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20359/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20359/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 7F2AFC3294\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 20 Jun 2024 21:46:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D2764654A9;\n\tThu, 20 Jun 2024 23:46:14 +0200 (CEST)","from mail-ot1-x330.google.com (mail-ot1-x330.google.com\n\t[IPv6:2607:f8b0:4864:20::330])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E41B9654A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 20 Jun 2024 23:36:23 +0200 (CEST)","by mail-ot1-x330.google.com with SMTP id\n\t46e09a7af769-7009a3976ebso14693a34.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 20 Jun 2024 14:36:23 -0700 (PDT)","from localhost.localdomain ([67.6.32.220])\n\tby smtp.gmail.com with ESMTPSA id\n\t46e09a7af769-7009c65d116sm60530a34.57.2024.06.20.14.36.20\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 20 Jun 2024 14:36:20 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"drQbbvM2\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20230601; t=1718919381; x=1719524181;\n\tdarn=lists.libcamera.org; \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\t:message-id:reply-to;\n\tbh=wzHF0XV8hR+AE00WCp7mRWTjwhN1sMx3rrREb4N+3kk=;\n\tb=drQbbvM2/MxHZWsWLBMUYGzTbhd+HzkzWL0A5pqCAqU2Cy2T4KJUGRiDCrYzyPUQyd\n\tSpqReYoeBOQ9+63kXzO9oFDJ3pStozPxHanApS7O9GDBoPfCZxFxUgDdecVeg71I50JO\n\t0sztUz9Zea/sWpiSG+Lr0lok1s+zbeYgN2oz295X4ljCo2If9v5VPcV3GLsKLaEKBPnB\n\tNv76r0X/3n+iWUeZV/EfpG9WXG8Xh2FRzEblynpvMyyzyF8+IuENk4b2b1TVPNbewCpg\n\teX8Eaiazd/mem21zIUtndAXZwJmen40nzIz3pstL+mlp2xLotULgAk+M+UKQWaqtJkZ1\n\tuiNQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1718919381; x=1719524181;\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:message-id:reply-to;\n\tbh=wzHF0XV8hR+AE00WCp7mRWTjwhN1sMx3rrREb4N+3kk=;\n\tb=BwAMIPkWoOaU0KDngL2z2mcwvkOPA7lCmqRjx9mfODSiNk/ClZq705VHN4T0u50c+S\n\tIlq8pRSN6DHSyz1+CsaEGqZA07AMnpEuQMeTFwKcxTnYiYjwOorYOh/OnTFvbDmCGYbO\n\tBtY++TU+vqypr8o23Cuc70FNrNLALv2fY5FROiddnx9QmgM2riZ5IIZB6ytN3NkloAbd\n\tkM4lv02+OIh4crjL5CX0gvEcCa9ur6GPx+2MB3mLrbivRyb0JW3yqIgqNL73BGShnIM6\n\t3qD4FtOPPlW8fDINLSc1JLDBexf206gzk1Z4taXmEpgdiGL3x42UFSnB57jDgEMc/MNZ\n\tI8kw==","X-Gm-Message-State":"AOJu0YysDcSzpxOsIwG74qDu0q58i0dRPmi4Ho3l4pCK01rn9iDUggcC\n\t40WgzRooTeeIdtSkkEowmFDIV2FRvm21R95N1aRH/V5s3JAoNLmXIGEdIv1c","X-Google-Smtp-Source":"AGHT+IEpBkP3gTS0/f4ukcwUpMq5NiCXQqYDriqxfLNfkO6A4NsrGabjRyQD8E2kDxMzDiBKOgxqYQ==","X-Received":"by 2002:a05:6830:350e:b0:6f9:624c:b58e with SMTP id\n\t46e09a7af769-7007568d576mr7281759a34.2.1718919381531; \n\tThu, 20 Jun 2024 14:36:21 -0700 (PDT)","From":"Joel Selvaraj <joelselvaraj.oss@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Joel Selvaraj <joelselvaraj.oss@gmail.com>","Subject":"[PATCH 2/2] qcam: introduce a command line argument to rotate the\n\tviewfinder output","Date":"Thu, 20 Jun 2024 16:36:07 -0500","Message-ID":"<20240620213607.32583-3-joelselvaraj.oss@gmail.com>","X-Mailer":"git-send-email 2.45.2","In-Reply-To":"<20240620213607.32583-1-joelselvaraj.oss@gmail.com>","References":"<20240620213607.32583-1-joelselvaraj.oss@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Approved-At":"Thu, 20 Jun 2024 23:46:10 +0200","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>"},"content":"Sometimes devicetrees may not specify the rotation or incorrectly\nspecify it. Introduce a command line argument to quickly test different\nrotations. This also helps in easily identifying the rotation at which\nthe camera is mounted if kernel developer doesn't already know it.\n\nSigned-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>\n---\n src/apps/qcam/main.cpp        |  3 +++\n src/apps/qcam/main_window.cpp | 19 +++++++++++++++++++\n src/apps/qcam/main_window.h   |  1 +\n 3 files changed, 23 insertions(+)","diff":"diff --git a/src/apps/qcam/main.cpp b/src/apps/qcam/main.cpp\nindex 9846fba5..9100c69d 100644\n--- a/src/apps/qcam/main.cpp\n+++ b/src/apps/qcam/main.cpp\n@@ -37,6 +37,9 @@ OptionsParser::Options parseOptions(int argc, char *argv[])\n \t\t\t ArgumentRequired, \"camera\");\n \tparser.addOption(OptHelp, OptionNone, \"Display this help message\",\n \t\t\t \"help\");\n+\tparser.addOption(OptOrientation, OptionString,\n+\t\t\t \"Desired image orientation (rot0, rot90, rot180, rot270)\",\n+\t\t\t \"orientation\", ArgumentRequired, \"orientation\");\n \tparser.addOption(OptRenderer, OptionString,\n \t\t\t \"Choose the renderer type {qt,gles} (default: qt)\",\n \t\t\t \"renderer\", ArgumentRequired, \"renderer\");\ndiff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp\nindex 18c94cf3..aa4a0fa0 100644\n--- a/src/apps/qcam/main_window.cpp\n+++ b/src/apps/qcam/main_window.cpp\n@@ -399,6 +399,25 @@ int MainWindow::startCapture()\n \tif (rotation)\n \t\torientation = orientationFromRotation(*rotation);\n \n+\t/* Override if user specifies orientation in command line argument */\n+\tif (options_.isSet(OptOrientation)) {\n+\t\tstd::string orientOpt = options_[OptOrientation].toString();\n+\t\tstatic const std::map<std::string, Orientation> possible_orientations{\n+\t\t\t{ \"rot0\", Orientation::Rotate0 },\n+\t\t\t{ \"rot90\", Orientation::Rotate90 },\n+\t\t\t{ \"rot180\", Orientation::Rotate180 },\n+\t\t\t{ \"rot270\", Orientation::Rotate270 },\n+\t\t};\n+\n+\t\tauto requested_orientation = possible_orientations.find(orientOpt);\n+\t\tif (requested_orientation == possible_orientations.end()) {\n+\t\t\tstd::cerr << \"Unsupported orientation \" << orientOpt << std::endl;\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\torientation = requested_orientation->second;\n+\t}\n+\n \tStreamConfiguration &vfConfig = config_->at(0);\n \n \t/* Use a format supported by the viewfinder if available. */\ndiff --git a/src/apps/qcam/main_window.h b/src/apps/qcam/main_window.h\nindex 4cead734..6dbcd88d 100644\n--- a/src/apps/qcam/main_window.h\n+++ b/src/apps/qcam/main_window.h\n@@ -40,6 +40,7 @@ class HotplugEvent;\n enum {\n \tOptCamera = 'c',\n \tOptHelp = 'h',\n+\tOptOrientation = 'o',\n \tOptRenderer = 'r',\n \tOptStream = 's',\n \tOptVerbose = 'v',\n","prefixes":["2/2"]}