summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2020-05-21libcamera: raspberry: Fix segfault in ~RPiCameraData()Jacopo Mondi
The RPiCameraData class destructor tries to stop its ipa_ instance without making sure it has been initialized. If the RPiCameraData gets destroyed before its ipa_ member is initialized, for example if the sensor initialization fails during the match() function, a nullptr dereference segfault is triggered preventing a graceful library teardown. Fix this by checking for ipa_ to be initialized before stopping it. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-05-21libcamera: camera_sensor: Update properties parsingJacopo Mondi
Update the properties parsing routine in the CameraSensor class to use the newly defined V4L2 control V4L2_CID_CAMERA_ORIENTATION in place of the downstream V4L2_CID_CAMERA_SENSOR_LOCATION which has now been removed. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-05-19libcamera: v4l2_videodevice: Use FileDescriptor "fd move" constructorLaurent Pinchart
Use the newly added "fd move" constructor of the FileDescriptor class to avoid dup() + close(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2020-05-19libcamera: file_descriptor: Implement move semantics for constructorLaurent Pinchart
The FileDescriptor class, when constructed from a numerical file descriptor, duplicates the file descriptor and takes ownership of the copy. The caller has to close the original file descriptor manually if needed. This is inefficient as the dup() and close() calls could be avoided, but can also lead to resource leakage, as recently shown by commit 353fc4c22322 ("libcamera: v4l2_videodevice: Fix dangling file descriptor"). In an attempt to solve this problem, implement move semantics for the FileDescriptor constructor. The constructor taking a numerical file descriptor is split in two variants: - A "fd copy" constructor that takes a const lvalue reference to a numerical file descriptor and duplicates it (corresponding to the current behaviour). - A "fd move" constructor that takes a rvalue reference to a numerical file descriptor and takes ownership of it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2020-05-18(q)cam: Fix header guardsLaurent Pinchart
Several headers belonging to cam and qcam use __LIBCAMERA_*_H__ as a header guard. They're not part of the libcamera core, use __CAM_*_H__ and __QCAM_*_H__ instead, similarly to all other headers of cam and qcam. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-05-18libcamera: v4l2_videodevice: Fix dangling file descriptorNaushir Patuck
The FileDescriptor constructor used in V4L2VideoDevice::exportDmabufFd() creates a duplicate of the fd to store in the object. The original fd returned by the VIDIOC_EXPBUF ioctl was never closed, and left dangling. This would cause out of memory conditions if the camera stream was repeatedly started and stopped. This change closes the original fd explicitly, fixing the leak. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-18meson: Rename variables storing headers listsLaurent Pinchart
The list of public, IPA and internal header files are stored in three meson variables, named libcamera_api, libcamera_ipa_api and libcamera_headers respectively. The lack of uniformity is a bit confusing. Fix it by renaming those variables to libcamera_public_headers, libcamera_ipa_headers and libcamera_internal_headers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-05-16libcamera: Move IPA headers from include/ipa/ to include/libcamera/ipa/Laurent Pinchart
The IPA headers are installed into $prefix/include/libcamera/ipa/, but are located in the source tree in include/ipa/. This requires files within libcamera to include them with #include <ipa/foo.h> while a third party IPA would need to use #include <libcamera/ipa/foo.h> Not only is this inconsistent, it can create issues later if IPA headers need to include each other, as the first form of include directive wouldn't be valid once the headers are installed. Fix the problem by moving the IPA headers to include/libcamera/ipa/. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2020-05-16libcamera: Move internal headers to include/libcamera/internal/Laurent Pinchart
The libcamera internal headers are located in src/libcamera/include/. The directory is added to the compiler headers search path with a meson include_directories() directive, and internal headers are included with (e.g. for the internal semaphore.h header) #include "semaphore.h" All was well, until libcxx decided to implement the C++20 synchronization library. The __threading_support header gained a #include <semaphore.h> to include the pthread's semaphore support. As include_directories() adds src/libcamera/include/ to the compiler search path with -I, the internal semaphore.h is included instead of the pthread version. Needless to say, the compiler isn't happy. Three options have been considered to fix this issue: - Use -iquote instead of -I. The -iquote option instructs gcc to only consider the header search path for headers included with the "" version. Meson unfortunately doesn't support this option. - Rename the internal semaphore.h header. This was deemed to be the beginning of a long whack-a-mole game, where namespace clashes with system libraries would appear over time (possibly dependent on particular system configurations) and would need to be constantly fixed. - Move the internal headers to another directory to create a unique namespace through path components. This causes lots of churn in all the existing source files through the all project. The first option would be best, but isn't available to us due to missing support in meson. Even if -iquote support was added, we would need to fix the problem before a new version of meson containing the required support would be released. The third option is thus the only practical solution available. Bite the bullet, and do it, moving headers to include/libcamera/internal/. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2020-05-15libcamera: pipeline: raspberrypi: Move StaggeredCtrl to libcamera namespaceLaurent Pinchart
The StaggeredCtrl class, part of the Raspberry Pi pipeline handler, is part of libcamera. Move it to the libcamera namespace to simplify usage of libcamera APIs. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2020-05-15libcamera: pipeline: raspberrypi: Don't inline all of StaggeredCtrlLaurent Pinchart
The StaggeredCtrl class has large functions, move them to a .cpp file instead of inlining them all to reduce the binary size. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2020-05-13ipa: Only sign IPA modules that are being installedLaurent Pinchart
The ipa-sign-install.sh script, run when installing libcamera, signs all IPA modules present in the module directory. This would result in third-party modules being signed if any are present in the directory. Fix it by explicitly passing the list of IPA modules to the ipa-sign-install.sh script. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Tomasz Figa <tfiga@chromium.org>
2020-05-13licenses: License all meson files under CC0-1.0Laurent Pinchart
In an attempt to clarify the license terms of all files in the libcamera project, the build system files deserve particular attention. While they describe how the binaries are created, they are not themselves transformed into any part of binary distributions of the software, and thus don't influence the copyright on the binary packages. They are however subject to copyright, and thus influence the distribution terms of the source packages. Most of the meson.build files would not meet the threshold of originality criteria required for copyright protection. Some of the more complex meson.build files may be eligible for copyright protection. To avoid any ambiguity and uncertainty, state our intent to not assert copyrights on the build system files by putting them in the public domain with the CC0-1.0 license. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Naushir Patuck <naush@raspberrypi.com> Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Show Liu <show.liu@linaro.org>
2020-05-12libcamera: proxy: Relicense proxy worker under LGPLLaurent Pinchart
The proxy worker is licensed under the GPL. It is compiled as a binary separate from libcamera.so, and it is our understanding and intent that the GPL license doesn't propagate to libcamera.so. However, as the worker is executed by libcamera.so, the GPL license may cause concerns in this context, regardless of whether the concerns are valid or not. This uncertainty could be addressed by a combination of a legal review and an explicit intent clarification from the copyright holders. A simpler option is to relicense the code under the LGPL. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Paul Elder <paul.elder@ideasonboard.com>
2020-05-11libcamera: raspberrypi: Add components to meson buildNaushir Patuck
Add the Raspberry Pi pipeline handler and IPA as targets in the meson build system. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-11libcamera: ipa: Raspberry Pi IPANaushir Patuck
Initial implementation of the Raspberry Pi (BCM2835) libcamera IPA and associated libraries. All code is licensed under the BSD-2-Clause terms. Copyright (c) 2019-2020 Raspberry Pi Trading Ltd. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-11libcamera: pipeline: Raspberry Pi pipeline handlerNaushir Patuck
Initial implementation of the Raspberry Pi (BCM2835) ISP pipeline handler. All code is licensed under the BSD-2-Clause terms. Copyright (c) 2019-2020 Raspberry Pi Trading Ltd. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-05-11meson: Use files() instead of find_program() for internal scriptsLaurent Pinchart
Using find_program() to locate scripts part of the source tree causes meson to print messages at setup time for each of those scripts: Program ipa-sign.sh found: YES (/home/user/src/libcamera/src/ipa/ipa-sign.sh) This pollutes the meson setup log with useless messages, as we know the scripts are present. Use files() instead to avoid this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-05-10libcamera: pipeline: simple: Support multiple capture video nodesLaurent Pinchart
The simple pipeline handler rejects devices that have multiple capture video nodes. There's no real reason to do so, a more dynamic approach is possible as the pipeline handler already locates the video device by walking the media graph. Rework the match sequence by skipping any check on the video nodes, and create the V4L2VideoDevice for the media entity at the end of the pipeline when initializing the camera data. The V4L2VideoDevice instances are managed by the pipeline handler itself, to avoid creating separate instances in the camera data if multiple sensors are routed to the same video device. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Andrey Konovalov <andrey.konovalov@linaro.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-10libcamera: pipeline: simple: Integrate converter supportLaurent Pinchart
Add support for an optional format converter, supported by the SimpleConverter class. If a converter is available for the pipeline, it will be used to expose additional pixel formats. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-10libcamera: pipeline: simple: Add simple format converterLaurent Pinchart
The simple format converter supports V4L2 M2M devices that convert pixel formats. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-10libcamera: pipeline: Add a simple pipeline handlerMartijn Braam
This new pipeline handler aims at supporting any simple device without requiring any device-specific code. Simple devices are currently defined as a graph made of one or multiple camera sensors and a single video node, with each sensor connected to the video node through a linear pipeline. The simple pipeline handler will automatically parse the media graph, enumerate sensors, build supported stream configurations, and configure the pipeline, without any device-specific knowledge. It doesn't support configuration of any processing in the pipeline at the moment, but may be extended to support simple processing such as format conversion or scaling in the future. The only device-specific information in the pipeline handler is the list of supported drivers, required for device matching. We may be able to remove this in the future by matching with the simple pipeline handler as a last resort option, after all other pipeline handlers have been tried. Signed-off-by: Martijn Braam <martijn@brixit.nl> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Andrey Konovalov <andrey.konovalov@linaro.org>
2020-05-10libcamera: v4l2_videodevice: Support filtering formats by media bus codeLaurent Pinchart
Add support for the recent V4L2 extension to VIDIOC_ENUM_FMT that allows filtering pixel formats by media bus codes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-10android: hal: License camera3_hal.cpp as LGPL-2.1-or-laterLaurent Pinchart
The camera3_hal.cpp is incorrectly licensed as GPL-2.0-or-later, instead of LGPL-2.1-or-later as the rest of the HAL implementation. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2020-05-04qcam: dng_writer: Write EXIF IFD as custom directoryLaurent Pinchart
The EXIF IFD is incorrectly chained to IFD 0 in addition to being a referenced as a sub IFD through the EXIFIFD tag. While the libtiff API doesn't clearly document why this happens, inspection of the TIFFWriteDirectory() source code show that the function treats the IFD being written as containing an image, which isn't correct for the EXIF IFD. Use TIFFWriteCustomDirectory() instead, which fixes the problem. The resulting DNG file can now be opened with darktable in addition to rawtherapee. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-05-03libcamera: camera_sensor: Relax restriction on sizesLaurent Pinchart
The CameraSensor class assumes that camera sensors support the exact same list of sizes of all media bus codes. While allowing a simpler API, this assumption is incorrect and is blocking usage of some camera sensors. Relaxing the constraint is possible without changes to the CameraSensor API syntax, but requires changing its semantics. The sizes() function now returns the list of all sizes for all media bus codes, and the getFormat() function now searches in all supported media bus codes. The former is likely not the most useful option for pipeline handlers, but the sizes() function is currently unused. Designing a better API will require inspecting current and expected future use cases in pipeline handlers to determine proper heuristics. While at it, fix a small typo in an unrelated comment. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-03qcam: dng_writer: Remove colon from \todoNiklas Söderlund
Todo statements should not end with a colon, remove it. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-03qcam: dng_writer: Generate thumbnail in RGB formatLaurent Pinchart
While the DNG specification supports greyscale ("BlackIsZero") for thumbnails, RawTherapee seems to have trouble reading them. Generate thumbnails in RGB instead (but still with greyscale content, to avoid having to interpolate colour components). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-03qcam: dng_writer: Populate DNG tags from metadataLaurent Pinchart
Populate the DNG black level, ISO speed rating and exposure time from metadata. The ISO speed rating and exposure time are standardized as EXIF tags, not TIFF tags, and require a separate EXIF IFD. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-03qcam: dng_writer: Output thumbnailLaurent Pinchart
Generate a greyscale, 1/16 resolution thumbnail and add it to the DNG file. This requires shuffling the RAW image generation as the thumbnail has to be stored in the main IFD as per the DNG and TIFF/EP specifications. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-03qcam: dng_writer: Name arguments to packScanline()Laurent Pinchart
Name arguments to the FormatInfo::packScanline function pointer to make it easier to understand its usage when reading the function declaration. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-03qcam: Pass request metadata to DNG writerLaurent Pinchart
The DNG writer will use the metadata to populate DNG tags. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-03libcamera: camera_sensor: Prepare for multi-subdev camera sensorsLaurent Pinchart
While most camera sensors are exposed to userspace as a single subdev, this is not always the case. A notable exception is the smiapp driver, which exposes two or three subdevs. The subdev at the output of the camera sensor will thus have more than one pad. Prepare for this by removing the single-pad restriction, and locating the source pad dynamically. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-03libcamera: camera_sensor: Store subdevice in std::unique_ptrLaurent Pinchart
Avoid the need for a manual delete in the destructor by using a unique pointer. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-03libcamera: camera_sensor: Access entity directlyLaurent Pinchart
The CameraSensor::logPrefix() function accesses the entity from the subdev. Remove the level of indirection as we stored a pointer to the entity internally. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-03qcam: dng_writer: Fix missing field nameNiklas Söderlund
While reformatting the table the field name was missed for one entry, add it. Fixes: db7235b7141aa4e2 ("qcam: Add DNGWriter") Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-02qcam: Add RAW capture supportNiklas Söderlund
Add a toolbar button that captures RAW data to disk. The button is only enabled if the camera is configured to provide a raw stream to the application. Only when the capture action is triggered will a request with a raw buffer be queued to the camera. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-02qcam: Add DNGWriterNiklas Söderlund
Add an initial DNG file writer. The writer can only deal with a small set of pixel formats. The generated file is consumable by standard tools. The writer needs to be extended to write more metadata to the generated file. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-02qcam: Allow for a second raw stream to be configuredNiklas Söderlund
Allow a second stream to be configured for raw capture. This change only adds support for configuring and allocating buffers for the second stream. Later changes are needed to queue the allocated buffers to the camera when the user wishes to capture a raw frame. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-02libcamera: vimc: Adjust crop rectangleJacopo Mondi
Since the Linux kernel commit: 69e39d40587b ("media: vimc: Implement get/set selection in sink") the crop rectangle on the VIMC scaler sink pad needs to be reset to match the requested format to avoid hitting a pipeline format misconfiguration when the applied format is larger than the one set in a previous capture session. As the V4L2 specification is not clear on what the correct behaviour is, if the crop rectangle should be reset automatically or not on a set_fmt operation, momentary fix the pipeline handler to please the driver and manually reset the crop rectangle. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-02libcamera: pipeline: vimc: Store media device pointer in camera dataLaurent Pinchart
Store the MediaDevice for the VIMC instance in the VimcCameraData class. This will be used to check the media device version at runtime. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-02libcamera: media_device: Expose media device API version numberLaurent Pinchart
Add a MediaDevice::version() function to expose the media device API version number. This can be useful to support driver API changes in pipeline handlers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-01libcamera: stream: Expose stride valueNiklas Söderlund
Expose the image stride which may be retrieved after a video device has been configured. It may only be retrieved at that point as the assignment of video devices takes place at this point. In the future video devices should be assigned at configuration validation time and the stride value retrieved at that point. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-01qcam: Check that camera can generate configuration from rolesNiklas Söderlund
If the camera can not generate a configuration from the requested roles it returns a nullptr which leads to a nullptr dereference. Fix this by adding a check that the camera generated a configuration before trying to access it. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-01qcam: Make use of StreamKeyValueParserNiklas Söderlund
Use the StreamKeyValueParser helper to parse stream configuration from the command line. This extends qcam to accept role hints and pixel format in addition to a size. Currently only one viewfinder stream is supported, add a check to keep this behavior. Going forward this restriction will be lifted to support more then one stream. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-01cam: Make use of StreamKeyValueParserNiklas Söderlund
Use the StreamOptionsParser helper to parse stream configuration from the command line. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-01cam: Add helper class to parse stream configurationNiklas Söderlund
Create a new helper class StreamKeyValueParser to parse command line options describing stream configurations. The goal is to share this new class between cam and qcam. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-01cam: options: Add public method to invalidate optionsNiklas Söderlund
Extend OptionsBase<T> with a public invalidate() method. This allows for further examination of the options and if found unsuitable be invalidated. The intended user for this new interface are subclasses of KeyValueParser. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-01cam: options: Make KeyValueParser::parse() virtualNiklas Söderlund
Prepare for sub-classing of the KeyValueParser by making the parse() method virtual. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-04-30qcam: main_window: Fix combo-box entry selection on startupUmang Jain
When one of the camera is selected and opened from the "Select Cameras" items list, the entry of the combo-box in the main-window doesn't update its item index to reflect the camera which was earlier selected. Fix that. Signed-off-by: Umang Jain <email@uajain.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>