Commit graph

652 commits

Author SHA1 Message Date
Laurent Pinchart
9d29af143b libcamera: media_device: Add disconnected signal
The signal is emitted when the hardware device corresponding to the
media device is unplugged. This will trigger the full unplug handling
chain.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-24 22:24:13 +02:00
Laurent Pinchart
4f043b05e7 libcamera: device_enumerator: Reference-count MediaDevice instances
The MediaDevice class will be the entry point to hot-unplug, as it
corresponds to the kernel devices that will report device removal
events. The class will signal media device disconnection to pipeline
handlers, which will clean up resources as a result.

This can't be performed synchronously as references may exist to the
related Camera objects in applications. The MediaDevice object thus
needs to be reference-counted in order to support unplugging, as
otherwise pipeline handlers would be required to drop all the references
to the media device they have borrowed synchronously with the
disconnection signal handler, which would be very error prone (if even
possible at all in a sane way).

Handle MedieDevice instances with std::shared_ptr<> to support this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-24 22:24:11 +02:00
Niklas Söderlund
5b02e03199 libcamera: camera: Associate cameras with their pipeline handler
The PipelineHandler which creates a Camera is responsible for serving
any operation requested by the user. In order forward the public API
calls, the camera needs to store a reference to its pipeline handler.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v1:

- Create pipeline handlers is shared pointers, make them inherit from
  std::enable_shared_from_this<> and stored them in shared pointers.
2019-01-24 22:24:11 +02:00
Laurent Pinchart
a29b7fc7d5 libcamera: pipeline_handler: Declare factory children classes as final
Nothing should inherit from the factory classes created by the
REGISTER_PIPELINE_HANDLER() macro. Declare them as final instead of only
declaring their create() method final.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-24 22:24:08 +02:00
Laurent Pinchart
e597598abf libcamera: pipeline_handler: Store the camera manager pointer
Instead of passing the camera manager pointer to the match() function,
and later to more PipelineHandler functions, store it in the
PipelineHandler::manager_ member variable at construction time and
access it from there.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-24 22:24:02 +02:00
Laurent Pinchart
4d470eb37f libcamera: event_dispatcher: Add interrupt() function
The new interrupt() function allows interrupting in-progress blocking
processEvents() calls. This is useful to stop running event loops.

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>
2019-01-23 18:51:56 +02:00
Laurent Pinchart
d370c1b46e libcamera: event_dispatcher_poll: Handle interrupted ppoll() calls
The ppoll() call can be interrupted if a signal is delivered. Handle the
EINTR error code gracefully by restarting the call. This fixes the
event-dispatcher test failure.

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>
2019-01-23 18:51:56 +02:00
Niklas Söderlund
d32dc0c1c8 libcamera: fix odd include file hierarchy
There is no need for pipeline_handler.h to include camera.h, instead it
should be included in the source file which needs it;
camera_manager.cpp.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-23 16:59:12 +01:00
Kieran Bingham
6b546603ac libcamera: log: Fix two typos
Two incorrect spellings are fixed.
 'logr' -> 'log'
 'environement' -> 'environment'

Fixes: 747ace042c ("libcamera: log: Get log levels from the environment")
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

The log levels configuration is stored in category:level pairs, not
category=value. Fix the documentation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-23 17:46:14 +02:00
Kieran Bingham
e5163f54d4 libcamera: v4l2device: Obtain device capabilities
The capabilities structure from the kernel can return capabilities of the
driver, or potentially more specific device capabilities.

Handle this with an inline function 'device_caps()' to return the device
specific capabilities when available, or fall back to the driver capabilities
otherwise.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-23 14:33:34 +00:00
Laurent Pinchart
a22dcaaa78 cam: options: Don't implement move semantics for OptionsParser::Options
The compiler creates a move constructor automatically when none is
supplied, and it does the right thing by default in this case. Using
std::move() inside the function prevents the compiler from doing
return value optimization and actually hinders performances. Using
std::move() in the caller is unnecessary, the move constructor is used
automatically by the compiler.

