summaryrefslogtreecommitdiff
path: root/src/cam/capture.h
AgeCommit message (Collapse)Author
2021-07-11libcamera: buffer: Rename buffer.h to framebuffer.hLaurent Pinchart
libcamera names header files based on the classes they define. The buffer.h file is an exception. Rename it to framebuffer.h. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-05-06cam: Implement OptMetadataJacopo Mondi
Implement support for the new '--metadata' option by printing the value of each metadata entry associated with a completed Request. As sample of the output, running on raspberry pi, looks like the following: 3050.205672 (30.01 fps) stream0 seq: 000033 bytesused: 720000 ScalerCrop = (0x2)/3280x2460 ExposureTime = 13969 AeLocked = true DigitalGain = 1.000721 Lux = 771.204224 ColourGains = [ 1.561101, 1.629698 ] ColourTemperature = 4289 SensorBlackLevels = [ 4096, 4096, 4096, 4096 ] ColourCorrectionMatrix = [ 1.691066, -0.599756, -0.091317, -0.437452, 1.983766, -0.546314, -0.083429, -0.722407, 1.805836 ] AnalogueGain = 2.000000 SensorTimestamp = 3050205672000 3050.238999 (30.01 fps) stream0 seq: 000034 bytesused: 720000 ScalerCrop = (0x2)/3280x2460 ExposureTime = 13969 AeLocked = true DigitalGain = 1.000709 Lux = 771.232422 ColourGains = [ 1.560868, 1.630029 ] ColourTemperature = 4289 SensorBlackLevels = [ 4096, 4096, 4096, 4096 ] ColourCorrectionMatrix = [ 1.691081, -0.599726, -0.091362, -0.437497, 1.983627, -0.546130, -0.083420, -0.722523, 1.805943 ] AnalogueGain = 2.000000 SensorTimestamp = 3050238999000 Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-02-05cam: Only queue the exact number of requests asked forNiklas Söderlund
The cam option --capture=N is suppose to only capture N requests. But if the processing done for each request is large (such as writing it to a slow disk) the current implementation could queue more than N requests before the exit condition is detected and capturing stopped. Solve this by only queueing N requests while still waiting for N requests to complete before exiting. 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>
2020-11-15cam: Move request processing to main threadLaurent Pinchart
The request completion handler is invoked in the camera manager thread, which shouldn't be blocked for large amounts of time. As writing the frames to disk can be a time-consuming process, move request processing to the main thread by queueing an event to the event loop. 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>
2020-10-12libcamera, android, cam, gstreamer, qcam, v4l2: Reuse RequestPaul Elder
Allow reuse of the Request object by implementing reuse(). This means the applications now have the responsibility of freeing the Request objects, so make all libcamera users (cam, qcam, v4l2-compat, gstreamer, android) do so. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-25cam: Print timestamp of captured buffersLaurent Pinchart
Print the timestamp of the captured buffer in addition to the frame rate, as this is more precise information that can help debugging issue. The log changes from Using camera \_SB_.PCI0.XHC_.RHUB.HS05-5:1.0-0bda:58f4 Capture until user interrupts by SIGINT fps: 0.00 stream0 seq: 000000 bytesused: 169968 fps: 28.57 stream0 seq: 000002 bytesused: 170352 fps: 31.25 stream0 seq: 000003 bytesused: 170428 fps: 32.26 stream0 seq: 000004 bytesused: 170672 fps: 27.78 stream0 seq: 000005 bytesused: 170568 to Using camera \_SB_.PCI0.XHC_.RHUB.HS05-5:1.0-0bda:58f4 Capture until user interrupts by SIGINT 93473.942525 (0.00 fps) stream0 seq: 000000 bytesused: 183940 93474.006528 (15.62 fps) stream0 seq: 000002 bytesused: 183512 93474.038525 (31.25 fps) stream0 seq: 000003 bytesused: 183760 93474.074530 (27.77 fps) stream0 seq: 000004 bytesused: 182704 93474.106581 (31.20 fps) stream0 seq: 000005 bytesused: 182768 While at it, compute the frame rate on the buffer timestamps instead of sampling the clock in the request completion handler. 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>
2020-08-14libcamera: request: Make Stream pointer constNiklas Söderlund
The Stream pointer just acts as a key in the Request object. There is no good use-case to modify a stream from a pointer retrieved from the Request, make it const. This allows pipeline handlers to better express that the Stream pointer is retrieved in a Request should just be treated as a key. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-07-27cam: Add optional argument to --capture to specify how many frames to captureNiklas Söderlund
Extend the '--capture' option with and optional numerical argument to be able to specify how many frames to capture before exiting. If the optional argument is not provided the old behavior of running until the user interrupts with a SIGINT is retained. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-27cam: capture: Cache the EventLoop handlerNiklas Söderlund
Prepare for the ability to exit the event loop based on conditions in the request complete handler by caching the pointer instead of passing it as an argument. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-12libcamera: Switch to FrameBuffer interfaceNiklas Söderlund
Switch to the FrameBuffer interface where all buffers are treated as external buffers and are allocated outside the camera. Applications allocating buffers using libcamera are switched to use the FrameBufferAllocator helper. Follow-up changes to this one will finalize the transition to the new FrameBuffer interface by removing code that is left unused after this change. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-20cam: Store camera as shared pointer everywhereNiklas Söderlund
Do not store the camera raw pointer in the capture class, this will prevent forwarding the shared pointer in the future. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-11-19libcamera: camera: Remove explicit stream to buffer map in requestCompleted ↵Niklas Söderlund
signal The stream to buffer map in the requestCompleted signal is taken directly from the request which is part of the same signal. Remove the map as it can be fetched directly from the request. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-09-14libcamera: Switch to the std::chrono APILaurent Pinchart
Replace the clock_gettime()-based API with durations expressed as integers with the std::chrono API. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-06-19cam: Move camera configuration preparation to CamAppNiklas Söderlund
Most of the camera configuration preparation that is done in the Capture module is not specific to capturing and could be useful for other modules. Extract the generic parts to CamApp and do basic preparation of the configuration before passing it to modules. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-05-25cam: capture: Break out capture to a new classNiklas Söderlund
Reduce the complexity of main.cpp by compartmentalising the capture logic into its own class. There is no functional change. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>