Commit graph

279 commits

Author SHA1 Message Date
Laurent Pinchart
73a1bea709 libcamera: signal: Fix coding style issues
Fix issues reported by checkstyle.py in preparation for further changes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-13 13:23:38 +02:00
Laurent Pinchart
dc642f6d0b libcamera: pipeline_handler: Disconnect MediaDevice::disconnected signal
The pipeline handler connects the disconnected signal of MediaDevice
instances registered for hotplug handling to a member slot. Disconnect
the signal when the slot is called, as the pipeline handler will be
deleted.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-13 13:23:37 +02:00
Laurent Pinchart
0c0b1e4dbe cam: options: Fix coding style issue related to templates
Our coding style doesn't add a space after the template keyword. Fix the
source code accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-13 13:23:36 +02:00
Laurent Pinchart
5fb0ea016c utils: checkstyle: Catch LOG() usage without an explicit category
Add support for checkers not related to code formatting to the
checkstyle.py script, and create a first checker that catches usage of
the LOG() macro without an explicit category.

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-02-13 13:23:34 +02:00
Laurent Pinchart
bc4cace5f3 clang-format: Remove space after template
Our coding style doesn't require a space after the template keyword.
Adjust .clang-format accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-13 13:23:32 +02:00
Laurent Pinchart
04d5be7f76 libcamera: v4l2_device: Inherit from Loggable to print device node name
Automate printing of device node name in log messages by inheriting from
the Loggable class.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-11 11:23:51 +02:00
Laurent Pinchart
8a401ed411 libcamera: log: Allow extending log messages
Introduce a base Loggable class that can be inherited from by other
classes to support adding per-instance information to the log messages.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-11 11:23:51 +02:00
Laurent Pinchart
d8f2ed7d0d libcamera: pipeline_handler: Reorder member declaration order
Reorder the member declaration order in the PipelineHandler class to
match the control flow order, and to declare variables after methods
according to the coding style. Update the documentation accordingly,
preserving the order within the public, protected and private sections,
but grouping related methods together between the sections.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-11 11:23:51 +02:00
Niklas Söderlund
fd38fa66c3 libcamera: pipeline: vimc: Fix name of pipeline handler class
Rename the VIMC pipeline handler to match the naming convention.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-08 15:36:25 +01:00
Niklas Söderlund
8b27416267 cam: Add option to write raw frames to disk
Use the helper BufferWriter to optionally write frames to disk as they
are captured.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 08:03:03 +02:00
Niklas Söderlund
46ca8eeca0 cam: Add BufferWriter helper
Add a simpler helper to allow the cam application to write raw captured
frames to disk.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 08:03:03 +02:00
Niklas Söderlund
dbe7a28377 cam: Add capture operation
Add an option to capture frames from a camera and keep it running until
the user terminates by sending SIGINT.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 08:03:03 +02:00
Jacopo Mondi
edfdace1d5 libcamera: pipeline: ipu3: Implement capture support
Replace the buffer allocation, capture start/stop and request queue
stubs with real implementations.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-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-02-06 08:03:03 +02:00
Jacopo Mondi
7da6b95283 libcamera: pipeline: ipu3: Create video devices and subdevices
Create the video devices and subdevices associated with an IPU3 camera.
While at there, move the IPU3 pipeline handler class definition and the
associated IPU3CameraData to a separate header as the class has now
grown enough.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-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-02-06 08:03:03 +02:00
Niklas Söderlund
8cbe8fe650 libcamera: pipeline: vimc: Implement capture support
Replace the buffer allocation, capture start/stop and request queue
stubs with real implementations.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 08:03:03 +02:00
Niklas Söderlund
bbbf76a6c5 libcamera: pipeline: vimc: Set a default format
Pick a default format for the one stream in a vimc camera. This is
just a starting point to define a good default format for the vimc
camera, and is expected to evolve over time as the capabilities of the
library grows.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 08:03:03 +02:00
Kieran Bingham
17ae772e8d libcamera: pipeline: uvcvideo: Implement capture support
Replace the buffer allocation, capture start/stop and request queue
stubs with real implementations.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 08:03:03 +02:00
Niklas Söderlund
bd38112b77 libcamera: camera: Extend the interface to support capture
In order to support capture, the camera needs methods to allocate and
free buffers, to start and stop the capture and to queue requests.
Define those interfaces in the Camera class and implement them to call
the corresponding pipeline handler methods.

