Commit graph

652 commits

Author SHA1 Message Date
Jacopo Mondi
eb068f4e67 libcamera: v4l2_device: Implement get and set controls
Implement getControls() and setControls() operations in V4L2Device class.

Both operations take a V4L2Controls instance and read or write the V4L2
controls on the V4L2 device.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-25 14:01:37 +02:00
Jacopo Mondi
030ce6491e libcamera: v4l2_device: List valid controls at open
Enumerate all the valid controls a device supports at open() time.
A control is valid only if its type is supported.

Store the control information in a map inside the device to save
querying the control when setting or getting its value from the device
and provide an operation to retrieve information by control ID.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-25 14:01:35 +02:00
Jacopo Mondi
bab8b01895 libcamera: Add V4L2Controls
Add libcamera V4L2 control support, implemented using the V4L2 Extended
Control APIs. This patch defines the types used to create and manage
controls.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-25 14:01:17 +02:00
Jacopo Mondi
d78fbdba87 libcamera: formats: Add missing include
Include errno.h header to fix missing definition of -EEXIST error code:
src/libcamera/formats.cpp:43:11: error: use of undeclared identifier 'EEXIST'

Fixes: 1cf709b1d2 ("libcamera: formats: Add ImageFormats")
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-06-19 17:25:17 +02:00
Laurent Pinchart
329b38d254 libcamera: stream: Include missing array header
The file uses the std::array class but doesn't include the corresponding
header. This breaks compilation with clang and libc++. Fix it.

Fixes: 63c578ed99 ("libcamera: stream: Add StreamFormats")
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>
2019-06-19 17:51:12 +03:00
Jacopo Mondi
e32d82e655 libcamera: v4l2_videodevice: Update documentation
Now that we have V4L2Device and V4L2VideoDevice update the documentation
of the latter to use "video device" every time the term "device" was
used in the V4L2 context.

While at it clean up by removing a stale todo entry.

Documentation only change, no functional changes intended.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-19 15:46:44 +02:00
Jacopo Mondi
d6bb56a90a libcamera: Introduce V4L2Device base class
The V4L2 devices and subdevices share a few common operations,like
opening and closing a device node, and perform IOCTLs on the device.

With the forthcoming introduction of support for V4L2 controls, the
quantity of shared code will increase, as the control support
implementation is identical for the two derived classes.

To maximize code re-use and avoid duplications, provide a V4L2Device
base class which groups the common operations and members.

The newly introduced base class provides methods to open/close a device
node, access the file descriptor, and perform IOCTLs on the device.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-19 15:46:44 +02:00
Jacopo Mondi
3a6c4bd146 libcamera: Rename V4L2Device to V4L2VideoDevice
In preparation of creating a new V4L2Device base class, rename
V4L2Device to V4L2VideoDevice.

