apps: cam: Print an error when outputting DNG and DNG support is missing

When DNG support is missing, the cam application ignores the .dng suffix
of the file pattern and writes raw binary data instead, without
notifying the user. This leads to confusion. Fix it by printing an error
message.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2024-09-25 13:52:58 +03:00
parent 2e47324860
commit b2538c80b9
3 changed files with 68 additions and 25 deletions

View file

@ -256,11 +256,16 @@ int CameraSession::start()
#endif
if (options_.isSet(OptFile)) {
if (!options_[OptFile].toString().empty())
sink_ = std::make_unique<FileSink>(camera_.get(), streamNames_,
options_[OptFile]);
else
sink_ = std::make_unique<FileSink>(camera_.get(), streamNames_);
std::unique_ptr<FileSink> sink =
std::make_unique<FileSink>(camera_.get(), streamNames_);
if (!options_[OptFile].toString().empty()) {
ret = sink->setFilePattern(options_[OptFile]);
if (ret)
return ret;
}
sink_ = std::move(sink);
}
if (sink_) {