Once a camera is started the pipeline handler of the camera will begin
processing requests queued to the camera by the application until it
gets stopped.

Once a request is created it can be queued to the camera and the
application will be notified asynchronously once the request is
completed and be able to process all the buffers involved in the
request.

At this point the request objects don't support controls. This will be
extended in the future.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 07:41:51 +02:00
Niklas Söderlund
98edf29e01 libcamera: camera: Cache the stream configuration in the stream object
The API towards the application and pipeline handler can be simplified
if the camera caches which streams have been selected and their
respective configuration.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 07:41:51 +02:00
Niklas Söderlund
31bb25ae8d libcamera: camera: Add helper to check for exclusive access
Some operations on the camera requires the application to have exclusive
access to the camera. To help check for this in these operations add a
helper.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 07:41:51 +02:00
Niklas Söderlund
5239f6e656 libcamera: pipeline_handler: Extend the interface to support capture
In order to support capture, the pipeline handler needs methods to
allocate and free buffers, to start and stop the capture and to queue
requests. Define those interfaces in the PipelineHandler class and
implement them as stubs in the existing pipeline handlers.

This initial implementation only considers the allocation of new
buffers. Future work would need to expand this to also cover importing
buffers from an external source.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 07:41:51 +02:00
Jacopo Mondi
5aef825764 libcamera: Provide a Request object
Implement a Request object used by applications to queue image capture
requests to a camera.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-06 07:41:51 +02:00
Niklas Söderlund
1d7b6297f2 libcamera: stream: Add stream configuration to the stream object
Add a cache of the active stream configuration to the stream object.
This cache is to be updated from the Camera object and can be accessed
read only from both the application and pipeline handlers.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 07:41:51 +02:00
Kieran Bingham
1b7051b492 libcamera: stream: Construct a stream
Construct a stream object with a default internal pool.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-06 07:41:51 +02:00
Jacopo Mondi
468176fa07 libcamera: Add V4L2Subdevice
Add V4L2Subdevice class that provides an interface to interact with
V4L2 defined sub-devices.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-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-02-06 07:41:50 +02:00
Jacopo Mondi
8dbc203bb2 libcamera: Add geometry.h
Add geometry-related definitions in the geometry.h internal header.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-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-02-06 07:41:48 +02:00
Jacopo Mondi
8628b1e560 libcamera: v4l2_device: Add comments to method parameters
Add missing parameter documentation for set and get format methods.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-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-02-06 07:41:39 +02:00
Niklas Söderlund
e94e52c0cb libcamera: v4l2_device: Update dequeued buffer information
Copy the information from the struct v4l2_buffer when dequeueing the
buffer as applications need this information to make sense of the
captured data.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 06:49:45 +02:00
Kieran Bingham
ba4dfa7471 test: v4l2_device: Provide asynchronous capture test
Utilise the event_dispatcher to create a default event loop, and process
asynchronous buffer receive events.

If no frames are captured in 5 seconds, the test will fail.
It will also fail if less than 30 frames have been captured in the same
timeout period.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-06 06:49:43 +02:00
Kieran Bingham
d2046d863b test: v4l2_device: Add StreamOn/StreamOff test
Provide a small test to exercise the streamOn() and streamOff() calls.
8 buffers are requested locally.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-06 06:49:41 +02:00
Kieran Bingham
374673f84a libcamera: v4l2_device: Implement stream{On,Off}
Support starting and stopping a stream on a V4L2 device. Buffers must be
queued before the stream is started.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-06 06:49:38 +02:00
Kieran Bingham
dffbde33b8 libcamera: v4l2_device: Implement queue/dequeue operations
Provide queueBuffer() and dequeueBuffer() methods to interact with the
V4L2Device.

