From patchwork Tue Jun 23 13:40:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 4157 Return-Path: Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DD92C609A3 for ; Tue, 23 Jun 2020 15:40:24 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=es-iitr-ac-in.20150623.gappssmtp.com header.i=@es-iitr-ac-in.20150623.gappssmtp.com header.b="z2i9R7Mc"; dkim-atps=neutral Received: by mail-pj1-x102d.google.com with SMTP id i4so1570153pjd.0 for ; Tue, 23 Jun 2020 06:40:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=kDuMZCynX/LMITV04QVSH+ESLyKm94erm4jG8m6lBJI=; b=z2i9R7McRK0hrBrB+NLcQY5d9jWZ3c6KOSL0aP5eFsh6PZpDgx2D3/lqUAJhI1P6KQ 8lHnL3VXo9k2SCBWjHvi9fzURh8JPn/zCAAlP0VtCoIuZjBSBoeiiRj5nrlKA3giUNb8 /9Ejx/CL40f6TzxhXe0zu+lTw13MqV1UnVYA/EI20wUphqtpgGD81vQO4vt+lYRQIjnd 65MBX9xEljC/sFkMF6tTpnaAWwJBrsuHc5o3ra8VzmVgOmrjyLlLYn/guQjerc+UYA0y unFHkilx2TBKxuduX+9IdVd9qVzvAz2g6ElqQvfsUNz70obDKdt+p4J2aJOAnXOIJ5vl 6MfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=kDuMZCynX/LMITV04QVSH+ESLyKm94erm4jG8m6lBJI=; b=alNJ4P/D9Ap3nODKYd+mlvmJwxw0WCvLlY9G1/3J8jv473lbvpSYvtM4gE0mgRx54p 86qn+BwPIH1RI+21C5QCNcbfbTlO17tziDl0IvQl55CzFcBxIok02OOrl4FPm3C8+J0d 1uzEympSEqisp5C56qQg6co/ladVvKglLiPsWW6Bj5ko4pxKSzWurArOoaFRVzPUv5Z/ JOZwvtnZo90OY0RdKn3JpD5zD5Rwhd25nuZZdiHQMo80Z2nlOhSoqHDuNkQaQ89RGbTa MFgVl1PEDm97HGJF9PwqvgapfgtimtLbihkVvJY+BNfpIVov1Ty6S5gTfLSN4g/A1cCM 536w== X-Gm-Message-State: AOAM531bmNsRWvUp/ECgKvk32lAFI6p134FCOugfkqzFCzsCHDGd73Z0 6UFsQswYmE4153fKUh2PEUK/rgMuYrrPRw== X-Google-Smtp-Source: ABdhPJzwDJFTnw4hoXFTFoKJjC6LXgwQGJ1pdcN5KaRrKcE7uidgaUvhyMDINXGRhFziOPuyX3cz1Q== X-Received: by 2002:a17:90b:1b06:: with SMTP id nu6mr23215775pjb.106.1592919622863; Tue, 23 Jun 2020 06:40:22 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.178]) by smtp.gmail.com with ESMTPSA id u8sm16815881pfh.215.2020.06.23.06.40.20 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jun 2020 06:40:22 -0700 (PDT) Date: Tue, 23 Jun 2020 19:10:16 +0530 From: Kaaira Gupta To: libcamera-devel@lists.libcamera.org, Kieran Bingham , Niklas =?iso-8859-1?q?S=F6derlund?= Message-ID: <20200623134016.GA17981@kaaira-HP-Pavilion-Notebook> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Subject: [libcamera-devel] [RFC PATCH] libcamera: stream_option: use format name to set cam/qcam format X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2020 13:40:25 -0000 Replace hex input for pixelformats with their format names, for input in cam and qcam. Signed-off-by: Kaaira Gupta --- src/cam/stream_options.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/cam/stream_options.cpp b/src/cam/stream_options.cpp index bd12c8f..b163177 100644 --- a/src/cam/stream_options.cpp +++ b/src/cam/stream_options.cpp @@ -7,6 +7,7 @@ #include "stream_options.h" #include +#include using namespace libcamera; @@ -19,7 +20,7 @@ StreamKeyValueParser::StreamKeyValueParser() ArgumentRequired); addOption("height", OptionInteger, "Height in pixels", ArgumentRequired); - addOption("pixelformat", OptionInteger, "Pixel format", + addOption("pixelformat", OptionString, "Pixel format name", ArgumentRequired); } @@ -96,8 +97,16 @@ int StreamKeyValueParser::updateConfiguration(CameraConfiguration *config, } /* \todo Translate 4CC string to pixelformat with modifier. */ - if (opts.isSet("pixelformat")) - cfg.pixelFormat = PixelFormat(opts["pixelformat"]); + if (opts.isSet("pixelformat")) { + const StreamFormats &formats = cfg.formats(); + std::vector pixelFormats = formats.pixelformats(); + std::vector::iterator ptr; + for (ptr = pixelFormats.begin(); ptr < pixelFormats.end(); ptr++) { + if (opts["pixelformat"].toString() == ptr->toString()) { + cfg.pixelFormat = PixelFormat(*ptr); + } + } + } } return 0;