Show a patch.

GET /api/patches/15670/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 15670,
    "url": "https://patchwork.libcamera.org/api/patches/15670/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15670/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20220414052652.4165887-3-hanlinchen@chromium.org>",
    "date": "2022-04-14T05:26:52",
    "name": "[libcamera-devel,2/2] android: camera_hal_config: Use YamlParser to parse android HAL config",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "14505f2647e2daa07466aa6f0e03ad948069b6e0",
    "submitter": {
        "id": 98,
        "url": "https://patchwork.libcamera.org/api/people/98/?format=api",
        "name": "Hanlin Chen",
        "email": "hanlinchen@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15670/mbox/",
    "series": [
        {
            "id": 3051,
            "url": "https://patchwork.libcamera.org/api/series/3051/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3051",
            "date": "2022-04-14T05:26:50",
            "name": "Introduce YamlParser for YAML files",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3051/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15670/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15670/checks/",
    "tags": {},
    "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 9DA5CC3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 14 Apr 2022 05:27:05 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A413265650;\n\tThu, 14 Apr 2022 07:27:04 +0200 (CEST)",
            "from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com\n\t[IPv6:2607:f8b0:4864:20::52f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7063B65640\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 14 Apr 2022 07:27:02 +0200 (CEST)",
            "by mail-pg1-x52f.google.com with SMTP id q12so3823503pgj.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Apr 2022 22:27:02 -0700 (PDT)",
            "from localhost ([2401:fa00:1:17:c20c:e39:f6d8:c53b])\n\tby smtp.gmail.com with UTF8SMTPSA id\n\tp12-20020a63ab0c000000b00381f7577a5csm762350pgf.17.2022.04.13.22.26.59\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tWed, 13 Apr 2022 22:27:00 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649914024;\n\tbh=BslGSbGh9JjV4mn5tf+qwrDhy16n6xvfvZDIClCOmq8=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=GqVqdJ1uHrMyEFKLa2i+lko7dXZlOirFMx82VHe75f+MBPIdR7QUaxXnRB4tgkHve\n\tD+XBjf1nR1urB38xBJFml7tyfBLy3q38xICU7ebcxh34HsA7SVWS4UFVWnDkmwEM+z\n\tT+L+Q7TvBK1jWq3HDbqPEn/qB+nziuDg+etgOBuLENHuXzLmVrehfOPDsXTsxdPFrF\n\tC4i+GSUMVrI1GkMEb8Ki6/DJIAN59mMtlnc6gUPbT8Ca8gj9VnhwLeYsx6BewogmmO\n\tmuCK0Db8xRn4CtuBZkPgoTg+niH/iIY2Yx/4i4zowISLmCQPO9MBYudIEGrf1UF7zs\n\t6QeLN2mTe2MzA==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=Crnrs/XhnSFf+Yvj4OncLWMXR9hMzG6plpAAmMw3sMI=;\n\tb=HqvQUT/bYi5pfaknjQu9Ddor2r15gfY2E13JkDwgoHcTpMj7rPlhbZgfLI3XuKLZ1O\n\tmvDrIOwneZp452L3ksx9CP7RlxwqJ8Uzuix2hWF8RpFLLttv2zq5yxU/cbGcbx18xEw9\n\tnfxGLZ6IF9fF8TAMGs2Hxa5jkakUqU9CSDWnY="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"HqvQUT/b\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=Crnrs/XhnSFf+Yvj4OncLWMXR9hMzG6plpAAmMw3sMI=;\n\tb=3ERikUBPvDyYCDt0LlCMgq817XBhdbn2dU6nCQuM+F3HaexEvhrKX1ggzTBlP/gBMC\n\tZaOYrV1WFPvspqAHetQAcPWxM1Xn1CgdBIEAvz+E0wmvLiunae7ccffoVFUAM9jwaYuw\n\tEvuSevhyAU1meTZiY9hUTqGawMMGPB6UI4KFhCcSWqGGzDXILNMFboFh99XlqRtgHLpE\n\t8n1Zu7HxFTLZG9AenWHuE4yDy8M9BZTdT/GibIkA76xPX9497Xp31KM/qAQ7Dxuh1ING\n\tuXWmoDeYLklku8BXYKJ5h8Ex1DieSzCSrEwp1/2TuyeawGdSoBbMy9E/rCr6YVqlQVv8\n\tu2SQ==",
        "X-Gm-Message-State": "AOAM5328by9OY6eKCBmznFpuW9VZPn5DMGQ6Oolq0WrDr1+by6S3mkIo\n\tYryB+Nxv0ZFLpkDzduUTWdqkqlgyL0kmfw==",
        "X-Google-Smtp-Source": "ABdhPJxge7nGXZadxqFgFw+GVi5h69wl++uOrJXWEcDezF0J9Fti9gsdS9ffBpkbp9HX2loCyV3Yyg==",
        "X-Received": "by 2002:a05:6a00:1ad2:b0:505:b770:f02e with SMTP id\n\tf18-20020a056a001ad200b00505b770f02emr2200331pfv.83.1649914020422; \n\tWed, 13 Apr 2022 22:27:00 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 14 Apr 2022 13:26:52 +0800",
        "Message-Id": "<20220414052652.4165887-3-hanlinchen@chromium.org>",
        "X-Mailer": "git-send-email 2.35.1.1178.g4f1659d476-goog",
        "In-Reply-To": "<20220414052652.4165887-1-hanlinchen@chromium.org>",
        "References": "<20220414052652.4165887-1-hanlinchen@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 2/2] android: camera_hal_config: Use\n\tYamlParser to parse android HAL config",
        "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>",
        "From": "Han-Lin Chen via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Han-Lin Chen <hanlinchen@chromium.org>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Use YamlParser to parse android HAL config files, instead of handling\nYAML tokens directly, as a preparation for the further parameter extension.\n\nSigned-off-by: Han-Lin Chen <hanlinchen@chromium.org>\n---\n src/android/camera_hal_config.cpp | 334 +++++++-----------------------\n src/android/meson.build           |   1 -\n 2 files changed, 74 insertions(+), 261 deletions(-)",
    "diff": "diff --git a/src/android/camera_hal_config.cpp b/src/android/camera_hal_config.cpp\nindex aa90dac7..d269ab25 100644\n--- a/src/android/camera_hal_config.cpp\n+++ b/src/android/camera_hal_config.cpp\n@@ -14,15 +14,15 @@ namespace filesystem = std::experimental::filesystem;\n #else\n #include <filesystem>\n #endif\n-#include <stdio.h>\n #include <stdlib.h>\n #include <string>\n-#include <yaml.h>\n \n #include <hardware/camera3.h>\n \n #include <libcamera/base/log.h>\n \n+#include <libcamera/internal/yaml_parser.h>\n+\n using namespace libcamera;\n \n LOG_DEFINE_CATEGORY(HALConfig)\n@@ -37,16 +37,10 @@ public:\n \tint parseConfigFile(FILE *fh, std::map<std::string, CameraConfigData> *cameras);\n \n private:\n-\tstd::string parseValue();\n-\tstd::string parseKey();\n-\tint parseValueBlock();\n-\tint parseCameraLocation(CameraConfigData *cameraConfigData,\n-\t\t\t\tconst std::string &location);\n-\tint parseCameraConfigData(const std::string &cameraId);\n-\tint parseCameras();\n-\tint parseEntry();\n-\n-\tyaml_parser_t parser_;\n+\tint parseCameraConfigData(const std::string &cameraId, const YamlObject &);\n+\tint parseLocation(const YamlObject &, CameraConfigData &cameraConfigData);\n+\tint parseRotation(const YamlObject &, CameraConfigData &cameraConfigData);\n+\n \tstd::map<std::string, CameraConfigData> *cameras_;\n };\n \n@@ -54,290 +48,110 @@ CameraHalConfig::Private::Private()\n {\n }\n \n-std::string CameraHalConfig::Private::parseValue()\n+int CameraHalConfig::Private::parseConfigFile(FILE *fh,\n+\t\t\t\t\t      std::map<std::string, CameraConfigData> *cameras)\n {\n-\tyaml_token_t token;\n-\n-\t/* Make sure the token type is a value and get its content. */\n-\tyaml_parser_scan(&parser_, &token);\n-\tif (token.type != YAML_VALUE_TOKEN) {\n-\t\tyaml_token_delete(&token);\n-\t\treturn \"\";\n-\t}\n-\tyaml_token_delete(&token);\n-\n-\tyaml_parser_scan(&parser_, &token);\n-\tif (token.type != YAML_SCALAR_TOKEN) {\n-\t\tyaml_token_delete(&token);\n-\t\treturn \"\";\n-\t}\n-\n-\tstd::string value(reinterpret_cast<char *>(token.data.scalar.value),\n-\t\t\t  token.data.scalar.length);\n-\tyaml_token_delete(&token);\n-\n-\treturn value;\n-}\n+\t/*\n+\t * Parse the HAL properties.\n+\t *\n+\t * Each camera properties block is a list of properties associated\n+\t * with the ID (as assembled by CameraSensor::generateId()) of the\n+\t * camera they refer to.\n+\t *\n+\t * cameras:\n+\t *   \"camera0 id\":\n+\t *     location: value\n+\t *     rotation: value\n+\t *     ...\n+\t *\n+\t *   \"camera1 id\":\n+\t *     location: value\n+\t *     rotation: value\n+\t *     ...\n+\t */\n \n-std::string CameraHalConfig::Private::parseKey()\n-{\n-\tyaml_token_t token;\n+\tcameras_ = cameras;\n \n-\t/* Make sure the token type is a key and get its value. */\n-\tyaml_parser_scan(&parser_, &token);\n-\tif (token.type != YAML_SCALAR_TOKEN) {\n-\t\tyaml_token_delete(&token);\n-\t\treturn \"\";\n-\t}\n+\tstd::unique_ptr<YamlObject> root = YamlParser::parse(fh);\n+\tif (!root)\n+\t\treturn -EINVAL;\n \n-\tstd::string value(reinterpret_cast<char *>(token.data.scalar.value),\n-\t\t\t  token.data.scalar.length);\n-\tyaml_token_delete(&token);\n+\tif (!root->isDictionary())\n+\t\treturn -EINVAL;\n \n-\treturn value;\n-}\n+\t/* Parse property \"cameras\" */\n+\tif (!root->contains(\"cameras\"))\n+\t\treturn -EINVAL;\n \n-int CameraHalConfig::Private::parseValueBlock()\n-{\n-\tyaml_token_t token;\n+\tconst YamlObject &yamlObjectCameras = (*root)[\"cameras\"];\n \n-\t/* Make sure the next token are VALUE and BLOCK_MAPPING_START. */\n-\tyaml_parser_scan(&parser_, &token);\n-\tif (token.type != YAML_VALUE_TOKEN) {\n-\t\tyaml_token_delete(&token);\n+\tif (!yamlObjectCameras.isDictionary())\n \t\treturn -EINVAL;\n-\t}\n-\tyaml_token_delete(&token);\n \n-\tyaml_parser_scan(&parser_, &token);\n-\tif (token.type != YAML_BLOCK_MAPPING_START_TOKEN) {\n-\t\tyaml_token_delete(&token);\n-\t\treturn -EINVAL;\n+\tstd::vector<std::string> cameraIds = yamlObjectCameras.getMemberNames();\n+\tfor (const std::string &cameraId : cameraIds) {\n+\t\tif (parseCameraConfigData(cameraId,\n+\t\t\t\t\t  yamlObjectCameras[cameraId]))\n+\t\t\treturn -EINVAL;\n \t}\n-\tyaml_token_delete(&token);\n \n \treturn 0;\n }\n \n-int CameraHalConfig::Private::parseCameraLocation(CameraConfigData *cameraConfigData,\n-\t\t\t\t\t\t  const std::string &location)\n-{\n-\tif (location == \"front\")\n-\t\tcameraConfigData->facing = CAMERA_FACING_FRONT;\n-\telse if (location == \"back\")\n-\t\tcameraConfigData->facing = CAMERA_FACING_BACK;\n-\telse\n-\t\treturn -EINVAL;\n+int CameraHalConfig::Private::parseCameraConfigData(const std::string &cameraId,\n+\t\t\t\t\t\t    const YamlObject &cameraObject)\n \n-\treturn 0;\n-}\n-\n-int CameraHalConfig::Private::parseCameraConfigData(const std::string &cameraId)\n {\n-\tint ret = parseValueBlock();\n-\tif (ret)\n-\t\treturn ret;\n-\n-\t/*\n-\t * Parse the camera properties and store them in a cameraConfigData\n-\t * instance.\n-\t *\n-\t * Add a safety counter to make sure we don't loop indefinitely in case\n-\t * the configuration file is malformed.\n-\t */\n-\tCameraConfigData cameraConfigData;\n-\tunsigned int sentinel = 100;\n-\tbool blockEnd = false;\n-\tyaml_token_t token;\n-\n-\tdo {\n-\t\tyaml_parser_scan(&parser_, &token);\n-\t\tswitch (token.type) {\n-\t\tcase YAML_KEY_TOKEN: {\n-\t\t\tyaml_token_delete(&token);\n-\n-\t\t\t/*\n-\t\t\t * Parse the camera property key and make sure it is\n-\t\t\t * valid.\n-\t\t\t */\n-\t\t\tstd::string key = parseKey();\n-\t\t\tstd::string value = parseValue();\n-\t\t\tif (key.empty() || value.empty())\n-\t\t\t\treturn -EINVAL;\n-\n-\t\t\tif (key == \"location\") {\n-\t\t\t\tret = parseCameraLocation(&cameraConfigData, value);\n-\t\t\t\tif (ret) {\n-\t\t\t\t\tLOG(HALConfig, Error)\n-\t\t\t\t\t\t<< \"Unknown location: \" << value;\n-\t\t\t\t\treturn -EINVAL;\n-\t\t\t\t}\n-\t\t\t} else if (key == \"rotation\") {\n-\t\t\t\tret = std::stoi(value);\n-\t\t\t\tif (ret < 0 || ret >= 360) {\n-\t\t\t\t\tLOG(HALConfig, Error)\n-\t\t\t\t\t\t<< \"Unknown rotation: \" << value;\n-\t\t\t\t\treturn -EINVAL;\n-\t\t\t\t}\n-\t\t\t\tcameraConfigData.rotation = ret;\n-\t\t\t} else {\n-\t\t\t\tLOG(HALConfig, Error)\n-\t\t\t\t\t<< \"Unknown key: \" << key;\n-\t\t\t\treturn -EINVAL;\n-\t\t\t}\n-\t\t\tbreak;\n-\t\t}\n-\n-\t\tcase YAML_BLOCK_END_TOKEN:\n-\t\t\tblockEnd = true;\n-\t\t\t[[fallthrough]];\n-\t\tdefault:\n-\t\t\tyaml_token_delete(&token);\n-\t\t\tbreak;\n-\t\t}\n-\n-\t\t--sentinel;\n-\t} while (!blockEnd && sentinel);\n-\tif (!sentinel)\n+\tif (!cameraObject.isDictionary())\n \t\treturn -EINVAL;\n \n-\t(*cameras_)[cameraId] = cameraConfigData;\n-\n-\treturn 0;\n-}\n+\tCameraConfigData &cameraConfigData = (*cameras_)[cameraId];\n \n-int CameraHalConfig::Private::parseCameras()\n-{\n-\tint ret = parseValueBlock();\n-\tif (ret) {\n-\t\tLOG(HALConfig, Error) << \"Configuration file is not valid\";\n-\t\treturn ret;\n-\t}\n+\t/* Parse property \"location\" */\n+\tif (parseLocation(cameraObject, cameraConfigData))\n+\t\treturn -EINVAL;\n \n-\t/*\n-\t * Parse the camera properties.\n-\t *\n-\t * Each camera properties block is a list of properties associated\n-\t * with the ID (as assembled by CameraSensor::generateId()) of the\n-\t * camera they refer to.\n-\t *\n-\t * cameras:\n-\t *   \"camera0 id\":\n-\t *     key: value\n-\t *     key: value\n-\t *     ...\n-\t *\n-\t *   \"camera1 id\":\n-\t *     key: value\n-\t *     key: value\n-\t *     ...\n-\t */\n-\tbool blockEnd = false;\n-\tyaml_token_t token;\n-\tdo {\n-\t\tyaml_parser_scan(&parser_, &token);\n-\t\tswitch (token.type) {\n-\t\tcase YAML_KEY_TOKEN: {\n-\t\t\tyaml_token_delete(&token);\n-\n-\t\t\t/* Parse the camera ID as key of the property list. */\n-\t\t\tstd::string cameraId = parseKey();\n-\t\t\tif (cameraId.empty())\n-\t\t\t\treturn -EINVAL;\n-\n-\t\t\tret = parseCameraConfigData(cameraId);\n-\t\t\tif (ret)\n-\t\t\t\treturn -EINVAL;\n-\t\t\tbreak;\n-\t\t}\n-\t\tcase YAML_BLOCK_END_TOKEN:\n-\t\t\tblockEnd = true;\n-\t\t\t[[fallthrough]];\n-\t\tdefault:\n-\t\t\tyaml_token_delete(&token);\n-\t\t\tbreak;\n-\t\t}\n-\t} while (!blockEnd);\n+\t/* Parse property \"rotation\" */\n+\tif (parseRotation(cameraObject, cameraConfigData))\n+\t\treturn -EINVAL;\n \n \treturn 0;\n }\n \n-int CameraHalConfig::Private::parseEntry()\n+int CameraHalConfig::Private::parseLocation(const YamlObject &cameraObject,\n+\t\t\t\t\t    CameraConfigData &cameraConfigData)\n {\n-\tint ret = -EINVAL;\n+\tif (!cameraObject.contains(\"location\"))\n+\t\treturn -EINVAL;\n \n-\t/*\n-\t * Parse each key we find in the file.\n-\t *\n-\t * The 'cameras' keys maps to a list of (lists) of camera properties.\n-\t */\n+\tstd::string location = cameraObject[\"location\"].get<std::string>(\"\");\n \n-\tstd::string key = parseKey();\n-\tif (key.empty())\n-\t\treturn ret;\n-\n-\tif (key == \"cameras\")\n-\t\tret = parseCameras();\n+\tif (location == \"front\")\n+\t\tcameraConfigData.facing = CAMERA_FACING_FRONT;\n+\telse if (location == \"back\")\n+\t\tcameraConfigData.facing = CAMERA_FACING_BACK;\n \telse\n-\t\tLOG(HALConfig, Error) << \"Unknown key: \" << key;\n+\t\treturn -EINVAL;\n \n-\treturn ret;\n+\treturn 0;\n }\n \n-int CameraHalConfig::Private::parseConfigFile(FILE *fh,\n-\t\t\t\t\t      std::map<std::string, CameraConfigData> *cameras)\n+int CameraHalConfig::Private::parseRotation(const YamlObject &cameraObject,\n+\t\t\t\t\t    CameraConfigData &cameraConfigData)\n {\n-\tcameras_ = cameras;\n-\n-\tint ret = yaml_parser_initialize(&parser_);\n-\tif (!ret) {\n-\t\tLOG(HALConfig, Error) << \"Failed to initialize yaml parser\";\n-\t\treturn -EINVAL;\n-\t}\n-\tyaml_parser_set_input_file(&parser_, fh);\n-\n-\tyaml_token_t token;\n-\tyaml_parser_scan(&parser_, &token);\n-\tif (token.type != YAML_STREAM_START_TOKEN) {\n-\t\tLOG(HALConfig, Error) << \"Configuration file is not valid\";\n-\t\tyaml_token_delete(&token);\n-\t\tyaml_parser_delete(&parser_);\n+\tif (!cameraObject.contains(\"rotation\"))\n \t\treturn -EINVAL;\n-\t}\n-\tyaml_token_delete(&token);\n \n-\tyaml_parser_scan(&parser_, &token);\n-\tif (token.type != YAML_BLOCK_MAPPING_START_TOKEN) {\n-\t\tLOG(HALConfig, Error) << \"Configuration file is not valid\";\n-\t\tyaml_token_delete(&token);\n-\t\tyaml_parser_delete(&parser_);\n+\tint32_t rotation = cameraObject[\"rotation\"].get<int32_t>(-1);\n+\n+\tif (rotation < 0 || rotation >= 360) {\n+\t\tLOG(HALConfig, Error)\n+\t\t\t<< \"Unknown rotation: \" << rotation;\n \t\treturn -EINVAL;\n \t}\n-\tyaml_token_delete(&token);\n-\n-\t/* Parse the file and parse each single key one by one. */\n-\tdo {\n-\t\tyaml_parser_scan(&parser_, &token);\n-\t\tswitch (token.type) {\n-\t\tcase YAML_KEY_TOKEN:\n-\t\t\tyaml_token_delete(&token);\n-\t\t\tret = parseEntry();\n-\t\t\tbreak;\n-\n-\t\tcase YAML_STREAM_END_TOKEN:\n-\t\t\tret = -ENOENT;\n-\t\t\t[[fallthrough]];\n-\t\tdefault:\n-\t\t\tyaml_token_delete(&token);\n-\t\t\tbreak;\n-\t\t}\n-\t} while (ret >= 0);\n-\tyaml_parser_delete(&parser_);\n-\n-\tif (ret && ret != -ENOENT)\n-\t\tLOG(HALConfig, Error) << \"Configuration file is not valid\";\n-\n-\treturn ret == -ENOENT ? 0 : ret;\n+\n+\tcameraConfigData.rotation = rotation;\n+\treturn 0;\n }\n \n CameraHalConfig::CameraHalConfig()\ndiff --git a/src/android/meson.build b/src/android/meson.build\nindex 75b4bf20..1bba54de 100644\n--- a/src/android/meson.build\n+++ b/src/android/meson.build\n@@ -3,7 +3,6 @@\n android_deps = [\n     dependency('libexif', required : get_option('android')),\n     dependency('libjpeg', required : get_option('android')),\n-    dependency('yaml-0.1', required : get_option('android')),\n     libcamera_private,\n ]\n \n",
    "prefixes": [
        "libcamera-devel",
        "2/2"
    ]
}