From patchwork Wed Mar 25 12:28:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3321 Return-Path: Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5525460413 for ; Wed, 25 Mar 2020 13:28:35 +0100 (CET) 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="QFrlnhgW"; dkim-atps=neutral Received: by mail-pg1-x541.google.com with SMTP id d37so573664pgl.1 for ; Wed, 25 Mar 2020 05:28:35 -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:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=Q6I9UawXoamBhb1sEmaI1zjI4rJkcZrpgEsh/JoXrDE=; b=QFrlnhgWdWBw3VzLTA0eCWW8OI6ThYzNUdiIP4r5xTd9jjYSWdRZxraECMGdc1e9Cz Qk98u2N0NZJFjYA3cJhqdEwTdXzz+u4RoiEwibW66dBora7sRd5aYFTSrRZa0zenS6m4 m6LmvhSJGF+dZgVmWGVpvRfgLwykUn2lwHKb0hsyBtKn29b+oEJz9Tu3rX77hyfi+6LH Hln3xb49CfyUXDoFvq2s20S16bhsO/6LzoRAv0TzrQM585hr6VB1K4u29RGEvoCcVvAF HOePk3YdmEs/Zy1/t2d7vn9Ij1trPTmAHN/+dpqctYstzNUuXMv/VEzQlR6uIBHt5OQE YyEw== 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:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=Q6I9UawXoamBhb1sEmaI1zjI4rJkcZrpgEsh/JoXrDE=; b=NMkYNfC+Ngm/z3tmlVsJD3VsqHzA+twkr6sgzoM4IdHNheZNXfhH4qTt8dL0jhRV8j IFDz0PoOc6R+yQF+GjCPIStTEbPTZFAl/zHoThEY64r54Eyybr4sBR/TSOQh6Q6dqHWT bBDrfdLWyKIIvFs3HJ0yt0jBty/f88uOLRoMQL//MUoS/85Wbk5nWpn78Rpz7WFIlenz yEBnZz9wfcLDqrv5jlMS4ycjYVO1rjEZWpCbWyh200nxX0zStxPiRySw2ncMmoO1UFfD SG8myRex/gSEs/ilE0uTKaDRC7q/S95kp5pqCmHtl71BuPE/5eq7/VIn3jyYvq8E2na2 zD7A== X-Gm-Message-State: ANhLgQ3ewQ0a1zo9YUZigxfepIil6Xj4YQIMNI5Wntu72WQEuWPqOT7H A5QyKGfHVEvu1kFNj7vSdH0dO0npBt3qbw== X-Google-Smtp-Source: ADFU+vua6pB7f4kWlSRq+2FC/jVEaEx+ycAIyQYCgpj7PDAZ11dLR+XWlxO93+VfjZN4/U2GclSuIg== X-Received: by 2002:a65:558a:: with SMTP id j10mr2842834pgs.13.1585139313537; Wed, 25 Mar 2020 05:28:33 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.154]) by smtp.gmail.com with ESMTPSA id k20sm2322913pgn.62.2020.03.25.05.28.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Mar 2020 05:28:32 -0700 (PDT) Date: Wed, 25 Mar 2020 17:58:25 +0530 From: Kaaira Gupta To: libcamera-devel@lists.libcamera.org, Kieran Bingham , Helen Koike , Vaishali Thakkar Cc: kgupta@es.iitr.ac.in Message-ID: <20200325122825.GA16172@kaaira-HP-Pavilion-Notebook> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Subject: [libcamera-devel] [PATCH] libcamera: v4l2PixelFormat: replace hex with 4CC 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: Wed, 25 Mar 2020 12:28:35 -0000 Print 4CC characters instead of the hex value in toString() as they are more informative. Signed-off-by: Kaaira Gupta --- src/libcamera/v4l2_videodevice.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index b778181..ea8ee50 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -336,9 +336,15 @@ bool V4L2BufferCache::Entry::operator==(const FrameBuffer &buffer) const */ std::string V4L2PixelFormat::toString() const { - char str[11]; - snprintf(str, 11, "0x%08x", fourcc_); - return str; + std::stringstream ss; + ss << static_cast(fourcc_ & 0x7f) + << static_cast((fourcc_ >> 8) & 0x7f) + << static_cast((fourcc_ >> 16) & 0x7f) + << static_cast((fourcc_ >> 24) & 0x7f); + + if (fourcc_ & (1 << 31)) + ss << "-BE"; + return ss.str(); } /**