[libcamera-devel,12/14] libcamera: pipeline: simple: Load a converter configuration file (if any)
diff mbox series

Message ID 20220908184850.1874303-13-xavier.roumegue@oss.nxp.com
State Changes Requested
Headers show
Series
  • Add dw100 dewarper support to simple/rkisp1 pipeline
Related show

Commit Message

Xavier Roumegue Sept. 8, 2022, 6:48 p.m. UTC
Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
---
 src/libcamera/pipeline/simple/simple.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Laurent Pinchart Oct. 3, 2022, 11:06 p.m. UTC | #1
Hi Xavier,

Thank you for the patch.

On Thu, Sep 08, 2022 at 08:48:48PM +0200, Xavier Roumegue via libcamera-devel wrote:

As for the error patches, a commit message is needed.

> Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
> ---
>  src/libcamera/pipeline/simple/simple.cpp | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
> index a5970234..31d10c56 100644
> --- a/src/libcamera/pipeline/simple/simple.cpp
> +++ b/src/libcamera/pipeline/simple/simple.cpp
> @@ -498,6 +498,14 @@ int SimpleCameraData::init()
>  				<< "Failed to create converter, disabling format conversion";
>  			converter_.reset();
>  		} else {
> +			char const *configFromEnv = utils::secure_getenv("LIBCAMERA_SIMPLE_CONVERTER_FILE");
> +
> +			if (configFromEnv && *configFromEnv != '\0') {
> +				LOG(SimplePipeline, Debug)
> +					<< "Getting simple converter filename as " << std::string(configFromEnv);

This duplicates the debug message in
V4L2M2MConverter::loadConfiguration().

> +				converter_->loadConfiguration(std::string(configFromEnv));
> +			}

This is quite a hack. It may be OK for initial tests, but we need a
better mechanism to pick a proper configuration file. This also applies
to the rkisp1 pipeline handler.

> +
>  			converter_->inputBufferReady.connect(this, &SimpleCameraData::converterInputDone);
>  			converter_->outputBufferReady.connect(this, &SimpleCameraData::converterOutputDone);
>  		}

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index a5970234..31d10c56 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -498,6 +498,14 @@  int SimpleCameraData::init()
 				<< "Failed to create converter, disabling format conversion";
 			converter_.reset();
 		} else {
+			char const *configFromEnv = utils::secure_getenv("LIBCAMERA_SIMPLE_CONVERTER_FILE");
+
+			if (configFromEnv && *configFromEnv != '\0') {
+				LOG(SimplePipeline, Debug)
+					<< "Getting simple converter filename as " << std::string(configFromEnv);
+				converter_->loadConfiguration(std::string(configFromEnv));
+			}
+
 			converter_->inputBufferReady.connect(this, &SimpleCameraData::converterInputDone);
 			converter_->outputBufferReady.connect(this, &SimpleCameraData::converterOutputDone);
 		}