For all these reasons remove the tentative optimization that resulted in
worse performances and worse code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-22 20:44:04 +02:00
Kieran Bingham
29c3b54f0c libcamera: camera_manager: Return EBUSY if enumerator exists
In the case that someone calls CameraManager::start() and it has already
started/enumerated, instead of returning -ENODEV, return -EBUSY.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-22 15:15:14 +00:00
Niklas Söderlund
f10f1b8bb1 libcamera: media_device: fix typo in documentation for MediaDevice::deviceNode()
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-22 16:10:11 +01:00
Jacopo Mondi
8abff82a9c libcamera: ipu3: Use log categories
Log the IPU3 pipeline using IPU3 log category

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-22 16:01:54 +01:00
Niklas Söderlund
a9685c508f libcamera: device_enumerator: extend documentation of DeviceMatch
Extend the documentation of the intended usage of DeviceMatch. The
DeviceMatch needs enough information to be able to uniquely identify a
specific media device.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-22 15:05:05 +01:00
Niklas Söderlund
70b0518ba7 libcamera: pipeline: uvcvideo: add pipeline handler for uvcvideo
Provide a pipeline handler for uvcvideo devices. The entity names for
UVC devices are different for different cameras so matching on entity
names is not possible in the generic case. This leaves options to create
specialized UVC pipeline handlers if needed to fit a specific model's
needs.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-22 14:54:20 +01:00
Niklas Söderlund
5db44e6da7 libcamera: media_device: expose media graph model name
Pipeline handlers such as the upcoming ucvideo handler need the model
name to properly name the Camera objects they create. Store the model
name when querying the media device info and handle it in a similar
fashion as the driver name which is already retrieved.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-22 14:54:20 +01:00
Jacopo Mondi
1af83ca6df libcamera: Global s/devnode/deviceNode rename
Do not use the abreviated version for members, variables and getter
methods.

Library-wise rename, no intended functional changes.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-22 14:14:04 +01:00
Jacopo Mondi
d18d25bde3 libcamera: v4l2_device: Add MediaEntity contructor
Construct a V4L2Device from a MediaEntity device node path. While at
there mark constructor as explicit to avoid copy-construction.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-22 14:14:04 +01:00
Laurent Pinchart
f5e48ebf44 cam: Extract option parser to separate file
And turn it into an OptionsParser object.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-22 14:04:09 +01:00
Niklas Söderlund
fba3d04607 cam: add utility to control cameras
Provide a utility to interact with cameras. This initial state is
limited and only supports listing cameras in the system and selecting a
camera to interact with.

There is not much a interacting possible yet with a camera so the tool
simply exercise the API to get hold of a camera.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-22 14:03:41 +01:00
Jacopo Mondi
93734d7fe0 libcamera: pipeline: Add Intel IPU3 pipeline
Add a pipeline handler for the Intel IPU3 device.

The pipeline handler creates a Camera for each image sensor it finds to be
connected to an IPU3 CSI-2 receiver, and enables the link between the two.

Tested on Soraka, listing detected cameras on the system, verifying the
pipeline handler gets matched and links properly enabled.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-22 11:16:28 +01:00
Laurent Pinchart
8b8ae52134 libcamera: Use log categories
Use log categories in the whole existing code base.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-21 21:47:25 +02:00
Laurent Pinchart
457208178c libcamera: log: Get log output file from the environment
If the LIBCAMERA_LOG_FILE environment variable is set, open the file it
points to and redirect the logger output to it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-21 21:47:25 +02:00
Laurent Pinchart
747ace042c libcamera: log: Get log levels from the environment
Set the log level for each log category from the environment variable
LIBCAMERA_LOG_LEVELS.

The variable contains a comma-separated list of category:level pairs,
and category names can include wildcards.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-21 21:47:25 +02:00
Laurent Pinchart
63675b6dcf libcamera: log: Add log categories
Log categories are used to group log messages by topic. Introduce
support for categories by making the LOG() macro variadic. Support for
configuring log level per category will be introduced in a subsequent
commit.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-21 21:47:17 +02:00
Jacopo Mondi
5c85ef5883 libcamera: media_object: Set devnode in MediaEntity
The MediaEntity::setDeviceNode() function was designed to set the device
node path associated with a MediaEntity. The function was there, but the
devnode_ member field was never actually set. Fix this.

