[{"id":12857,"web_url":"https://patchwork.libcamera.org/comment/12857/","msgid":"<20200929025409.GU14614@pendragon.ideasonboard.com>","date":"2020-09-29T02:54:09","subject":"Re: [libcamera-devel] [PATCH v2 2/2] android: jpeg: exif: Set\n\ttimezone information","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Umang,\n\nThank you for the patch.\n\nOn Fri, Sep 25, 2020 at 12:06:42AM +0530, Umang Jain wrote:\n> The EXIF specification defines three timezone related tags namely,\n\ns/timezone related/timezone-related/\ns/ namely,/, namely/\n\n> OffsetTime, OffsetTimeOriginal and OffsetTimeDigitized. However,\n> these are not supported by libexif (as of v0.6.21) hence, carry\n> the tags' positional values in our implementation until we get\n> this support from libexif itself.\n> \n> Since these tags were introduced in EXIF specification v2.31, set\n> the exif version number explicitly too.\n> \n> Signed-off-by: Umang Jain <email@uajain.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/android/jpeg/exif.cpp | 29 +++++++++++++++++++++++++++++\n>  1 file changed, 29 insertions(+)\n> \n> diff --git a/src/android/jpeg/exif.cpp b/src/android/jpeg/exif.cpp\n> index a5674b3..32cf897 100644\n> --- a/src/android/jpeg/exif.cpp\n> +++ b/src/android/jpeg/exif.cpp\n> @@ -13,6 +13,16 @@ using namespace libcamera;\n>  \n>  LOG_DEFINE_CATEGORY(EXIF)\n>  \n> +/*\n> + * List of EXIF tags that we set directly because they are not supported\n> + * by libexif version 0.6.21.\n> + */\n> +enum class _ExifTag {\n> +\tOFFSET_TIME              = 0x9010,\n> +\tOFFSET_TIME_ORIGINAL     = 0x9011,\n> +\tOFFSET_TIME_DIGITIZED    = 0x9012,\n> +};\n> +\n>  /*\n>   * The Exif class should be instantiated and specific properties set\n>   * through the exposed public API.\n> @@ -51,6 +61,9 @@ Exif::Exif()\n>  \t */\n>  \texif_data_set_byte_order(data_, EXIF_BYTE_ORDER_INTEL);\n>  \n> +\tsetString(EXIF_IFD_EXIF, EXIF_TAG_EXIF_VERSION,\n> +\t\t  EXIF_FORMAT_UNDEFINED, \"0231\");\n> +\n>  \t/* Create the mandatory EXIF fields with default data. */\n>  \texif_data_fix(data_);\n>  }\n> @@ -197,6 +210,22 @@ void Exif::setTimestamp(time_t timestamp)\n>  \tsetString(EXIF_IFD_0, EXIF_TAG_DATE_TIME, EXIF_FORMAT_ASCII, ts);\n>  \tsetString(EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_ORIGINAL, EXIF_FORMAT_ASCII, ts);\n>  \tsetString(EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_DIGITIZED, EXIF_FORMAT_ASCII, ts);\n> +\n> +\t/* Query and set timezone information if available. */\n> +\tint r = strftime(str, sizeof(str), \"%z\", &tm);\n> +\tif (r > 0) {\n> +\t\tstd::string tz(str);\n> +\t\ttz.insert(3, 1, ':');\n> +\t\tsetString(EXIF_IFD_EXIF,\n> +\t\t\t  static_cast<ExifTag>(_ExifTag::OFFSET_TIME),\n> +\t\t\t  EXIF_FORMAT_ASCII, tz);\n> +\t\tsetString(EXIF_IFD_EXIF,\n> +\t\t\t  static_cast<ExifTag>(_ExifTag::OFFSET_TIME_ORIGINAL),\n> +\t\t\t  EXIF_FORMAT_ASCII, tz);\n> +\t\tsetString(EXIF_IFD_EXIF,\n> +\t\t\t  static_cast<ExifTag>(_ExifTag::OFFSET_TIME_DIGITIZED),\n> +\t\t\t  EXIF_FORMAT_ASCII, tz);\n> +\t}\n>  }\n>  \n>  void Exif::setOrientation(int orientation)","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 19287C3B5C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 29 Sep 2020 02:54:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8026562033;\n\tTue, 29 Sep 2020 04:54:46 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C3CEF60394\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Sep 2020 04:54:44 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3BB86540;\n\tTue, 29 Sep 2020 04:54:44 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"QK10YHSX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1601348084;\n\tbh=bXjpO/IKSGWZ/DABiuY51gE+SL1aIogrNMyYEbl0ZFQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=QK10YHSX84NVruBz6V5glLmzBJe30oMuLJwxUHPNnknN82NeaCZUUSa2cZ9Sk4IIB\n\th/zIQiaKUFW9mMw45m4wdKs8UR7bLgpriUeOgRMjOGFkgziVptIU6os1cbPriPzmAi\n\tE1qRp/a0OHLzG6MxCAyUXY0xaAz72UJPl0WfC474=","Date":"Tue, 29 Sep 2020 05:54:09 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Umang Jain <email@uajain.com>","Message-ID":"<20200929025409.GU14614@pendragon.ideasonboard.com>","References":"<20200924183642.7674-1-email@uajain.com>\n\t<20200924183642.7674-3-email@uajain.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200924183642.7674-3-email@uajain.com>","Subject":"Re: [libcamera-devel] [PATCH v2 2/2] android: jpeg: exif: Set\n\ttimezone information","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":"libcamera-devel@lists.libcamera.org","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>"}}]