summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-01-08test: Rename list test to list-camerasLaurent Pinchart
The list test generates a list binary in the test directory, which conflicts with the C++ std::list header of the same name. The binary gets included instead of the header file, breaking compilation. Rename the test to avoid this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-08libcamera: Add a poll-based event dispatcherLaurent Pinchart
Provide a poll-based event dispatcher implementation as convenience for applications that don't need a custom event loop. The poll-based dispatcher is automatically instantiated if the application doesn't provide its own dispatcher. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-08libcamera: Add event notification infrastructureLaurent Pinchart
Add three new classes, EventDispatcher, EventNotifier and Timer, that define APIs for file descriptor event notification and timers. The implementation of the EventDispatcher is meant to be provided to libcamera by the application. The event dispatcher is integrated twith the camera manager to implement automatic registration of timers and events. 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-08libcamera: Add signal/slot communication mechanismLaurent Pinchart
Introduce a Signal class that allows connecting event sources (signals) to event listeners (slots) without adding any boilerplate code usually associated with the observer or listener design patterns. 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-08libcamera: camera_manager: Make the class a singletonLaurent Pinchart
There can only be a single camera manager instance in the application. Creating it as a singleton helps avoiding mistakes. It also allows the camera manager to be used as a storage of global data, such as the future event dispatcher. 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-08libcamera: log: Pad timestamp fields with zerosLaurent Pinchart
The logger prints the timestamp fields with a fixed width, but pads them with spaces instead of zeros. Fix this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-08libcamera: log: Add an ASSERT macroLaurent Pinchart
The ASSERT() macro is similar to the assert() macro defined by the C standard, but uses the libcamera logging infrastructure. 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>
2019-01-08libcamera: log: Add a LogFatal log levelLaurent Pinchart
The LogFatal log level is similar to the LogError level, but additionally abort program execution. This is useful to implement assertion handlers. 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>
2019-01-08Documentation: Suppress normal doxygen outputKieran Bingham
Enable the QUIET mode of Doxygen so that warnings and errors from Doxygen are more prominent in the build logs. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-08libcamera: media_object: Rename major/minor functionsKieran Bingham
The system libraries define macro's for major/minor through <sys/types.h> on some versions of GCC/GLibc. To prevent namespace collisions with these macros, rename our major and minor device node accessors. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-04libcamera: pipeline_handler: Improve documentationLaurent Pinchart
Miscellaneous documentation improvements for the PipelineHandler and related classes. 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-04libcamera: pipeline_handler: Remove unneeded forward declarationLaurent Pinchart
There's no need to forward-declare the PipelineManagerFactory class. Remove it. 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-04libcamera: device_enumerator: Improve documentationLaurent Pinchart
Miscellaneous documentation improvements for the DeviceEnumerator and related classes. 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-04libcamera: device_enumerator: Constify argument to search functionLaurent Pinchart
The DeviceEnumerator::search() function doesn't need to modify its DeviceMatch argument, make it const. 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-04libcamera: device_enumerator: Fix wording of log messageLaurent Pinchart
The log message still refers to the DeviceInfo class that has been removed. Replace it with a reference to MediaDevice. 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-04libcamera: device_enumerator: Downgrade skipped device errors to warningsLaurent Pinchart
When a device is skipped by the udev-based enumerator a message is logged. Downgrade its severity to warning as the error isn't fatal. 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-04libcamera: device_enumerator: Fix indentationLaurent Pinchart
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-04libcamera: camera_manager: Sort includes alphabeticallyLaurent Pinchart
Alphabetically sorted includes help finding where to insert new include statements, and avoiding duplicates. 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-04libcamera: camera_manager: Remove put() methodLaurent Pinchart
The method is declared but not implemented. Remove it. 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-03libcamera: Use 'struct' for structure typesJacopo Mondi
Add back the 'struct' keyword for structure types. C++ allows omitting the 'struct' keywork. Add it back to make clear we're dealing with structures and not class types. While at there re-sort fields of media_v2_* type in populate() function to reflect the declaration order in the kernel headers. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-03libcamera: media_device: Minor cleanup in findInterface()Jacopo Mondi
Do not compare an usigned int with -1 to avoid going through cast. Also align function parameters and long assignement lines while at there. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-02licenses: Add the Developer CoOKieran Bingham
Provide a reference copy of the Developers Certificate of Origin. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02libcamera: media_device: Zero media graph arrays when querying topologyLaurent Pinchart
This silences valgrind that otherwise warns about usage of uninitialized values. While not strictly required as the kernel should fill the whole arrays in MEDIA_IOC_G_TOPOLOGY, the extra cost, in a non-critical path, is negligible compared to the ability to run without valgrind warnings. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02libcamera: media_device: Make getEntityByName() constJacopo Mondi
The function does not modify the instance state. Mark it as const. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-02libcamera: media_device: Tiny valid() documentation improvementJacopo Mondi
Mention in the valid() method documentation, that a media graph has to be populated to be valid. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-02libcamera: device_enumerator: Use MediaDeviceJacopo Mondi
Replace usage of the DeviceInfo class with MediaDevice in the DeviceEnumerator and remove the DeviceInfo class. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02libcamera: media_device: Create entities with major and minor numbersJacopo Mondi
Extend the MediaEntity object with device node major and minor numbers, and retrieve them from the media graph using interfaces. They will be used by the DeviceEnumerator to retrieve the devnode path. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02libcamera: media_device: Add DeviceInfo featuresJacopo Mondi
Add the features of the DeviceInfo class needed to replace it with MediaDevice. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02test: Move include definitions to libtestKieran Bingham
With the libtest functionality moved to its own library folder, the definitions for test includes should reasonably live there too. The libtest subdir should always remain the first entry in the test/meson.build file. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02test: Use foreach iterators to simplify definitionsKieran Bingham
Create two arrays, to contain public and internal test targets, and use the foreach iterators to automatically generate test output targets for each entry in each array. The public tests array is linked only against public libcamera headers, while tests declared in the internal_tests will have access to non-public API headers from within the libcamera sources. 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> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02test: media_device: Move test definitionKieran Bingham
The test definition for the media_device_test executable should be located with the exectuable definition. Move it to the meson.build of that test suite subdir. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02libcamera: Remove libcamera classLaurent Pinchart
The class was just a placeholder, now that we have other objects defined, remove it along with the associated test. The libcamera/libcamera.h header is kept as a shortcut to include the whole libcamera public API. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-02libcamera: mediadevice: Improve documentationLaurent Pinchart
Improve the documentation of the media device operation, including how it handles the lifetime of media objects. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-02libcamera: mediadevice: Reorder functions in declaration orderLaurent Pinchart
In order to simplify navigation in the .cpp file, order functions in the declaration order in the .h file. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-02libcamera: mediadevice: Make getEntityByName() publicLaurent Pinchart
The function is useful as a public API, make it public. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-02libcamera: mediadevice: Fix graph parsing error handlingLaurent Pinchart
Most errors recorded during graph parsing are logged but not propagated to the caller. Fix this and delete objects that are created but not successfully added to the graph to avoid memory leaks. As the error code returned from the addObject() and populate*() functions doesn't matter much, turn them into bool functions. Additionally, add a way to query whether the media graph was valid, and clear objects before populating the graph to avoid leaking them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-01meson: Shorten project descriptionKieran Bingham
The project description is really the project name. The extraneosly long string gets printed at the test runner prefixed to the suite. As such it should really be the shortened simple project name. Remove the 'description' from the project naming field. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-01test: libtest: Return all non-zero init valuesKieran Bingham
A skipped test is currently defined as returning 77. If this is returned by the init stage, currently the execute call will continue on to the run stage. Correct this such that any non-zero return code from the init phase will abort the test. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-01test: libtest: Add test return codesKieran Bingham
The meson test infrastructure uses return codes to determine test results. Define these values for use in tests. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [Use an enum instead of macros for test return codes.] Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-01test: Move test objects to libtestKieran Bingham
Create a subdirectory to contain the libtest helper library. Define two variables to clarify when tests are aimed at public or internal components. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-31test: Add media device testJacopo Mondi
Add media device test infrastructure and an intial test that print out the media devices available in the system. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2018-12-31libcamera: Add MediaDevice classJacopo Mondi
The MediaDevice object implements handling and configuration of the media graph associated with a media device. The class allows enumeration of all pads, links and entities registered in the media graph. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2018-12-31libcamera: Add MediaObject class hierarchyJacopo Mondi
Add a class hierarcy to represent all media objects a media graph represents. Add a base MediaObject class, which retains the global unique object id, and define the derived MediaEntity, MediaLink and MediaPad classes. This hierarchy will be used by the MediaDevice objects which represents and handles the media graph. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2018-12-31tests: add test to list all cameras in the systemNiklas Söderlund
Add simple test which lists all cameras detected in the system. The test fails if no camera can be found. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2018-12-31libcamera: pipeline: vimc: add pipeline handler for vimcNiklas Söderlund
Provide a pipeline handler for the virtual vimc driver. 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>
2018-12-31libcamera: camera_manager: add CameraManager classNiklas Söderlund
Provide a CameraManager class which will handle listing, instancing, destruction and lifetime management of cameras. 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>
2018-12-31libcamera: pipeline_handler: add PipelineHandler classNiklas Söderlund
Provide a PipelineHandler which represents a handler for one or more media devices and provides one or more cameras. 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>
2018-12-31libcamera: device_enumerator: add documentationNiklas Söderlund
Document the intended use-case of the different elements of the device enumerator. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2018-12-31libcamera: device_enumerator: add factory for DeviceEnumeratorsNiklas Söderlund
Provide a factory for DeviceEnumerator objects. Depending on which libraries are available there will be different ways to enumerate information in the system. This factory hides this from the rest of the library. Currently udev enumeration is the only supported implementation, a sysfs implementation is another method that surely will be added in the future. 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>
2018-12-31libcamera: device_enumerator: add DeviceEnumeratorUdev classNiklas Söderlund
Provide a DeviceEnumeratorUdev class which is a specialization of DeviceEnumerator which uses udev to enumerate information in the system. 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>