Skip to content

Commit

Permalink
core: Allow info-text to display on the console
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
naushir authored and davidplowman committed Jan 25, 2023
1 parent 77a03d9 commit 9f08463
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 2 additions & 0 deletions preview/null_preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
};

Expand Down

0 comments on commit 9f08463

Please sign in to comment.