This is a project wide rename without any intended functional change.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.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>
2019-06-19 15:46:44 +02:00
Laurent Pinchart
20807a8c17 cam: Support base 16 and base 8 when parsing integer options
Integer options have to use base 10. This isn't user-friendly when
specifying pixel formats. Detect the base automatically to support base
16. As a side effect, integer values starting with 0 will be interpreted
in base 8.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-06-19 16:04:35 +03:00
Niklas Söderlund
b4f3fc1d56 libcamera: pipeline: uvcvideo: Add format information and validation
Extend the uvcvideo pipeline with format information and validation. The
format information is gathered by enumerating the v4l2 device. This
enumeration approach is valid for UVC as it has a static and simple
media graph.

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>
2019-06-19 12:25:12 +02:00
Niklas Söderlund
802d47068b cam: Add --info option to print information about stream(s)
Add a new option to the cam tool that prints information about the
configuration supplied by the user. If the option is specified,
information about the configuration is printed after the configuration
has been verified and possibly adjusted by the camera.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-19 12:25:12 +02:00
Niklas Söderlund
7c856201c7 cam: Validate camera configuration
Use CameraConfiguration::validate() to validate and possibly update the
camera configuration when its prepared.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-19 12:25:12 +02:00
Niklas Söderlund
afef18d35a cam: Move camera configuration preparation to CamApp
Most of the camera configuration preparation that is done in the
Capture module is not specific to capturing and could be useful for
other modules. Extract the generic parts to CamApp and do basic
preparation of the configuration before passing it to modules.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-19 12:25:12 +02:00
Niklas Söderlund
a502896429 libcamera: stream: StreamConfiguration: Add StreamFormats information
Allow StreamFormats to be associated to a StreamConfiguration. The
intention is that pipeline handlers should associate formats to a
StreamConfiguration when it's created in generateConfiguration().

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>
2019-06-19 12:24:23 +02:00
Niklas Söderlund
63c578ed99 libcamera: stream: Add StreamFormats
Add a StreamFormats class which describes all the formats supported by a
stream. The object does not collect any information itself but can
simplify user interactions with formats as it's able to translate a
stream format range into a discrete list and a discrete list to a range.

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>
2019-06-19 12:14:37 +02:00
Niklas Söderlund
87e46f7f59 libcamera: v4l2_device: Add enumeration of pixelformats and frame sizes
Add methods to enumerate pixelformats and frame sizes from a V4L2
device. The interface is similar to how V4L2Subdevice enumerates mbus
codes and frame sizes.

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>
2019-06-19 11:54:30 +02:00
Niklas Söderlund
ce02ea29cd libcamera: v4l2_subdevice: Replace FormatEnum with ImageFormats
Replace all usage of FormatEnum with ImageFormats and completely
remove FormatEnum which is no longer needed.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-19 03:06:33 +02:00
Niklas Söderlund
be78ffbe9a libcamera: v4l2_subdevice: Rework enumPadSizes()
Align the enumPadSizes() interface and implementation with that of
enumPadCodes(). There is no functional change.

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>
2019-06-19 02:47:06 +02:00
Niklas Söderlund
3e51cc30bf libcamera: v4l2_subdevice: Breakout mbus code enumeration
Simplify frame size enumeration by breaking out mbus code enumeration in
a helper, making the code easier to read while also preparing for
enhancing the frame size enumeration. There is no functional change.

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>
2019-06-19 02:44:04 +02:00
Niklas Söderlund
1cf709b1d2 libcamera: formats: Add ImageFormats
Add a new class to hold format information for V4L2 devices and
subdevices. The object describes the relationship between either pixel
formats (V4L2 devices) or media bus codes (V4L2 subdevice) and a list of
image sizes which can be produced with that format.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-19 02:42:56 +02:00
Niklas Söderlund
22e0005fdd libcamera: geometry: SizeRange: Add contains()
Add a method to check if a Size can fit inside a SizeRange. When
determining if a size is containable take step values into account if
they are not set to 0.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-19 02:23:01 +02:00
Niklas Söderlund
6bd094ad68 libcamera: geometry: SizeRange: Add toString()
It's useful to be able to print a string representation of a SizeRange
to the log or console, add a toString() method. While at it turn the
structure into a class as it contains functions as well as data.

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>
2019-06-19 02:20:11 +02:00
Niklas Söderlund
ed56f16c4b libcamera: geometry: SizeRange: Extend with step information
The size range described might be subject to certain step
limitations. Make it possible to record this information.

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>
2019-06-19 02:17:54 +02:00
Niklas Söderlund
85a9b66134 libcamera: geometry: SizeRange: Add constructor for a single size
The SizeRange can describe a single size where min == max. Add a
constructor to help create such a description.

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>
2019-06-19 01:44:51 +02:00
Laurent Pinchart
c6090542cd cam: Allow selecting cameras by index
As camera names can be cumbersome to type, selection of cameras by index
from a list can be useful. Print the list of detected cameras with an
index for each item, and interpret the camera name as an index if it is
a numerical value in the range from 1 to the number of cameras.

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>
2019-06-18 23:34:03 +03:00
Mickael Guene
846d4c7d3e libcamera: Fix CameraSensor::getFormat() search order
According to the documentation, the CameraSensor::getFormat() method
should select the first media bus code from the mbusCodes parameter that
is supported by the sensor. However, the current implementation wrongly
selects the first media bus code from the codes supported by the sensor
that is listed in the mbusCodes parameter. This results in the
preference order specified by the caller being ignored. Fix it.