Buffers will be directly referenced from the bufferPool of the
V4L2Device based on the index in the pool.

The V4L2Device is now opened in non-blocking mode in order to avoid
blocking the dequeueBuffer() method. A signal is emitted when a buffer
is ready and has been dequeued.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-06 06:49:35 +02:00
Kieran Bingham
2843f951d5 test: v4l2_device: Add request_buffers test
Add a utility to the test suite to request and allocate buffers from
a V4L2Device to ensure it functions correctly.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-06 06:49:31 +02:00
Kieran Bingham
771befc6dc libcamera: v4l2_device: Request buffers from the device
Provide an exportBuffers() function which allocates buffers with the MMAP
method, exports them using the dmabuf API and populates the given BufferPool.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-06 06:49:29 +02:00
Kieran Bingham
93ec63b867 test: v4l2_device: Use DeviceEnumerator to find a UVCVideo
Utilise the existing DeviceEnumerator system to identify a suitable
V4L2Device for testing.

Specifically target these tests at a uvcvideo driver based device as a known
supported target.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-06 06:49:25 +02:00
Kieran Bingham
83148ce8be libcamera: Add Buffer Management
Provide classes that represent frame buffers and pools of frame buffers.

An image within the system may use one or more Plane objects to track each
plane in the case of multi-planar image formats. The Buffer class manages all
of the data required to render or interpret the raw image data.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-06 06:49:19 +02:00
Jacopo Mondi
ccf7464a6e libcamera: v4l2_device: Improve documentation
Improve the V4L2DeviceFormat documentation as suggested during patches
review.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-05 14:08:12 +01:00
Jacopo Mondi
cbbc315fe9 libcamera: v4l2_device: s_format: Return the device format
Return the device format actually applied to the device on setFormat().

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-05 14:08:03 +01:00
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
Niklas Söderlund
dd45866ea4 libcamera: pipeline: uvcvideo: set a default format
Pick a default format for the UVC one stream in a UVC camera. This is
just a starting point to define a good default format for the UVC camera
it's expected to evolve over time as the capabilities of the library
grows.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-02-04 20:21:37 +01:00
Niklas Söderlund
4a5febd7dd libcamera: streams: extend stream configuration with buffer count
The camera needs to be configured with the number of buffers required to
satisfy the applications use case. While the application can request any
number of buffers, the pipeline must take the constraints of the Linux
driver into consideration.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-02-04 20:21:19 +01:00
Niklas Söderlund
08c31d2a86 libcamera: pipeline: vimc: create camera for Sensor B
Create a camera for Sensor B of the vimc pipeline. At this stage only
Sensor B is exposed while the are in total two sensors in the graph.
Going forward Sensor A should also be exposed as another camera. Sensor
B was chosen since the graph is configured correctly for it out of the
box. As we lack control over sub devices formats it's not really
possible to use Sensor A yet with the library.

Once both cameras are registered with the library they should be
extended to provide two streams each, one for the raw output and one for
the output which uses the shared scaler.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-02-04 16:52:50 +01:00
Kieran Bingham
8400bdd19a clang-format: Enable BreakBeforeTernaryOperators
This produces code with the ternary operators at the beginning instead of the
end of the line:

       return caps_.isMultiplanar() ? getFormatMultiplane(fmt)
                                    : getFormatSingleplane(fmt);

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-02-04 16:43:09 +01:00
Kieran Bingham
b82fac15c4 libcamera: camera: Fix spelling error
Fix a small typo in the camera object documentation.

 cameera -> camera

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-02-04 16:42:45 +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