{"id":9022,"url":"https://patchwork.libcamera.org/api/1.1/patches/9022/?format=json","web_url":"https://patchwork.libcamera.org/patch/9022/","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":"<20200727162143.31317-2-kgupta@es.iitr.ac.in>","date":"2020-07-27T16:21:41","name":"[libcamera-devel,v4,1/3] libcamera: formats: PixelFormatInfo: Add name lookup function","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"146cd7dd87a5c807dc272ce72c4bb9f3f2b76fd4","submitter":{"id":39,"url":"https://patchwork.libcamera.org/api/1.1/people/39/?format=json","name":"Kaaira Gupta","email":"kgupta@es.iitr.ac.in"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9022/mbox/","series":[{"id":1153,"url":"https://patchwork.libcamera.org/api/1.1/series/1153/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1153","date":"2020-07-27T16:21:40","name":"Enable formats lookup based on name","version":4,"mbox":"https://patchwork.libcamera.org/series/1153/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9022/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9022/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 6F694BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Jul 2020 16:21:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3AD0A616B9;\n\tMon, 27 Jul 2020 18:21:57 +0200 (CEST)","from mail-pl1-x629.google.com (mail-pl1-x629.google.com\n\t[IPv6:2607:f8b0:4864:20::629])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 95B24605B2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jul 2020 18:21:55 +0200 (CEST)","by mail-pl1-x629.google.com with SMTP id 72so8292810ple.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jul 2020 09:21:55 -0700 (PDT)","from kaaira-HP-Pavilion-Notebook ([103.113.213.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tm4sm8439652pgh.9.2020.07.27.09.21.52\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 27 Jul 2020 09:21:53 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=es-iitr-ac-in.20150623.gappssmtp.com\n\theader.i=@es-iitr-ac-in.20150623.gappssmtp.com\n\theader.b=\"ha/2+6qW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=z90V0beLLE9VzXH+tiPKxbEQOcvvOKJveodD5jSzWoE=;\n\tb=ha/2+6qWMrOmP++Sj6xPcVd2I9dnpb7AqBtllVpxhAqOdgldl1A6h36IJWlhHp8IOj\n\tAKMNtCxDqNDiOdI2iFrCeMoQBP3WXWdBwDazfTf6aFDJ+kJHK3nzwtGz+s4U1yhCU02H\n\tyPuZZigN7INR8c5tUJqG4g5gxLFQ7vsBxBNwtNvljTkyOXhTpl+/eEkj3WrqtEAIeKAa\n\tX9La+JuXMcJtnAKuwGbjSpiF1IP8Wh57QSmNfgqgfRzRgVn0aTa21JXDG0TvMWKBRKMO\n\t3msIgCArtvd0hfXvICXGcNxdrFHV7q/VqxdWVK9OHNWPP+d1xxd9twz7y/N60ACWk6Vu\n\tRNzw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=z90V0beLLE9VzXH+tiPKxbEQOcvvOKJveodD5jSzWoE=;\n\tb=DQ7U00S5cf1v7dCpp0AIgkQnHJYkOoEkMB2WjzzxX7F+J3zFjuAnKPaA7Sc0pZVjBa\n\tphLJqEWfPmy0iA2hPkXwWj1+hV4KVkTNqF9dIuuoyLXiqpRkd2CIokdCWeQC7B80XVeW\n\tpSxa/wQley/Iceyxn3JLRETtgFG7AgiiL4d5J8P+xfof00eJKnaLgLOVx6cEZZr+NZ8O\n\tN+23OMWsuFqNMXyXMCm6KSF6nNrV2hHC7BNGD5+6Cw9moFcjEVeCGNuDMOJ3iyNuCTFS\n\tcBMiXZnNYI3hISWy7KtJNlZXKOwavZcRLzFva2Zro0dH69v0o3UFj960r6ac3genVkMt\n\t5tkg==","X-Gm-Message-State":"AOAM533TiumovacG92G4NdEYhmyDQ1Jnn4rJCj68MW+346TLuHA2+MVQ\n\tJpTF8E7/vCWlX31fW+FGj2rpyg==","X-Google-Smtp-Source":"ABdhPJyRZCGmOBRfDqiu/A8rou5zcjoGo1s9ELrAuj32pf9uvZjWGlt0XE1vbPABHGC0xHN6TQ3xog==","X-Received":"by 2002:a17:902:b207:: with SMTP id\n\tt7mr19308837plr.135.1595866914237; \n\tMon, 27 Jul 2020 09:21:54 -0700 (PDT)","From":"Kaaira Gupta <kgupta@es.iitr.ac.in>","To":"libcamera-devel@lists.libcamera.org, Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>, =?utf-8?q?Niklas_S=C3=B6derlund?=\n\t<niklas.soderlund@ragnatech.se>","Date":"Mon, 27 Jul 2020 21:51:41 +0530","Message-Id":"<20200727162143.31317-2-kgupta@es.iitr.ac.in>","X-Mailer":"git-send-email 2.17.1","In-Reply-To":"<20200727162143.31317-1-kgupta@es.iitr.ac.in>","References":"<20200727162143.31317-1-kgupta@es.iitr.ac.in>","Subject":"[libcamera-devel] [PATCH v4 1/3] libcamera: formats:\n\tPixelFormatInfo: Add name lookup function","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":"Kaaira Gupta <kgupta@es.iitr.ac.in>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add a function which returns PixelFormatInfo, given format name as\na string.\n\nSigned-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>\n---\n include/libcamera/internal/formats.h |  1 +\n src/libcamera/formats.cpp            | 16 ++++++++++++++++\n 2 files changed, 17 insertions(+)","diff":"diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h\nindex 0bb1510..b8e4749 100644\n--- a/include/libcamera/internal/formats.h\n+++ b/include/libcamera/internal/formats.h\n@@ -38,6 +38,7 @@ public:\n \n \tstatic const PixelFormatInfo &info(const PixelFormat &format);\n \tstatic const PixelFormatInfo &info(const V4L2PixelFormat &format);\n+\tstatic const PixelFormatInfo &info(const std::string &name);\n \n \tunsigned int stride(unsigned int width, unsigned int plane,\n \t\t\t    unsigned int align = 1) const;\ndiff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\nindex 11774b0..5f14281 100644\n--- a/src/libcamera/formats.cpp\n+++ b/src/libcamera/formats.cpp\n@@ -663,6 +663,22 @@ const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)\n \treturn info->second;\n }\n \n+/**\n+ * \\brief Retrieve information about a pixel format\n+ * \\param[in] name The name of pixel format\n+ * \\return The PixelFormatInfo describing the \\a name if known, or an\n+ * invalid PixelFormatInfo otherwise\n+ */\n+const PixelFormatInfo &PixelFormatInfo::info(const std::string &name)\n+{\n+\tfor (const auto &info : pixelFormatInfo) {\n+\t\tif (info.second.name == name)\n+\t\t\treturn info.second;\n+\t}\n+\n+\treturn pixelFormatInfoInvalid;\n+}\n+\n /**\n  * \\brief Compute the stride\n  * \\param[in] width The width of the line, in pixels\n","prefixes":["libcamera-devel","v4","1/3"]}