Age | Commit message (Collapse) | Author |
|
Extend the format validation to work with both main and self paths. The
heuristics honors that the first stream in the configuration has the
highest priority while still examining both streams for a best match.
It is not possible to capture from the self path as the self stream is
not yet exposed to applications.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
In preparation of supporting both the main and self path extend
RkISP1FrameInfo to track buffers from the self path stream.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Allow for both the main and self path streams to be configured. This
change adds the self path as an internal stream to the pipeline handler.
It is not exposed as a Camera stream so it can not yet be used.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add the V4L2 device nodes needed to operate the self path.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
In preparation of supporting both the main and self path prefix the main
path specific variables with mainPath.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Changing resolutions back and forth can provoke the crop rectangle to go
out of sync, set it as part of format configuration.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The information about stream format is available but not exported to
applications, fix this.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Create RkISP1Frames from camera data instead of picking information out
from it. This is done to prepare for multi stream support where more
information from the camera data will be needed.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The buffer ready handlers are designed for a single application facing
stream from the main path. To prepare for multiple application facing
streams from main and/or self path the handlers need to be prepared.
The data keeping track of the frame number and advancing the timeline
can be moved from the application facing buffer ready handler to the
statistics handler. For each request processed there will always be a
statistic buffer and as the ISP is inline and is the source of both
main, self and statistic paths there is no change in behavior.
The application facing handler no longer needs a special case for
cancelled frames and can be made simpler. With this change the handlers
are ready to deal with any combinations of application facing streams.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
In preparation of supporting both the main and self path configure all
the media graph links as a part of the configuration step. Before this
change the link between ISP and DMA engine was setup at match time as
the only supported path was the main path and only the link between
sensor and ISP was updated at part of the configuration step.
The main path is still the only path between ISP and DMA engine that is
possible to enable.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Breakout the mainpath size and format constrains as it will be used in
more places then just validate(). While at it use the new helpers to
validate Size.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
There is no need to check if Request contains a buffer belonging the
RkISP1 Camera as this is already done in Camera::queueRequest(), remove
the redundant check.
Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The RkISP1 pipeline originally only supported NV formats which have 2
planes. When support for YUV formats was added the plane count on the
output format was not made to reflect this. Instead of hard coding the
plane count to 2 fetch the number of planes from the format information.
Reported-by: Jacopo Mondi <jacopo@jmondi.org>
Fixes: 2b1a908b5222e263 ("libcamera: camera: Add a validation API to the CameraConfiguration class")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
With this change, meson will complain specifically about missing
python3 and missing python3-yaml. As specified by meson
documentation: https://mesonbuild.com/Python-module.html,
this change requires meson v0.51.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Version 0.51 allows, among others, checking for python modules, which is
a required feature.
It is also now easily accessible: it is in stable distros such as Debian
testing, or in pip:
https://tracker.debian.org/pkg/meson
https://pypi.org/project/meson/
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
This way if the user enables the documentation and the dependencies are
missing the configure fails.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Doxygen depends on dot to generate the documentation. Make this
dependency explicit on the meson file.
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Doxygen fails to create the documentation with this message:
[145/276] Generating doxygen with a custom command
sh: 1: dot: not found
error: Problems running dot: exit code=127, command='dot', arguments='"/home/user/libcamera/build/Documentation/api-html/inline_dotgraph_1.dot" -Tpng -o "/home/user/libcamera/build/Documentation/api-html/dot_inline_dotgraph_1.png"'
sh: 1: dot: not found
error: Problems running dot: exit code=127, command='dot', arguments='"/home/user/libcamera/build/Documentation/api-html/inline_dotgraph_1.dot" -Tcmapx -o "/home/user/libcamera/build/Documentation/api-html/dot_inline_dotgraph_1.map"'
[276/276] Linking target test/utils
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Without it:
Run-time dependency libtiff-4 found: NO (tried pkgconfig and cmake)
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Without it:
Program /usr/lib/x86_64-linux-gnu/qt5/bin/lrelease found: NO
Program lrelease-qt5 found: NO
Program lrelease found: NO found but need: '== 5.14.2'
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
pkg-config it is not only used to detect libudev-dev, it is used for
detecting gstreamer and others. So it is more correct to place it on the
Meson Build system section.
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Raspberry Pi IPA, which is enabled by default, requires libboost to
compile.
Specify in the documentation its dependencies and how to disable the
IPA.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.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>
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
All the dependencies are for libcamera, so we should move all the
packages under this paragraph, or make a paragraph for Meson, and a
second one for python3-yaml. I think the later is more clear.
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Move the GPLv2 utilities used for generating public and private keys to
the utilities subtree.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
Refactor the naming of the custom command variable to match the style
used in the other custom target generators, and the name of the script.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
Move the GPL2 utilities which handle generation of controls, formats and
the top level libcamera header to the utils subtree.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
The utils directory can contain helpers and support tools which are used
throughout other components of the build.
Ensure that the utils subdir is parsed first allowing helpers to be
defined there.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
There are no user left of the copyFrom() operation, remove it.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Handle the case where a FrameBuffer that has been externally allocated
(i.e. not through the v4l2 video device) is passed into a Request.
We must store the buffer pointer in the stream internal buffer list to
identify when used.
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>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
By using a set container, we can easily insert/remove buffer ids that have
been mmaped by the IPA. This will be required to track buffers allocated
externally and passed to the pipeline handler through a Request.
Move the IPA buffer mapping code into a function to remove duplicated
code.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
By using a map container, we can easily insert/remove buffers from the
buffer list. This will be required to track buffers allocated externally
and passed to the pipeline handler through a Request.
Replace the buffer index tracking with an id generated internally by the
stream object.
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>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The FrameBuffer cookie may be set by the application, so this cannot
be set by the pipeline handler as well. Revert to using a simple index
into the buffer list to identify buffers passing to and from the IPA.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Add further queueing into the RPiStream object to ensure that we always
follow the buffer ordering (be it internal or external) given by
incoming Requests.
This is essential, otherwise we risk dropping frames that are meant to
be part of a Request, and can cause the pipeline to stall indefinitely.
This also prevents any possibility of mismatched frame buffers going
through the pipeline and out to the application.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The counter was not incremented, so multiple streams would only pass the
last stream config to the IPA.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Stop using v4l2_videodevice::allocateBuffer() for internal buffers and
instead export/import all buffers. This allows the pipeline to return
any stream buffer requested by the application as zero-copy.
Advertise the Unicam Image stream as the RAW capture stream now.
The RPiStream object now maintains a new list of buffers that are
available to queue into a device. This is needed to distinguish between
FrameBuffers allocated for internal use vs externally provided buffers.
When a Request comes in, if a buffer is not provided for an exported
stream, we re-use a buffer from this list.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
For the zero-copy RAW capture feature, the RPiStream will have to be
modified. Remove the const qualifier in anticipation of the future
commits for this feature.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Increase the number of expected RAW buffers in the stream configuration
to 2. This will avoid dropping Unicam frames when exporting RAW streams.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
No functional changes, only added some more trace points.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The IPA now signals up front how many frames it wants the pipeline
handler to drop. This makes it easier to handle up-coming changes to the
buffer handling for import/export buffers.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Put RPiStream into the RPi namespace and add a new log category (RPISTREAM).
Reorder methods into logical groups for readability.
There are no functional changes in this commit.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
While libcamera prefers usage of the C standard library headers (xxx.h)
over the C++ version (cxxx), we make an exception for cmath as the
overloaded versions of the math functions are convenient. Document this,
and adjust checkstyle.py accordingly.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Let's only pull required headers, to avoid slowing compilation down.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The ipc_unixsocket.h and process.h internal headers don't need to
include event_notifier.h, the former because a forward declaration
suffices, and the latter because it doesn't use event notifiers. Remove
the unnecessary include, and include signal.h instead which is required
and was included indirectly through event_notifier.h.
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>
|
|
In most cases the last reference to a Camera instance will be the one
held by the CameraManager. That reference gets released when the
CameraManager thread cleans up, just before it stops. There's no need to
delete the camera with deleteLater() in that case.
To optimize this case, use deleteLater() only when the camera gets
deleted from a different thread, and delete is synchronously otherwise.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
|
|
The std::localtime() function isn't thread-safe, and we have no
guarantee whether other threads in the camera service may or may not
call it. Replace it with localtime_r(). This requires switching from
ctime to time.h, as there is no std::localtime_r() function.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
When calculating the pipeline configuration for the IPU3 platform,
libcamera tries to be smart and select the smallest sensor frame
resolution large enough to accommodate the stream sizes
requested by the application.
While this makes a lot of sense, in practice optimizing the
selected sensor resolution makes the pipeline configuration calculation
process fail in multiple occasions, or results in stalls during capture.
As a trivial example, capturing with cam with the following command
line results in a stall:
$ cam -swidth=1280,height=720 -swidth=640,height=480 -c1 -C
Likewise, the Android HAL supported format enumeration fails in
reporting smaller resolutions as supported when used with the OV5670
sensor.
320x240:
DEBUG IPU3 ipu3.cpp:192 CIO2 configuration: 648x486-SGRBG10_IPU3
ERROR IPU3 imgu.cpp:408 Failed to calculate pipe configuration
ERROR IPU3 ipu3.cpp:299 Failed to calculate pipe configuration: unsupported resolutions.
640x480:
DEBUG IPU3 ipu3.cpp:192 CIO2 configuration: 320x240-SGRBG10_IPU3
ERROR IPU3 imgu.cpp:408 Failed to calculate pipe configuration
ERROR IPU3 ipu3.cpp:299 Failed to calculate pipe configuration: unsupported resolutions.
Furthermore the reference xml files used for the IPU3 camera
configuration on the ChromeOS platform restricts the number of sensor
resolution to be used for the OV5670 sensor to 2 from the 6 supported by
the driver [1].
The selection criteria of the correct CIO2 mode are not specified, and
for the time being, as a workaround, always use the sensor maximum
resolution at the expense of frame rate and bus bandwidth to allow the
pipeline to successfully support smaller modes for the OV5670 sensor and
solve pipeline stalls when capturing with both sensors.
[1] See the <sensor_modes> enumeration in:
https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/master/baseboard-poppy/media-libs/cros-camera-hal-configs-poppy/files/gcss/graph_settings_ov5670.xml
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Complete the transformation of CameraStream into a class and provide
a read-only interface that allows to access its parameters but not
modify them at run-time.
No functional changes intended but this change aims to make the code
more robust by enforcing a stricter interface in the CameraStream class.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Make the CameraStream encoder a private unique pointer and require its
initialization at construction time. This ties the encoder lifetime to
the CameraStream it has been created with, allowing to remove the
CameraStream destructor.
This change dis-allow creating a CameraStream and set the Encoder later,
which shall not happen now that we create CameraStream once we have all
the required information in place.
No functional changes intended but this change aims to make the code
more robust enforcing a stricter CameraStream interface.
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The CameraDevice::streams_ vector of CameraStream instances is
currently mostly accessed by index. The current implementation
creates all the CameraStream during the first loop that inspects the
camera3_stream instances and then update the index of the
StreamConfiguration associated with the CameraStream during a second
loop that inspects MJPEG streams. A third loop creates the JPEG encoder
associated with camera streams that produce MJPEG format.
As the index-based association is hard to follow and rather fragile,
rework the creation and handling of CameraStream:
1) Make the StreamConfiguration index a constructor parameter and a
private struct member. This disallows the creation of CameraStream
without a StreamConfiguration index assigned.
2) Create CameraStream only after the associated StreamConfiguration
has been identified. The first loop creates CameraStream for non-JPEG
streams, the second for the JPEG ones after having identified the
associated StreamConfiguration. Since we have just created the
CameraStream, create the JPEG encoder at the same time instead of
deferring it.
This change removes all accesses by index to the CameraDevice::streams_
vector.
No functional changes intended, but this change aims to make the code
easier to follow and more robust.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|