From patchwork Thu Feb 4 10:05:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11142 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 5A702BD162 for ; Thu, 4 Feb 2021 10:05:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 278C86143D; Thu, 4 Feb 2021 11:05:59 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="DKcfUn8Q"; dkim-atps=neutral Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AFFAF61402 for ; Thu, 4 Feb 2021 11:05:56 +0100 (CET) Received: by mail-pg1-x52d.google.com with SMTP id i7so1741538pgc.8 for ; Thu, 04 Feb 2021 02:05:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MXSqpr9JOnO1UjiOWF8Ii2WAsULHhudnBjado3OF8Ys=; b=DKcfUn8Q812/OXWA7nkOjvzi4BTpmhvL285pZ4E3vaF1Vcr1AASSg+nbx7j51D20EY E5vV3QEVuGXS1Or3ZMSeTdncP1QS6ohia+POv0kKDyybK7QIFLya3IBuEjH0j1Lperth LN/pTiaAS4nLN1PNMofE6zaYc3EkJkZk8Vfho= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MXSqpr9JOnO1UjiOWF8Ii2WAsULHhudnBjado3OF8Ys=; b=qPw8nwQ6ddhDAOw/TWbYvP9qCRXeeew9qpLyyE/27qz4FMh3Nv6zUGx/KagqhsECFT r63r4qRvHtyGNEMGppMyJ83nfQtfvvjTdmGrmqWvpNve06FVEmLVel7z6X33hqQV3qBK ckXKR2Cbks37cnvAW0OnZA3xzzAoaalN7YG+ioULZp6VsXU8WKt1CudD0eH2nW3WYPRL kZK2oeGl5jxZnPfLvWaQ9yKBpFFYF4Nsv4NRWcOsubZSRI6ulRd3yOmkxxx8+a/2bNi4 5I8FWsno3rAR8vmofG9yNdEVXa7QrSBVzdPy8JOOwxIpeeCpFEOqnlhYRSCTc8E65Bc4 H1YA== X-Gm-Message-State: AOAM532GebaPcfOL4OHrH33WvMeSbrW2CVHhbk2rApWdgGkXr2df9jB5 MkCBarmn1N8YK+XYzYCHyu7XBvD4ntxbhTtr X-Google-Smtp-Source: ABdhPJzIr0NUkcQA6A9WWJlB5dFzi6W/PgKsJnQa3xaB7JJah6nPuYcxmjCk5uKdcnbMUt5hqCdZHA== X-Received: by 2002:a62:1755:0:b029:1cb:4985:4cf8 with SMTP id 82-20020a6217550000b02901cb49854cf8mr7631415pfx.9.1612433155161; Thu, 04 Feb 2021 02:05:55 -0800 (PST) Received: from hiroh.c.googlers.com.com (128.141.236.35.bc.googleusercontent.com. [35.236.141.128]) by smtp.gmail.com with ESMTPSA id j9sm5808418pgb.47.2021.02.04.02.05.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 02:05:54 -0800 (PST) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Thu, 4 Feb 2021 10:05:39 +0000 Message-Id: <20210204100541.657503-5-hiroh@chromium.org> X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog In-Reply-To: <20210204100541.657503-1-hiroh@chromium.org> References: <20210204100541.657503-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 4/6] android: camera_device: Implement toString() in Camera3StreamConfig 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: , Cc: hanlinchen@chromium.org Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This adds toString() function in Camera3StreamConfig and Camera3StreamConfig::Camera3Stream for logging. Signed-off-by: Hirokazu Honda --- src/android/camera_device.cpp | 38 +++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) -- 2.30.0.365.g02bc693789-goog diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 752e17ba..93dfbcdb 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -140,14 +140,48 @@ const std::map camera3FormatsMap = { */ struct Camera3StreamConfig { struct Camera3Stream { - camera3_stream_t *stream; - CameraStream::Type type; + Camera3Stream(camera3_stream_t *stream, CameraStream::Type type) + : stream(stream), type(type) {} + + std::string toString() const; + + camera3_stream_t *stream = nullptr; + CameraStream::Type type = CameraStream::Type::Direct; }; + std::string toString() const; + std::vector streams; StreamConfiguration config; }; +std::string Camera3StreamConfig::Camera3Stream::toString() const { + std::ostringstream os; + os << "format: " << utils::hex(stream->format) + << ", size:" << stream->width << "x" << stream->height; + os << ", type: "; + switch (type) { + case CameraStream::Type::Direct: + os << "Direct"; break; + case CameraStream::Type::Internal: + os << "Internal"; break; + case CameraStream::Type::Mapped: + os << "Mapped"; break; + } + + return os.str(); +} + +std::string Camera3StreamConfig::toString() const { + std::ostringstream os; + for (size_t i = 0; i < streams.size(); ++i) { + os << "Stream #" << i << ": " << streams[i].toString() << "}, "; + } + + os << "config: " << config.toString(); + return os.str(); +} + /* * Reorder the configurations so that libcamera::Camera can accept them as much * as possible. The sort rule is as follows.