Commit graph

9 commits

Author SHA1 Message Date
Umang Jain
313d65ca25 test: v4l2_subdevice: list_formats: Port to use utils::hex() output helper
The hex stream output helper was introduced in f391048a7b ("libcamera: utils:
Add hex stream output helper"). It simplifies writing hexadecimal values to an
ostream which can be used in this test too. As the helper doesn't modify the
stream configuration (refer to utils::hex() documentation), this eliminates the
need of restoring the stream's format state as pointed out by the coverity scan.

Reported-by: Coverity CID=279058
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-06-08 16:56:07 +01:00
Laurent Pinchart
93e72b695e libcamera: Move internal headers to include/libcamera/internal/
The libcamera internal headers are located in src/libcamera/include/.
The directory is added to the compiler headers search path with a meson
include_directories() directive, and internal headers are included with
(e.g. for the internal semaphore.h header)

  #include "semaphore.h"

All was well, until libcxx decided to implement the C++20
synchronization library. The __threading_support header gained a

  #include <semaphore.h>

to include the pthread's semaphore support. As include_directories()
adds src/libcamera/include/ to the compiler search path with -I, the
internal semaphore.h is included instead of the pthread version.
Needless to say, the compiler isn't happy.

Three options have been considered to fix this issue:

- Use -iquote instead of -I. The -iquote option instructs gcc to only
  consider the header search path for headers included with the ""
  version. Meson unfortunately doesn't support this option.

- Rename the internal semaphore.h header. This was deemed to be the
  beginning of a long whack-a-mole game, where namespace clashes with
  system libraries would appear over time (possibly dependent on
  particular system configurations) and would need to be constantly
  fixed.

- Move the internal headers to another directory to create a unique
  namespace through path components. This causes lots of churn in all
  the existing source files through the all project.

The first option would be best, but isn't available to us due to missing
support in meson. Even if -iquote support was added, we would need to
fix the problem before a new version of meson containing the required
support would be released.

The third option is thus the only practical solution available. Bite the
bullet, and do it, moving headers to include/libcamera/internal/.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2020-05-16 03:38:11 +03: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
9342c60649 tests: list_formats: Fix argument names and add const
Argument name differs from definition and implementation, fix it by
renaming the definition. While at it make the argument const.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-25 14:26:40 +02:00
Laurent Pinchart
05b0e5ed53 libcamera: v4l2_subdevice: Add method to retrieve the media entity
Add a method to retrieve the media entity associated with a subdevice.
The entityName() and deviceNode() methods are not needed anymore as they
can be accessed through the media entity, remove them.

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-04-18 18:13:16 +03:00
Laurent Pinchart
72afcbb087 libcamera: geometry: Use Size to store min and max in SizeRange
Instead of storing four integers for the minimum and maximum width and
height in the SizeRange class, use two instance of the Size class for
the minimum and maximum sizes.

While it at replace the mention of image size with size in the SizeRange
documentation, as the Size class isn't limited to image sizes.

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-04-18 18:13:06 +03:00
Niklas Söderlund
58f1ad3c79 libcamera: Make geometry.h a public header
Make the geometry header public so it can be used by the API facing
applications.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-04-05 21:47:34 +02:00
Jacopo Mondi
5b9b3c38a1 libcamera: v4l2_subdevice: Rename deviceName() method
Rename the 'deviceName()' method to 'entityName()' as it actually
returns the name of the entity backing the v4l2 subdevice.

While at it, make the names getter methods return a const reference
instead of returning by copy.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-02 11:02:38 +02:00
Jacopo Mondi
de16573bcc test: v4l2_subdevice: Add ListFormat test
Add test to list formats on a v4l2 subdevice.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-03-02 18:31:30 +01:00