summaryrefslogtreecommitdiff
path: root/src/qcam
AgeCommit message (Collapse)Author
2020-06-17qcam: main_window: Introduce initial hotplug supportUmang Jain
Hook up various QCam UI bits with hotplug support introduced in previous commits. This looks good-enough as first steps to see how the hotplugging functionality is turning out to be from application point-of-view. One can still think of few edge case nuances not yet covered under this implementation especially around having only one camera in the system and hotplugging/hot-unplugging it. Hence, those are intentionally kept out of scope for now. It might require some thinking on how to handle it on application level having additional time on hand. Signed-off-by: Umang Jain <email@uajain.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-06-16qcam: dng_writer: Record creation time in the EXIF directoryNiklas Söderlund
If the EXIF directory is empty due to no metadata being available tools such as tiffinfo complains that the directory is malformed. TIFFFetchDirectory: Sanity check on directory count failed, this is probably not a valid IFD offset. TIFFReadCustomDirectory: Failed to read custom directory at offset 0. Always record the creation time in the EXIF directory instead of adding complexity to skip creating the EXIF directory if there is no metadata to record. This ensures there are at least some entries in the EXIF directory and that makes tiffinfo happy. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-06-15qcam: dng_writer: Add support for IPU3 Bayer formatsNiklas Söderlund
Add support for the Bayer formats produced on the IPU3. The format uses a memory layout that is hard to repack and keep the 10-bit sample size, therefore scale the samples to 16-bit when creating the scanlines. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-06-09qcam: Specify Feather icons license in DEP5Laurent Pinchart
Specify the license of the Feather icons files in the .reuse/dep5 file. Technically speaking the SVG format supports comments, SPDX could thus be used, but that would be impractical both due to the large number of files, and the fact that they would then diverge from the upstream project. We can remove the README.md file, as it now only contains redundant or incorrect information: the license and project URL are contained in the DEP5 file, and the comment related to generation of the GRC file is outdated as the file is now manually edited to only include the icons that we need. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-06-09libcamera: Add missing SPDX headers to miscellaneous small filesLaurent Pinchart
Add missing SPDX headers to miscellaneous small files. Use CC0-1.0 for meson.build, .gitignore and the small include/linux/README, and licenses matching the corresponding component for other files. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-06-09qcam: Fix compilation with Qt v5.15.0Peter Seiderer
Starting from Qt v5.15.0, the QTextStreamFunctions::fixed function used to configure formatting on QTextStream is deprecated in favour of Qt::fixed. This causes a compilation error: ../src/qcam/main_window.cpp:634:16: error: ‘QTextStream& QTextStreamFunctions::fixed(QTextStream&)’ is deprecated: Use Qt::fixed [-Werror=deprecated-declarations] 634 | << "fps:" << fixed << qSetRealNumberPrecision(2) << fps; | ^~~~~ Fix it by using Qt::fixed, and provide backward compatibility with Qt versions older than v5.14.0 that didn't provide Qt::fixed. Signed-off-by: Peter Seiderer <ps.report@gmx.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> # 5.12.8 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-06-06libcamera: Rename pixelformats.{cpp,h} to pixel_format.{cpp,h}Laurent Pinchart
The libcamera source files are named after class names, using snake_case. pixelformats.h and pixelformats.cpp don't comply with that rule. Fix them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-28qcam: viewfinder: Use correct DRM/QImage mappingsKieran Bingham
When the native pixel formats supported by QT were introduced, the RGB/BGR formats were inverted. Swap the BGR888 and RGB888 mappings accordingly. Fixes: f890a57b7a06 ("qcam: viewfinder: Add support for more native formats") Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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-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-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-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-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-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-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>
2020-04-30qcam: main_window: Make cameraCombo_ privateUmang Jain
This commit introduces no functional changes. This is required so that the combo-box list can be managed conveniently from various private functions in subsequent commit. Signed-off-by: Umang Jain <email@uajain.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-04-30qcam: Fix logging of sequence numberLaurent Pinchart
The sequence number of captured frames is logged to the console with padding to 6 characters to increase readability. The output is however incorrect, as 123 is printed as 00012300000. This is caused by the auto-space feature of QDebug, which inserts a space after every field. This doesn't play well with stream format manipulation, as it ends up padding the automatically inserted space the same way as the previous argument. This is a bug in Qt, work around it by formatting the sequence number manually. Fixes: 494da4467ddf ("qcam: Use Qt qInfo() and qWarning() logging facilities") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-04-27qcam: Don't crash if camera can't be openedLaurent Pinchart
If the camera specified on the command line can't be opened, the MainWindow constructor still proceeds to check the startStopAction_, which results in MainWindow::startCapture() being called and trying to use a null camera_ object. Fix this by returning from the constructor as soon as the error is detected. This also fixes a similar crash if the camera selection dialog box is closed without selecting a camera. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <email@uajain.com>
2020-03-26qcam: Print whole stream configuration when adjustedLaurent Pinchart
When the validate() function adjusts the stream configuration, we print the adjusted size for debugging purpose. Switch to printing the whole configuration, as the pixel format may be useful too. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: main_window: Prefer stream formats that don't require conversionLaurent Pinchart
Query the viewfinder for the formats it supports natively, and select one of them for the stream if possible. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: viewfinder: Report the natively supported pixel formatsLaurent Pinchart
Expose the pixel formats natively supported by the viewfinder, to allow selection of stream formats that would minimize usage of software conversion. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: viewfinder: Print message to report format converter usageLaurent Pinchart
Print an info message when initializing the viewfinder to report if the format converter is used or if zero-copy is enabled. This is useful to notify of a possible impact on performances. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: viewfinder: Add support for more native formatsLaurent Pinchart
Qt supports more 24-bit and 32-bit RGB formats for native painting. If the frame buffer pixel format matches any of them, disable the converter and create a QImage in the appropriate format. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: viewfinder: Display icon when stopping captureLaurent Pinchart
When stopping capture, display an icon instead of the last frame. This is required to be able to release the last buffer when the viewfinder operators in zero-copy mode. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: viewfinder: Avoid memory copy when conversion isn't neededLaurent Pinchart
If the frame buffer format is identical to the display format, the viewfinder still invokes the converter to perform what is essentially a slow memcpy(). Make it possible to skip that operation by creating a QImage referencing the buffer memory instead. A reference to the frame buffer is kept internally, and released when the next buffer is queued, pushing the current one out. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: viewfinder: Reorder methods to match header fileLaurent Pinchart
Reorder the methods in viewfinder.cpp to match the order in viewfinder.h. No code change. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: viewfinder: Use PixelFormat default constructorLaurent Pinchart
There's no need to initialize the PixelFormat stored in ViewFinder explicitly, as PixelFormat is now a class with a default constructor. Remove the initialization. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: viewfinder: Embed QImage in ViewFinderLaurent Pinchart
The QImage class is a thin wrapper that uses implicit sharing. We can thus embed it in the ViewFinder class instead of allocating it dynamically, and assign it at runtime. This simplifies the code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: viewfinder: Make the viewfinder hold a reference to a bufferLaurent Pinchart
The viewfinder is currently expected to render frames to the screen synchronously in the display() function, or at least to copy data so that the buffer can be queued in a new request when the function returns. This prevents optimisations when the capture format is identical to the display format. Make the viewfinder take ownership of the buffer, and notify of its release through a signal. The release is currently still synchronous, this will be addressed in a subsequent patch. Rename the ViewFinder::display() function to render() to better describe its purpose, as it's meant to start the rendering and not display the frame synchronously. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: viewfinder: Move multi-planar check into viewfinderLaurent Pinchart
The lack of support for multiplanar buffers comes from the viewfinder. Move the corresponding check from MainWindow. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: viewfinder: Add MappedBuffer to store memory mapping informationLaurent Pinchart
The new MappedBuffer structure replaces the std::pair<> used in the mapped buffers map, and allows passing data to the ViewFinder::display() function in a more structured way. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: Use Qt qInfo() and qWarning() logging facilitiesLaurent Pinchart
Replace manual usage of std::cout and std::cerr with the Qt logging facilities. This allows redirection log output if needed, and integrates better with Qt. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: main_window: Remove unneeded debug messageLaurent Pinchart
Printing the name of the selected camera to the log doesn't provide any value. Remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: main_window: Document functions and reorganize member dataLaurent Pinchart
The qcam application is our reference implementation of a libcamera GUI application. Document the code of the MainWindow class to make it easier to follow, and reorganize the member data in logical groups for clarity. No code change. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: main_window: Don't print message when saving a pictureLaurent Pinchart
When saving a picture, the application prints a message on cout. This isn't necessary and doesn't really help with debugging or diagnostics, remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: main_window: Add shortcuts for toolbar actionsLaurent Pinchart
Allow triggering toolbar actions with keyboard shortcuts. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: main_window: Use icons from system icon themeLaurent Pinchart
Use the system icon theme by default, falling back to custom icons if no theme is available. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: main_window: Replace start and stop actions with a toggle actionLaurent Pinchart
The main window toolbar contains a start button and a stop button. This allows starting an already started camera (which is currently not handled and results in an error) or stopping an already stopped camera. Replace the two actions with a single start/stop toggle action, preventing UI misuse and reducing confusion. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: main_window: Move capture event processing to main threadLaurent Pinchart
To avoid blocking the camera manager for a long amount of time, move capture event processing to the main thread. Captured buffers are added to a queue and an event is posted to the main window to signal availability of a buffer. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: main_window: Move request queuing to a separate functionLaurent Pinchart
Requests are requeued synchronously from the completion handler. To prepare for delayed requeuing, move the queuing to a separate function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24qcam: Use QSize through the code baseLaurent Pinchart
Qt has a QSize class to store sizes. Use it to replace width and height where applicable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>