Signed-off-by: Mickael Guene <mickael.guene@st.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-11 17:04:09 +03:00
Niklas Söderlund
cefe067c5b libcamera: ipa_manager: Fix handling of unset LIBCAMERA_IPA_MODULE_PATH
If the environment variable LIBCAMERA_IPA_MODULE_PATH is not set
utils::secure_getenv() will return a nullptr. Assigning a nullptr to a
std::string is not valid and results in a crash,

    terminate called after throwing an instance of 'std::logic_error'
      what():  basic_string::_M_construct null not valid

Fix this by operating directly on the returned char array instead of
turning it into a std::string.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-11 15:56:36 +02:00
Kieran Bingham
c544506e1a libcamera: geometry: Fix SizeRange constructor style
Match the style of the SizeRange() which specifies the hStep and vStep,
and wrap the lines in pairs of min and max values.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-06-11 09:29:13 +01:00
Kieran Bingham
4232b60612 libcamera: pipeline: ipu3: Fix spelling
Fix trivial spelling of queueing.

Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-06-11 09:29:00 +01:00
Kieran Bingham
a0f869f4ed libcamera: pipeline: Fix 'request' grammar
The PipelineHandler::completeBuffer documentation repeats the word
'request'.

Remove the duplication and reformat the lines to fit.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-06-11 09:28:39 +01:00
Niklas Söderlund
238919be59 cam: Fix cam --help crash
The cam utility does not terminate correctly if invoked with only
--help. It prints the help information and then segfaults due to the
application incorrectly handling the return value. Fix this by moving
the return code check of the option parsing to main().

Reported-by: Emmanuel Arias <eamanu@eamanu.com>
Suggested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-10 23:05:04 +02:00
Laurent Pinchart
3353400027 libcamera: pipeline_handler: Optimise factory implementation
The REGISTER_PIPELINE_HANDLER() macro defines and instantiates a
subclass of the PipelineHandlerFactory class that specialises the
virtual create() method. Now that create() does more than just creating
an instance, boilerplate code gets duplicated between different
factories.

Factor out the instance creation code to a new virtual createInstance()
method, and turn create() into a non-virtual method of the base class
that can then be defined in the .cpp file.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-06-10 17:29:27 +03:00
Laurent Pinchart
a87c63c7e9 libcamera: Use dependency instead of link_args to link against libdl
Instead of specifying the link arguments directly, which may be
compiler-specific, use a dependency object provided by find_library().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
2019-06-08 13:43:32 +03:00
Paul Elder
5733879864 libcamera: pipeline: vimc: add dummy IPA
Make the vimc pipeline handler get the dummy IPA, to show how an IPA can
be acquired by a pipeline handler.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05 10:44:52 -04:00
Paul Elder
dd5b899c5b libcamera: ipa: add dummy IPA implementation
Add a dummy IPA module.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05 10:44:52 -04:00
Paul Elder
7fa98a4cdd libcamera: ipa_manager: implement class for managing IPA modules
IPAManager is a class that will search in given directories for IPA
modules, and will load them into a list. It also provides an interface
for pipeline handlers to acquire an IPA.

A meson build file for the IPAs is added, which also specifies a
hard-coded path for where to load the IPAs from in the installation
directory. More paths can be specified with the environment variable
LIBCAMERA_IPA_MODULE_PATH, with the same syntax as the regular PATH
environment variable. Make the test framework set this environment
variable.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05 10:44:52 -04:00
Paul Elder
42c9b4bad4 libcamera: ipa_module: match IPA module with pipeline handler
Add a method to IPAModule to check if it matches with a given pipeline
handler and pipeline version range.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05 10:44:52 -04:00
Paul Elder
7faa67889f libcamera: ipa_module: allow instantiation of IPAInterface
Add functions for loading the IPAInterface factory function from an IPA
module shared object, and for creating an instance of an IPAInterface.
These functions will be used by IPAManager, from which a PipelineHandler
will request an IPAInterface.

