summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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>
2018-12-31libcamera: device_enumerator: add DeviceEnumerator classNiklas Söderlund
Provide a DeviceEnumerator base class which enumerates all media devices in the system and information about them, resolving Media Controller data structures to paths and a method to search in all the enumerated information. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-31libcamera: device_enumerator: add DeviceMatch classNiklas Söderlund
Provide a DeviceMatch class which represents all properties of a media device a pipeline hander can specify when searching for a device to use in its pipeline. 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: device_enumerator: add DeviceInfo classNiklas Söderlund
Provide a DeviceInfo class which holds all information from the initial enumeration of a media device. Not all information available at a media device is stored, only the information needed for a pipeline handler to find a specific device. 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: add dependency on libudevNiklas Söderlund
The device enumeration will depend on libudev, add the dependency to the build system. This should be turned into a optional dependency once a device enumerator not using udev is supported. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-31libcamera: Add Camera classNiklas Söderlund
Provide a Camera class which represents our main interface to handling camera devices. This is a rework of Kieran's initial proposal and Laurent's documentation of the file changed to fit the device enumerators needs. 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-21utils: checkstyle: add keep-one-line-blocksKieran Bingham
Enable --keep-one-line-blocks to prevent astyle from wanting to move single inlined blocks to cover 4 lines such as: - virtual int init() { return 0; } + virtual int init() + { + return 0; + } Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-12-21tests: call the derived Test class cleanup() functionNiklas Söderlund
Calling the cleanup() function in the base class Test destructor only calls the base class empty cleanup() function, not the overloaded one. This results in tests not cleaning up after themself. Solve this by explicitly calling the cleanup() function from execute(). This was discovered while running valgrind on tests where objects where allocated in init() and freed in cleanup(). Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-21tests: Add a base Test classLaurent Pinchart
The base Test class is meant to provide infrastructure common to all tests. It is very limited for now, and should be extended with at least logging and assertion handling. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2018-12-19libcamera: log: Add a debug log levelLaurent Pinchart
Many of the message logged by the library will be debug messages, we thus need a debug log level. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-19utils: checkstyle.py: Strip trailing white spacesLaurent Pinchart
As astyle doesn't strip trailing white spaces, strip them manually. Organize the code to allow for new additional formatting steps if needed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-19utils: checkstyle.py: Highlight trailing white space at end of lineLaurent Pinchart
In order to facilitate interpretation of diffs, highlight trailing white space at end of lines with a red background. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-19utils: checkstyle.py: Support execution from non-root directoriesLaurent Pinchart
The git diff command is invoked with relative paths, which causes git to fail to locate files when the checkstyle.py script is run from subdirectories of the git tree. Fix this by prepending the absolute path to the git tree root directory to the file names. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-19build: Define library private include pathJacopo Mondi
Separate declaration of library internal inclusion path. This will be used by tests, developed outside of library code, that need to include parts of the library internal APIs and can re-use the here defined variable. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2018-12-19libcamera: include: Import media.h from Linux v4.19Jacopo Mondi
In order to avoid depending on system headers that may be outdated compared to the kernel version available at runtime, import the Linux kernel headers related to the APIs that libcamera requires a recent version of. This allows libcamera to use the latest kernel APIs even when compiled on older systems. The library must of course test at runtime whether those APIs are available and fallback to older APIs in order to support older kernels. Import media.h for the recent media controller APIs. The file is extracted verbatim from kernel v4.19. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2018-12-14Documentation: Remove | on the left side of diagramsLaurent Pinchart
There's no need to add a character on the left side of the ascii art diagrams, provided that we indent them properly. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-14Documentation: Document the style check scriptJacopo Mondi
Add a section to the coding style documentation to explain usage of the checkstyle.py script. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-14utils: Add Python-based commit style checker scriptLaurent Pinchart
checkstyle.py is a reimplementation of checkstyle.sh in Python, that should be easier to extend with additional features. Three additional features and enhancements are already implemented: - While retaining the default behaviour of operating on the HEAD commit, a list of commits can also be specified on the command line. - Correct line numbers are printed in the diff output. - The index and working tree are not touched, they can be dirty. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-14git: Add .gitignore fileKieran Bingham
Provide an initial starting point for our ignore file. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-14Documentation: contributing: Mark command line as shell code-blockLaurent Pinchart
The git clone command line is a (single line) block of shell code, mark it appropriately. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-12-14Documentation: coding-style: Fix list indentationLaurent Pinchart
The various lists in the document are not quoted blocks. Don't indent them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-12-14Documentation: Add architecture documentationLaurent Pinchart
The documentation is copied mostly verbatim from the website, with small modifications to the ascii art diagrams to make them compile. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-12-14Documentation: contributing: Add links to libcamera git and linuxtv.orgLaurent Pinchart
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-12-14Documentation: Remove _static and _templates directoryLaurent Pinchart
sphinx only requires those directories to be present because they're referenced in the configuration file. Remove the references and the directories. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-12-13Documentation: Add coding style documentJacopo Mondi
Add document to summarize the coding style adopted by libcamera. 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>
2018-12-13build: Add 'std=c++11' cpp compiler flagJacopo Mondi
Building the current master branch with g++ 5.4.0-6 fails with: ./src/libcamera/include/log.h:25:34: error: defaulted and deleted functions only available with -std=c++11 \ or -std=gnu++11 [-Werror] LogMessage(const LogMessage&) = delete; Fix this by adding the 'std=c++11' compiler argument for to the list of cpp build flags. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2018-12-12libcamera: log: Document the LogMessage classLaurent Pinchart
Fix Doxygen build warnings by adding the missing documentation for the LogMessage class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-12libcamera: log: Fix Doxygen documentationLaurent Pinchart
Now that the documentation can be compiled, Doxygen throws a few warnings due to incorrect enum field naming. Fix it. The \file block needs to be named after the header file in order for Doxygen to document any global function, variable, typedef or enum defined in the header (as documented in the Doxygen manual under the \file command). We thus need to use log.h as the file name. No \file block is needed for the .cpp file, as we don't want to generate documentation for internal private globals. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-12Documentation: Generate source code documentation using DoxygenLaurent Pinchart
Extend the documentation build system to automatically generate documentation from source code using Doxygen. This is currently separate from the sphinx documentation, and should be integrated using the breathe (and possibly exhale) extensions. As the Documentation/meson.build file needs to reference the variables holding the source files, move the Documentation directory to the end of the subdirs() in the top-level meson.build. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-12Documentation: Don't hardcode install directoryLaurent Pinchart
Use the datadir option to select the directory in which to install documentation. This defaults to $prefix/share so this doesn't introduce any change in the default case. While at it use join_paths() to join patch components instead of hardcoding the / separator. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-12-11Documentation: Set install_dir in custom_target()Laurent Pinchart
The custom_target() function accepts an install_dir parameter. Along with setting install to true, this can be used to replace the install_subdir() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>