Commit graph

116 commits

Author SHA1 Message Date
Jacopo Mondi
f7e75d9e70 libcamera: v4l2_device: Construct from MediaEntity*
The V4L2Device constructor wants a "const MediaEntity &", while
entities are usually retrieved by pointer before being used to construct
a V4L2Device. Change the constructor argument to "const MediaEntity *".

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-05 14:03:16 +01:00
Jacopo Mondi
acae9a9fd2 libcamera: v4l2_device: Set bytesperline in single plane S_FMT
The 'bytesperline' field of 'struct v4l2_pix_format' has to be set for
the single planar set format use case.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-03 12:18:02 +01:00
Jacopo Mondi
f8c0c5817e libcamera: v4l2_device: Zero-initialize V4L2 format
Zero initialize v4l2_format structures used to set and get format on the
V4L2 device.

Fixes: ba8da0f2fc ("libcamera: v4l2_device: Add methods to get/set format")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-03 12:16:59 +01:00
Jacopo Mondi
a9f302dc05 libcamera: v4l2_device: Rename plane format fields
Rename the number of valid plane formats to 'planesCount' and the actual
per-plane size information array to 'planes'.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-03 12:16:27 +01:00
Jacopo Mondi
755644fe64 libcamera: v4l2_device: Rename parameters to s/g_fmt
Rename parameters to get and set format functions to expand 'fmt' to
'format'.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-03 12:16:11 +01:00
Jacopo Mondi
2f516306a7 libcamera: v4l2_device: Fix getFormatSingleplane ioctl
The single plane getFormat() function wrongly used the VIDIOC_S_FMT ioctl.
Fix that by using the more opportune VIDIOC_G_FMT one.

Fixes: ba8da0f2fc ("libcamera: v4l2_device: Add methods to get/set format")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-03 12:14:46 +01:00
Jacopo Mondi
a78e56ecc2 libcamera: v4l2_device: Rename format() method to getFormat()
Rename format() to getFormat() to reflect the v4l2 API names more
closely.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-03 12:14:05 +01:00
Jacopo Mondi
ba8da0f2fc libcamera: v4l2_device: Add methods to get/set format
Add methods to set and get the image format programmed on a V4L2Device
for both the single and multi planar use case.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-29 15:36:38 +01:00
Jacopo Mondi
267b91373b libcamera: v4l2-format: Add V4L2DeviceFormat
Add a V4L2DeviceFormat class aimed to be used to provide format configuration
requests to a V4L2Device.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-29 15:34:20 +01:00
Laurent Pinchart
a5f330629a libcamera: v4l2_device: Fix wording in documentation
Fix one wording issue in documentation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-26 15:57:12 +02:00
Jacopo Mondi
987bd370b0 libcamera: v4l2_device: Identify multiplanar formats
Add functions to V4L2Capability to identify if a V4L2 device supports
multiplanar V4L2 APIs.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-01-25 14:04:41 +01: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
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
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
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