From patchwork Thu Jun 6 20:56:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 1377 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 65AC560BB7 for ; Thu, 6 Jun 2019 22:56:59 +0200 (CEST) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 04126549; Thu, 6 Jun 2019 22:56:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1559854619; bh=cqMsU/6hFBve0kvWuImzIiMDPL6s6Fy7ubS3FYzOpTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qjf4PR3pwEh219UGOVRYA7CsDAG4qD+Q7CWHf/VrUj9xDYdUA50bdpqqimf+b5Yhv fwPT35TM5jpNf7tt5ZIxQvhgolTD4lx9kxYbN6QxtqjyL81Kk3piTJdxmtA6W7RTLG r1eyGsqthF2KLCDsr8ChgguGftm9wSYkuV1p34Ig= From: Kieran Bingham To: LibCamera Devel Date: Thu, 6 Jun 2019 21:56:54 +0100 Message-Id: <20190606205654.9311-6-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190606205654.9311-1-kieran.bingham@ideasonboard.com> References: <20190606205654.9311-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 5/5] [PoC] QCam: Control demo: A SineWave Brightness X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2019 20:56:59 -0000 As an example of how to add a control to each request, set the Brightness value with a changing value against the buffer time stamps. The Brightness will go up and down following a sine wave to visualise the control effect on the video stream. Signed-off-by: Kieran Bingham --- src/qcam/main_window.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 8dbe597e7aa2..d3fedce20a9c 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -5,6 +5,7 @@ * main_window.cpp - qcam - Main application window */ +#include #include #include #include @@ -247,6 +248,13 @@ void MainWindow::stopCapture() config_.reset(); } +int SineBrightness(Buffer *buffer) +{ + unsigned int millisec = buffer->timestamp() / 1000000; + constexpr float rads = 2 * M_PI / 180; + return sin(0.036 * rads * millisec) * 100; +} + void MainWindow::requestComplete(Request *request, const std::map &buffers) { @@ -281,6 +289,12 @@ void MainWindow::requestComplete(Request *request, return; } + /* + * A demonstration control, which has a distinct visual effect. + * Scale the brightness up and down with a sine wave. + */ + /* How do we deal with max/min/defaults etc? */ + request->controls().emplace(ManualBrightness, SineBrightness(buffer)); request->setBuffers(buffers); camera_->queueRequest(request);