Commit graph

81 commits

Author SHA1 Message Date
Laurent Pinchart
6f09680b25 qcam: Replace MappedBuffer with Span<uint8_t>
The MappedBuffer structure is a custom container that binds a data
pointer with a length. This is exactly what Span is. Use it instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-21 16:20:46 +03:00
Laurent Pinchart
02b129dab5 qcam: Make log less verbose by default
The qcam log prints one message per frame, which is pretty verbose. This
feature is useful for debugging, but not necessarily as a default
option. Silence it by default, and add a -v/--verbose command line
parameter to make the log verbose.

While this could have been handled manually by checking a verbose flag
when printing the message, the feature is instead integrated with the Qt
log infrastructure to make it more flexible. Messages printed by
qDebug() are now silenced by default and controlled by the -v/--verbose
argument.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-12-01 15:16:17 +02:00
Paul Elder
2d50b16645 qcam: Clear the pool of free requests upon stopCapture()
To enable reusing Request objects, we kept a pool of free Requests. This
pool was not cleared upon stopping capture, however, which caused a
segfault when switching to another camera. Fix this by clearing the
Request pool on stopCapture().

Fixes: c753223ad6 ("libcamera, android, cam, gstreamer, qcam, v4l2: Reuse Request")
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2020-11-13 16:11:53 +09:00
Kieran Bingham
2babedf2b3 qcam: main_window: Explicitly name raw buffer
The buffer obtained for queuing to a raw stream shadows the buffer
passed in for the main view finder stream.

Prevent shadowing, and explicitly name the buffer as a separate variable.

Suggested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-21 17:18:48 +01:00
Paul Elder
c753223ad6 libcamera, android, cam, gstreamer, qcam, v4l2: Reuse Request
Allow reuse of the Request object by implementing reuse(). This means
the applications now have the responsibility of freeing the Request
objects, so make all libcamera users (cam, qcam, v4l2-compat, gstreamer,
android) do so.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-12 11:32:40 +09:00
Niklas Söderlund
dbe8d271e7 libcamera: stream: Rename StillCaptureRaw to Raw
With the buffer copy removed from all pipelines for raw capture
rename StillCaptureRaw to Raw to better describe the role.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2020-09-30 14:01:01 +02:00
Show Liu
219cbfe76b qcam: Add additional command line option to select the renderer type
Add new option "--renderer=qt|gles" to select the renderer type,
"--renderer=gles" to accelerate format conversion and rendering
"--renderer=qt" is the original Qt rendering.

Signed-off-by: Show Liu <show.liu@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-15 05:53:59 +03:00
Show Liu
2daa704c96 qcam: New viewfinder hierarchy
Create ViewFinder base class and rename the original ViewFinder
as QPainter-based ViewFinder.

Signed-off-by: Show Liu <show.liu@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-15 05:10:35 +03:00
Laurent Pinchart
dbafe16da7 meson: Remove -Wno-unused-parameter
We build libcamera with -Wno-unused-parameter and this doesn't cause
much issue internally. However, it prevents catching unused parameters
in inline functions defined in public headers. This can lead to
compilation warnings for applications compiled without
-Wno-unused-parameter.

