From patchwork Mon Feb 27 22:49:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suhrid Subramaniam X-Patchwork-Id: 18318 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 9EC37C3257 for ; Mon, 27 Feb 2023 22:50:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2C50962694; Mon, 27 Feb 2023 23:50:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1677538246; bh=jaN+/nfcez7lJtFUSsvDq4Qe4wyry8QeqzQvJX6JMV4=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ubCoTYpNqjC4txVPKmkati/yhqg7I55kX3hIho4e2yK5e5eI9+g6ff+jQ9viDZKyb tPlZfsSuQSt1r0SeduNFhQHa9FIYrlo9Cm7AwPTOtaTk7vN6c2zAK49FUD5GJ5crxN YQ1D1GVUhzzpIvVMF0NMKjkc5K+JIVhCNaC3/VtNBfVn3u3sRvzvH841OZTIHxOo5P dvU51o6wPY//S+yi0MQJyfYoPaHy6LrM3BU7dnkxApQRTpKdnJkNS3p8w6v2YgKlQI 3M6XuLJpopYBEgxnJEOzaJuQG8cBXIWxfaVYf6hmCNjCwt4I3VMRdbfM4qjA2QkKqc fNWCXPN46yEDw== Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D6F1E62690 for ; Mon, 27 Feb 2023 23:50:44 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="P5WaP6wn"; dkim-atps=neutral Received: by mail-pf1-x435.google.com with SMTP id n2so4551468pfo.12 for ; Mon, 27 Feb 2023 14:50:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TUwIo7V/DDZHADoaLqdJ9JLMhBpB5S/xmzbvJMLuhdc=; b=P5WaP6wn2Uo8eXemNUYiFIKL7Wsgsp5ZoWmqRxnI01mxZLPtSJfMealOjIS/7YUxC0 nzy8F7Uh0BQ3YJbs3dkLVamhyMKkBP0dUvO6D4fOP8pCm2Sna7vE2FWwPUTb/yv1N/lu IK9XBtLUWxa7bY/IzsGDgP3WDeiI/830weBPiIG3nKBbrQsth6DLlSXlzg6WvK3AyEE2 KyP8UNLq+w84yAxAkQ//ezoAjrXLD6fDCLkviFw51gDDYsKyOuh5MvqOmEv0kEHbKXsP X9Dnnb/UjSo4IwBF/Gbo5hNtnT305719lut6ywW8Nnr8QpDXccuUxZ7+CZwM/q+mwLgo 1Hkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TUwIo7V/DDZHADoaLqdJ9JLMhBpB5S/xmzbvJMLuhdc=; b=FqNX5x2k2dd9gSkcsK34Vk9sk4ounk3HLCa1oiPQCah1QLlj0uWKZvphbsP8+5VsrG WnQFxjzmMrlaCQroWyn9vc7jhDoS+qh+nDhrQbOTgefiYyUcXFDxXw0e2xyrFj4gd9Eg oIUN6pJqbVtLklecyoV9kQLQgSOHyyvRjzXjSGJYWJMVQ5XT6nYX/qFef/xHlR/FvVEB erzjxTJ0Skd2Or5NwTWF2Wwgham04q7Fydfn+TcC2K4B/0WYrvOh94npyZUWfogKoCI1 qiUySveIPbT7PYrGYDEuL2xbZyUBIkGR6zFqRY/jl6aSh1Xv+s7oxHiQlICT/tsri+h9 ZVyQ== X-Gm-Message-State: AO0yUKV9JKV2LUDBE2+cOd/AayLhfXTmEU0dw+8k0hza0YxhXnVW3n8a CX8oLBKJCTb9Aelys8kBMpYX+kQ+ohyocA== X-Google-Smtp-Source: AK7set9PK7hWKiaNryfwshNrXshsej1cAJgy7Yp3n2odsHYFzna8hsfXWu8aLC8Et9SRCEdYZzlPpA== X-Received: by 2002:a62:cdcc:0:b0:5e9:5b99:da9a with SMTP id o195-20020a62cdcc000000b005e95b99da9amr627409pfg.3.1677538243117; Mon, 27 Feb 2023 14:50:43 -0800 (PST) Received: from localhost.localdomain (sfosm0151r356001-v22.wiline.com. [67.207.106.98]) by smtp.gmail.com with ESMTPSA id 17-20020aa79111000000b005e00086250asm4663117pfh.125.2023.02.27.14.50.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 14:50:42 -0800 (PST) X-Google-Original-From: Suhrid Subramaniam To: libcamera-devel@lists.libcamera.org Date: Mon, 27 Feb 2023 14:49:10 -0800 Message-Id: <20230227224910.151337-3-suhrid.subramaniam@mediatek.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230227224910.151337-1-suhrid.subramaniam@mediatek.com> References: <20230227224910.151337-1-suhrid.subramaniam@mediatek.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/2] libcamera: pipeline: converter: return unique converter only if Valid 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-Patchwork-Original-From: Suhrid Subramaniam via libcamera-devel From: Suhrid Subramaniam Reply-To: Suhrid Subramaniam Cc: Suhrid Subramaniam Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" - Use isValid() to check if m2m_ exists for the selected converter_. - create an instance of the converter only if it is Valid. Signed-off-by: Suhrid Subramaniam --- src/libcamera/converter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libcamera/converter.cpp b/src/libcamera/converter.cpp index 3de39cff..8a34d068 100644 --- a/src/libcamera/converter.cpp +++ b/src/libcamera/converter.cpp @@ -207,8 +207,9 @@ ConverterFactoryBase::ConverterFactoryBase(const std::string name, std::initiali * \param[in] media Name of the factory * * \return A unique pointer to a new instance of the converter subclass - * corresponding to the named factory or one of its alias. Otherwise a null - * pointer if no such factory exists + * corresponding to the named factory or one of its alias if the converter + * instance is valid (checked using isValid()). Otherwise a null pointer + * if no such factory exists */ std::unique_ptr ConverterFactoryBase::create(MediaDevice *media) { @@ -227,7 +228,7 @@ std::unique_ptr ConverterFactoryBase::create(MediaDevice *media) << factory->name_ << " factory with " << (it == compatibles.end() ? "no" : media->driver()) << " alias."; - return factory->createInstance(media); + return factory->createInstance(media)->isValid() ? factory->createInstance(media) : nullptr; } return nullptr;