While at there add a getter method for the devnode_ member as it will
soon be used.

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>
2019-01-21 11:35:44 +01:00
Jacopo Mondi
ec53057f0a libcamera: media_object: Add functions to entities
Media entities convey information about their main function in the
'function' field of 'struct media_v2_entity'.

Store the main function in the MediaEntity function_ class member and provide
a getter function for that.

While at there update comments, keep the MediaPad description in sync
with the MediaEntity one and remove a stale TODO entry.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-21 11:35:30 +01:00
Laurent Pinchart
21ff749a79 libcamera: camera: Handle camera objects through shared pointers
The Camera class is explicitly reference-counted to manage the lifetime
of camera objects. Replace this open-coded implementation with usage of
the std::shared_ptr<> class.

This API change prevents pipeline handlers from subclassing the Camera
class. This isn't deemed to be an issue. Mark the class final to make
this explicit.

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-01-21 11:13:53 +02:00
Laurent Pinchart
f3695e9b09 libcamera: camera_manager: Register cameras with the camera manager
Cameras are listed through a double indirection, first iterating over
all available pipeline handlers, and then listing the cameras they each
support. To simplify the API make the pipeline handlers register the
cameras with the camera manager directly, which lets the camera manager
easily expose the list of all available cameras.

The PipelineHandler API gets simplified as the handlers don't need to
expose the list of cameras they have created.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-21 11:13:49 +02:00
Laurent Pinchart
32bf7ef239 libcamera: camera_manager: Use std::unique_ptr to store event dispatcher
The CameraManager takes ownership of the dispatcher passed to the
setEventDispatcher() function. Enforces this by using std::unique_ptr<>.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-21 11:13:45 +02:00
Laurent Pinchart
bd0c818023 libcamera: signal: Enable documentation generation from signal.h file
signal.cpp is missing a \file signal.h Doxygen directive, preventing
documentation from being generated for the Signal class. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-21 10:52:30 +02:00
Laurent Pinchart
576c9454cf libcamera: utils: Don't use C++17 nested namespaces
Nesting namespace names in a single namespace declaration is a C++17
feature. As libcamera depends on C++11 only, nest two separate namespace
declarations instead.

Reported-by: Shik Chen <shik@google.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-19 00:52:15 +02:00
Kieran Bingham
e74f3eebb4 libcamera: Add V4L2 Device object
Provide a helper V4L2 device object capable of interacting with the
V4L2 Linux Kernel APIs.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-17 21:55:21 +00:00
Kieran Bingham
e399a0745b libcamera: event_dispatcher_poll: Fix trivial spelling
Correct the spelling of 'notifiers'.

Fixes: 8356f8a6ab ("libcamera: Add a poll-based event dispatcher")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-17 21:31:33 +00:00
Kieran Bingham
d67841a990 libcamera: log: Fix coding style warnings
The checkstyle utility highlights some minor warnings against the logger
implementation.

Fix these up.

Fixes: edbd2059d8 ("libcamera: Add initial logger")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-17 21:31:33 +00:00
Kieran Bingham
5651334119 libcamera: timer: Fix 32 bit wrap
The msec parameter was multiplied as a 32 bit value when converting to
nanosecond resolution. This wraps at 4.2949 seconds, and causes timers
longer than this to fail.

Fix the multiplication to upcast to 64 bit using an unsigned long long
specifier on the multiplier.

While we're here, initialise the two integer class members in the
constructor initialiser list.