Also update meson to add the "-ldl" linker argument, to allow loading of
the factory function from a shared object.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05 10:44:52 -04:00
Paul Elder
9b4eb44581 libcamera: ipa_module: verify IPA module API version upon loading
The IPA module API version determines the layout of struct
IPAModuleInfo. If this version number does not match, then it means that
the IPA module information structure can't be interpreted, and the
module can't be used. Validate this version number upon loading the
IPA module info from the IPA shared object.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05 10:44:51 -04:00
Paul Elder
677e8e1dfe libcamera: ipa_module_info: update struct to allow IPA matching
We need a way to match pipelines with IPA modules, so add fields in
IPAModuleInfo to hold the IPA module API version number, the pipeline
name, and the pipeline version.

The module API version is used to determine the layout of struct
IPAModuleInfo.

Also update IPA module tests and Doxygen accordingly. Doxygen needs to
be updated to accomodate __attribute__((packed)).

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05 10:44:51 -04:00
Paul Elder
379a0a5dd8 libcamera: pipeline: add name
In order to match an IPA module with a pipeline handler, the pipeline
handler must have a name. Add a name attribute and getter to
PipelineHandler such that it can automatically be defined by
REGISTER_PIPELINE_HANDLER.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05 10:44:51 -04:00
Paul Elder
46ae1775b0 libcamera: ipa_interface: add header
Define an IPAInterface class which will contain an IPA implementation.
The methods that the IPAInterface exposes form the interface to the IPA
implementation, hence the name. IPA module shared objects will implement
this class.

This also means that IPA module shared objects must be implemented in
C++, so remove the C test IPA module.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05 10:44:51 -04:00
Jacopo Mondi
629e9301c5 libcamera: v4l2_device: Add META support in g/s_fmt
Add two operations to set and get format on devices implementing the
V4L2 Metadata Interface, identified by the META_OUTPUT or META_CAPTURE
capabilities.

While at it, sort get/setFormat operations alphabetically and unify
their style (eg. no empty line before ioctl).

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-02 14:50:10 +02:00
Jacopo Mondi
81e004e0ff libcamera: v4l2_device: Add support for META_OUTPUT
Add support for output devices that expose the META_OUTPUT capabilities.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-02 14:31:30 +02:00
Niklas Söderlund
633a56d7cd cam: Add CamApp class
Add more structure to main.cpp by breaking up the logic into a CamApp
class. This makes the code easier to read and removes all of the
organically grown global variables.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-25 14:27:55 +02:00
Niklas Söderlund
e741a5482c cam: capture: Break out capture to a new class
Reduce the complexity of main.cpp by compartmentalising the capture
logic into its own class. There is no functional change.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-25 14:27:55 +02:00
Laurent Pinchart
90de3690c4 libcamera: Auto-generate libcamera.h
As shown by two missing includes, keeping the libcamera.h file in sync
when adding or removing headers is an error-prone manual process.
Automate it by generating the header automatically.

The libcamera.h header is also added to the libcamera dependency
libcamera_dep to ensure that the headers gets generated before any
source depending on it gets compiled.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-05-23 13:56:36 +03:00
Laurent Pinchart
3fac104158 meson: Create and use a dependency for libcamera and its headers
Instead of manually adding the libcamera library and include path to
every target that requires it, declare a dependency that groups the
headers as source, the library and the include path, and use it through
the project. This simplifies handling of the dependency.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-05-23 13:56:33 +03:00
Laurent Pinchart
41adc3f8d3 meson: Fix coding style in meson.build files
Consistently go for 4 spaces indentation, and always put a space between
the colon in argument lists, as per the examples from the meson
documentation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-23 11:55:45 +03:00
Laurent Pinchart
1f32abb995 libcamera: camera: Simplify create() implementation
Now that the Camera class inherits from std::enable_shared_from_this, we
don't need to use std::allocate_shared anymore and can simplify the
Camera::create() implementation. This fixes compilation with recent
versions of libc++ whose std::allocate_shared implementation isn't
compatible with classes that are not publicly constructible.

The custom allocator is removed, but a custom deleter is needed as the
Camera destructor is private.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-05-23 11:54:39 +03:00