From 9f08463997b82c4bf60e12c4ea43577959a8ae15 Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Wed, 25 Jan 2023 10:43:15 +0000 Subject: [PATCH] core: Allow info-text to display on the console This will only work if --info-text is explicitly provided in a command line argument and not defaulted, and --nopreview has been set. Signed-off-by: Naushir Patuck --- core/options.cpp | 5 +++++ preview/null_preview.cpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/core/options.cpp b/core/options.cpp index dab979bf..e3cc69c2 100644 --- a/core/options.cpp +++ b/core/options.cpp @@ -82,6 +82,11 @@ bool Options::Parse(int argc, char *argv[]) if (framerate_ != -1.0) framerate = framerate_; + // Check if --nopreview is set, and if no info-text string was provided + // null the defaulted string so nothing gets displayed to stderr. + if (nopreview && vm["info-text"].defaulted()) + info_text = ""; + // lens_position is even more awkward, because we have two "default" // behaviours: Either no lens movement at all (if option is not given), // or libcamera's default control value (typically the hyperfocal). diff --git a/preview/null_preview.cpp b/preview/null_preview.cpp index d71b71cc..bdd418d2 100644 --- a/preview/null_preview.cpp +++ b/preview/null_preview.cpp @@ -25,6 +25,8 @@ class NullPreview : public Preview // Return the maximum image size allowed. Zeroes mean "no limit". virtual void MaxImageSize(unsigned int &w, unsigned int &h) const override { w = h = 0; } + void SetInfoText(const std::string &text) override { LOG(1, text); } + private: };