To catch those issues, remove -Wno-unused-parameter and fix all the
related warnings with [[maybe_unused]].

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-08-25 02:58:04 +03:00
Niklas Söderlund
2e7c80a4f9 libcamera: camera: Rename name() to id()
Rename Camera::name() to camera::id() to better describe what it
represents, a unique and stable ID for the camera. While at it improve
the documentation for the camera ID to describe it needs to be stable
for a camera between resets of the system.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-05 20:07:13 +02:00
Umang Jain
c8edfe29c1 qcam: Fix camera reference leak on hot-unplug
If the currently streaming camera is hot-unplugged, a camera reference
was still held by MainWindow::camera_, preventing it to be destructed,
until qcam window is closed. Plug the leak in the hot-unplug handler
itself.

Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-27 22:30:07 +03:00
You-Sheng Yang
256845d5b7 qcam: Fix spelling
Fix a typo in the word "Unsupported".

Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-07-27 10:24:02 +01:00
Umang Jain
7055e96ecc qcam: main_window: Introduce initial hotplug support
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-17 00:27:56 +03:00
Peter Seiderer
8823461d80 qcam: Fix compilation with Qt v5.15.0
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-09 13:38:36 +03:00
Laurent Pinchart
585252eae3 qcam: Pass request metadata to DNG writer
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-03 04:32:46 +03:00
Niklas Söderlund
b20eb8ffb5 qcam: Add RAW capture support
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-02 14:46:20 +02:00
Niklas Söderlund
55d5e3e59f qcam: Allow for a second raw stream to be configured
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-02 14:44:25 +02:00
Niklas Söderlund
dee99d4726 qcam: Check that camera can generate configuration from roles
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-01 12:24:07 +02:00
Niklas Söderlund
d29c321357 qcam: Make use of StreamKeyValueParser
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-01 12:24:07 +02:00
Umang Jain
f703aa0600 qcam: main_window: Fix combo-box entry selection on startup
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-30 19:05:46 +03:00
Umang Jain
e5716bebb3 qcam: main_window: Make cameraCombo_ private
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-30 19:04:47 +03:00
Laurent Pinchart
bf01e04f29 qcam: Fix logging of sequence number
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: 494da4467d ("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-30 03:55:32 +03:00
Laurent Pinchart
96980e35ae qcam: Don't crash if camera can't be opened
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-04-27 20:18:18 +03:00
Laurent Pinchart
8c8fde05ac qcam: Print whole stream configuration when adjusted
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-26 13:37:55 +02:00
Laurent Pinchart
e74885c870 qcam: main_window: Prefer stream formats that don't require conversion
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-24 14:51:09 +02:00
Laurent Pinchart
5816c0c38e qcam: viewfinder: Avoid memory copy when conversion isn't needed
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-24 10:34:08 +02:00
Laurent Pinchart
615f7438ad qcam: viewfinder: Make the viewfinder hold a reference to a buffer
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-24 10:34:04 +02:00
Laurent Pinchart
b73192036d qcam: viewfinder: Move multi-planar check into viewfinder
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-24 10:34:03 +02:00
Laurent Pinchart
275fd5bd33 qcam: viewfinder: Add MappedBuffer to store memory mapping information
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-24 10:34:02 +02:00
Laurent Pinchart
494da4467d qcam: Use Qt qInfo() and qWarning() logging facilities
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-24 10:33:59 +02:00
Laurent Pinchart
9cec54a4ee qcam: main_window: Remove unneeded debug message
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-24 10:33:58 +02:00
Laurent Pinchart
53dd3594d5 qcam: main_window: Document functions and reorganize member data
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-24 10:33:57 +02:00
Laurent Pinchart
0420a14d75 qcam: main_window: Don't print message when saving a picture
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-24 10:33:56 +02:00
Laurent Pinchart
7536d7d2f8 qcam: main_window: Add shortcuts for toolbar actions
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-24 10:33:54 +02:00
Laurent Pinchart
e4c2c60b57 qcam: main_window: Use icons from system icon theme
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-24 10:33:50 +02:00
Laurent Pinchart
15273b38df qcam: main_window: Replace start and stop actions with a toggle action
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-24 10:33:47 +02:00
Laurent Pinchart
77ea51820a qcam: main_window: Move capture event processing to main thread
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-24 10:33:44 +02:00
Laurent Pinchart
8e7d1bbe9b qcam: main_window: Move request queuing to a separate function
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-24 10:33:43 +02:00
Laurent Pinchart
acd02afab0 qcam: Use QSize through the code base
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>
2020-03-24 10:33:42 +02:00
Laurent Pinchart
ac02d741dc qcam: Ensure headers are self-contained
Include the headers corresponding to each compile unit at the very first
line to ensure they are self-contained.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:41 +02:00
Kieran Bingham
92c7b1cc1d qcam: saveImageAs: Set image quality explicitly
The QImageWriter defaults to an image quality value of 75 which can lead
to perceivable visual artefacts.

Improve the quality of the output by explicitly setting the image
quality to 95.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-19 13:22:41 +00:00
Laurent Pinchart
4ff18e9506 libcamera: framebuffer_allocator: Lift camera restrictions on allocator
The Camera class currently requires the allocator to have no allocated
buffer before the camera is reconfigured, and the allocator to be
destroyed before the camera is released. There's no basis for these
restrictions anymore, remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-18 19:15:18 +02:00
Kieran Bingham
1d80ed1feb qcam: Use standard PicturesLocation path for capture
Utilise the QStandardPaths::PicturesLocation as a starting point for
saving images from qcam.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-19 10:32:22 +00:00
Kieran Bingham
0f292e7821 qcam: Provide save image functionality
Implement a save image button on the toolbar which will take a current
viewfinder image and present the user with a QFileDialog to allow them
to choose where to save the image.

Utilise the QImageWriter to perform the output task.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-14 12:34:36 +00:00
Kieran Bingham
2dc85eabe1 qcam: Provide initial icon buttons "Play/Stop"
Provide Quit, Play, Stop icons.

Create a Qt resource to compile icons into the binary and present them
on the toolbar.

Update the Quit button with a 'cross', and implement Play/Stop buttons.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-14 12:34:33 +00:00
Kieran Bingham
fb497899e2 qcam: Introduce a toolbar and camera switching
Implement a quit button, and a list of cameras.

Selecting a different camera from the Toolbar will stop the current
stream, and start streaming the chosen camera device if it can be
acquired.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-14 12:34:27 +00:00
Kieran Bingham
871879eb73 qcam: Store CameraManager as class member
Intialise a local copy of the CameraManager instance to ease
access to the CameraManager which is frequently utilised.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-14 12:34:25 +00:00
Kieran Bingham
de584a58f7 qcam: Move requestCompleted signal mapping
The MainWindow connects a handler to the Camera requestCompleted signal
when the camera is opened, but never disconnects it.

Move the connection to the startCapture() function, and ensure that it
is disconnected again when the stream is stopped.

This ensures that we can successfully tear down the stream, and restart
with a new camera.

Introducing the error_disconnect cleanup path in start_capture
identified that we left the camera in the start state, thus we also add
a call to camera->stop() when disconnecting the signal connection.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-14 12:34:23 +00:00
Kieran Bingham
1bf5173076 qcam: Tie FrameBufferAllocator to stream life
The FrameBufferAllocator must be deleted and reconstructed before performing
any reconfiguration of the stream.

Construct the allocator at startCapture, and destroy it during stopCapture so
that we can successfully stop and restart the stream.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-14 12:34:17 +00:00
Naushir Patuck
8ce24bebbf qcam: Switch default stream role to viewfinder
qcam currently only displays a standard viewfinder. As such set the
StreamRole parameter to Viewfinder so that the pipeline handlers can
setup the appropriate resolutions and formats.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-11 11:12:23 +02:00