Fixes: 1a57bcb8d1 ("libcamera: Add event notification infrastructure")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-17 21:31:33 +00:00
Laurent Pinchart
62eae99ed2 libcamera: camera_manager: Turn enumerator into a unique_ptr<>
Convey the fact that the CameraManager class owns the DeviceEnumerator
instance it creates by using std::unique_ptr<> to store the pointer.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-16 18:23:43 +02:00
Laurent Pinchart
a2f095947f libcamera: utils: Implement C++14 make_unique<>()
C++14 introduces std::make_unique<>() that makes it easier to initialize
unique_ptr<> instances. As libcamera is limited to C++11, implement our
own version of the function in the libcamera::utils namespace.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-16 18:23:43 +02:00
Laurent Pinchart
f388aa7041 libcamera: device_enumerator: Don't mark the search() function as const
While the DeviceEnumerator::search() function doesn't modify the
instance directly, it returns a non-const pointer to a MediaEntity that
is owned by the DeviceEnumerator instance. This breaks the const
semantics. Don't mark the function as const.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-16 18:23:43 +02:00
Laurent Pinchart
3e6090a17a libcamera: event_dispatcher_poll: Constify argument to processNotifiers
The EventDispatcherPoll::processNotifiers() function doesn't modify the
argument it receives, make it const.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-16 18:23:43 +02:00
Laurent Pinchart
6ee4050182 libcamera: pipeline_handler: Rename handlers() method to factories()
The PipelineHandlerFactory::handlers() static method returns a list of
factories, not a list of handlers. Rename it accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-16 18:23:43 +02:00
Laurent Pinchart
6c87662ee9 libcamera: camera_manager: Improve class documentation
Move documentation from the \file directive to the CameraManager class,
as it documents the class, not the file. Improve the documentation to
provide a brief overview of how the camera manager operates, and fix a
few typos and inconsistencies.

The documentation mentions hotplug even though it isn't implement yet,
as this is a planned feature. More improvements are needed for the
documentation of the CameraManager member functions, and will be added
as part of the API improvements in the near future.

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-01-16 18:23:43 +02:00
Laurent Pinchart
34018d23d7 libcamera: pipeline_handler: Don't index factories by name
Pipeline handler factories are register in a map indexed by their name,
and the list of names is used to expose the factories and look them up.
This is unnecessary cumbersome, we can instead store factories in a
vector and expose it directly. The pipeline factory users will still
have access to the factory names through the factory name() function.

The PipelineHandlerFactory::create() method becomes so simple that it
can be inlined in its single caller, removing the unneeded usage of the
DeviceEnumerator in the factory.

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-01-16 18:23:42 +02:00
Jacopo Mondi
f1caaaf387 libcamera: Debug printouts fixes
Address a few issues I missed during patch review.

Minor cosmetic change.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-15 09:44:01 +01:00
Jacopo Mondi
fd0339da1a libcamera: Add debug printouts
Add a few debug printouts that help follow the library intialization
process: what pipeline handlers are registered, what media devices are
created, and which pipeline manager gets matches with the current
system.

The resulting output is the following, on IPU3 devices:
DBG pipeline_handler.cpp:119 Pipeline handler: "PipeHandlerVimc" registered
DBG pipeline_handler.cpp:119 Pipeline handler: "PipelineHandlerIPU3" registered
DBG device_enumerator.cpp:214 New media device: ipu3-imgu created from: /dev/media0
DBG device_enumerator.cpp:214 New media device: ipu3-cio2 created from: /dev/media1
DBG device_enumerator.cpp:255 Succesfull match for media device: ipu3-cio2
DBG device_enumerator.cpp:255 Succesfull match for media device: ipu3-imgu
DBG pipeline_handler.cpp:150 Pipeline handler: "PipelineHandlerIPU3" matched

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-15 09:29:00 +01:00
Kieran Bingham
bced32d514 libcamera: log: Fix unknown log level representation
Commit 99a3e7bcfb ("libcamera: log: Add a LogFatal log level")
expanded the text representation of the log levels to support the FATAL
string, but left the default unknown match at four characters.

This code should never expect to be executed, but for completeness match
the string lengths by adding an extra character to the result.

Fixes: 99a3e7bcfb ("libcamera: log: Add a LogFatal log level")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-14 22:24:22 +00:00
Laurent Pinchart
824ed85553 libcamera: device_enumerator: Fix memory leak in error path
The DeviceEnumerator::create() function allocates a
DeviceEnumeratorUdev and fails to delete it in the error path, causing a
memory leak. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-10 15:28:04 +02:00
Laurent Pinchart
93a037efff libcamera: Document missing parameters and return values
Several functions are missing documentation for some of them parameters
and/or for their return value. Fix this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-10 15:27:59 +02:00
Jacopo Mondi
4e78147df9 libcamera: Add link handling functions
Add a function to the MediaLink class to set the state of a link to
enabled or disabled. The function makes use of an internal MediaDevice
method, which is defined private and only accessible by the MediaLink
setEnabled() function itself.

Also add to MediaDevice a function to reset all links registered in the
media graph.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-09 09:16:47 +01:00