summaryrefslogtreecommitdiff
path: root/src/apps/common/stream_options.cpp
AgeCommit message (Collapse)Author
4 daysapps: cam: Try raw role if default viewfinder role failsPaul Elder
cam currently defaults to the viewfinder role when no role is specified. This means that on platforms that only support the raw role (such as a raw sensor with no softISP on a simple pipeline platform), generateConfiguration() would return nullptr and cam would bail out. At least this is what is supposed to happen based on the little documentation that we have written regarding generateConfiguration(), specifically in the application writer's guide, which is probably the most influential piece of documentation: The ``Camera::generateConfiguration()`` function accepts a list of desired roles and generates a ``CameraConfiguration`` with the best stream parameters configuration for each of the requested roles. If the camera can handle the requested roles, it returns an initialized ``CameraConfiguration`` and a null pointer if it can't. Currently the simple pipeline handler will return a raw configuration anyway (if it only supports raw) even if a non-raw role was requested. Thus cam receives a raw configuration instead of a nullptr when no role is specified and viewfinder is requested. However, in the near future, support for raw streams with softISP on the simple pipeline handler will be merged. This will notably change the behavior of the simple pipeline handler to return nullptr if a non-raw role was requested on a platform that only supports raw. This is proper behavior according to documentation, but changes cam's behavior as it used to capture fine with no parameters but will no longer be able to. Technically this is an issue with the roles API, as we are mixing roles in the sense of "configuration hints" (eg. viewfinder vs recording vs still capture) with roles in the sense of "platform capabilities" (raw vs everything else). In the long term the proper solution is to rework the roles API. In the meantime, fix cam so that it will try the raw role if the default viewfinder role returns no configuration. cam is an app that is capable of using the raw stream, so this is appropriate behavior. If roles are specified, then do not retry, as in this situation the user knows what streams they can use and what they want. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
2024-05-08libcamera: Drop file name from header comment blocksLaurent Pinchart
Source files in libcamera start by a comment block header, which includes the file name and a one-line description of the file contents. While the latter is useful to get a quick overview of the file contents at a glance, the former is mostly a source of inconvenience. The name in the comments can easily get out of sync with the file name when files are renamed, and copy & paste during development have often lead to incorrect names being used to start with. Readers of the source code are expected to know which file they're looking it. Drop the file name from the header comment block. The change was generated with the following script: ---------------------------------------- dirs="include/libcamera src test utils" declare -rA patterns=( ['c']=' \* ' ['cpp']=' \* ' ['h']=' \* ' ['py']='# ' ['sh']='# ' ) for ext in ${!patterns[@]} ; do files=$(for dir in $dirs ; do find $dir -name "*.${ext}" ; done) pattern=${patterns[${ext}]} for file in $files ; do name=$(basename ${file}) sed -i "s/^\(${pattern}\)${name} - /\1/" "$file" done done ---------------------------------------- This misses several files that are out of sync with the comment block header. Those will be addressed separately and manually. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2023-07-04libcamera: Remove `StreamRoles` aliasBarnabás Pőcze
Now that `Camera::generateConfiguration()` takes a `libcamera::Span` of `StreamRole`, remove the `StreamRoles` type, which was an alias to `std::vector<libcamera::StreamRole>`. The removal has two reasons: - it is no longer strictly necessary, - its presence may suggest that that is the preferred (or correct) way to build/pass a list of `StreamRole`. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> [Kieran: Fix small checkstyle report on roles initialiser] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-02-15apps: Return std::optional<> from StreamKeyValueParser::parseRole()Barnabás Pőcze
Instead of having bool return type and an out parameter, use std::optional<libcamera::StreamRole> to return from StreamKeyValueParser::parseRole(). Meanwhile at it, re-word an existing comment to make it lucid. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2022-10-24apps: Share common source between applicationsLaurent Pinchart
Multiple source files in the src/apps/cam/ directory are used by cam, qcam and lc-compliance. They are compiled separately for each application. Move them to a new src/apps/common/ directory and compile them in a static library to decrease the number of compilation operations. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>