summaryrefslogtreecommitdiff
path: root/include/libcamera/stream.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>
2020-09-30libcamera: stream: Rename StillCaptureRaw to RawNiklas Söderlund
With the buffer copy removed from all pipelines for raw capture rename StillCaptureRaw to Raw to better describe the role. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2020-07-10libcamera: StreamConfiguration: Add frameSize fieldPaul Elder
In addition to the stride field, we want the pipeline handler to be able to declare the frame size for the configuration. Add a frameSize field to StreamConfiguration for this purpose. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-06-06libcamera: Rename pixelformats.{cpp,h} to pixel_format.{cpp,h}Laurent Pinchart
The libcamera source files are named after class names, using snake_case. pixelformats.h and pixelformats.cpp don't comply with that rule. Fix them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-01libcamera: stream: Expose stride valueNiklas Söderlund
Expose the image stride which may be retrieved after a video device has been configured. It may only be retrieved at that point as the assignment of video devices takes place at this point. In the future video devices should be assigned at configuration validation time and the stride value retrieved at that point. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-27libcamera: stream: Add StillCaptureRaw roleNiklas Söderlund
Add a role for capturing high resolution, low frame rate, still images in RAW format. 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>
2020-03-18libcamera: PixelFormat: Mark all function arguments of type PixelFormat as ↵Niklas Söderlund
const reference PixelFormat was previously an alias for unsigned int but is now a class. Make all functions taking PixelFormat do so as a const reference. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-12libcamera: Remove dead code after switch to FrameBufferNiklas Söderlund
Delete all dead code after switching to the FrameBuffer interface. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-28libcamera: stream: Use the newly defined PixelFormatJacopo Mondi
Use the newly defined PixelFormat type to define the image format contained in the StreamFormats and StreamConfiguration classes. Update the classes documentation accordingly. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-07-14libcamera: stream: Map external buffers to indexesJacopo Mondi
Add and use an operation to assign to Buffer representing external memory locations an index at queueRequest() time. The index is used to identify the memory buffer to be queued to the video device once the buffer will be queued in a Request. In order to minimize relocations in the V4L2 backend, this method provides a best-effort caching mechanisms that attempts to reuse BufferMemory previously mapped to the buffer's dmabuf file descriptors, if any. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-07-14libcamera: buffer: Add dmabuf file descriptorsJacopo Mondi
In addition to referencing buffer memory by index, add support to referencing it using dmabuf file descriptors. This will be used to reference buffer memory allocated outside of libcamera and import it. The dmabuf file descriptors are stored in an array in the Buffer class, and a new Stream::createBuffer() overload is added to construct a buffer from dmabuf file descriptor. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-07-14libcamera: stream: Add Stream memory typeJacopo Mondi
Define the memory type a Stream uses and allow application to set it through the associated StreamConfiguration. A Stream can use either internal or external memory allocation methods, depending on where the data produced by the stream is actually saved. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-07-14libcamera: stream: Shorten access to the bufferPoolJacopo Mondi
All interactions with the Stream's buffers currently go through the BufferPool. In order to shorten accessing the buffers array, and eventually restrict access to the Stream's internal buffer pool, provide operations to access, create and destroy buffers. It is still possible to access the pool for pipeline handlers to populate it by exporting buffers from a video device to Stream's pool. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-07-14libcamera: buffer: Split memory information to BufferMemoryLaurent Pinchart
The Buffer class is a large beast the stores information about the buffer memory, dynamic metadata related to the frame stored in the buffer, and buffer reference data (in the index). In order to implement buffer import we will need to extend this with dmabuf file descriptors, making usage of the class even more complex. Refactor the Buffer class by splitting the buffer memory information to a BufferMemory class, and repurposing the Buffer class to reference a buffer and to store dynamic metadata. The BufferMemory class becomes a long term storage, valid and stable from the time buffer memory is allocated to the time it is freed. The Buffer class, on the other hand, becomes transient, is created on demand when an application requires a buffer, is given to a request, and is deleted when the request completes. Buffer and BufferMemory don't need to be copied, so their copy constructor and assignment operators are deleted. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-06-19libcamera: stream: StreamConfiguration: Add StreamFormats informationNiklas Söderlund
Allow StreamFormats to be associated to a StreamConfiguration. The intention is that pipeline handlers should associate formats to a StreamConfiguration when it's created in generateConfiguration(). 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>
2019-06-19libcamera: stream: Add StreamFormatsNiklas Söderlund
Add a StreamFormats class which describes all the formats supported by a stream. The object does not collect any information itself but can simplify user interactions with formats as it's able to translate a stream format range into a discrete list and a discrete list to a range. 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>
2019-05-23libcamera: Refactor the camera configuration storage and APILaurent Pinchart
Refactor the CameraConfiguration structure to not rely on Stream instances. This is a step towards making the camera configuration object more powerful with configuration validation using "try" semantics. The CameraConfiguration now exposes a simple vector-like API to access the contained stream configurations. Both operator[]() and at() are provided to access elements. The isEmpty() method is renamed to empty() and the methods reordered to match the std::vector class. As applications need access to the Stream instances associated with the configuration entries in order to associate buffers with streams when creating requests, expose the stream selected by the pipeline handler through a new StreamConfiguration::stream(). 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-05-23libcamera: Use stream roles directly instead of StreamUsageLaurent Pinchart
In order to prepare for an API overhall of the camera configuration generation, remove the StreamUsage class and replace its uses by stream roles. The size hints can't be specified anymore, and will be replaced with an API on the StreamConfiguration to negotiate configuration parameters with cameras. 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-30libcamera: Use the Size class through libcameraLaurent Pinchart
Several of our structures include width and height fields that model a size while we have a Size class for that purpose. Use the Size class through libcamera, and give it a toString() method like other geometry and format classes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-04-19libcamera: stream: Add and use toString() method to StreamConfigurationLaurent Pinchart
Add a toString() method to the StreamConfiguration class, and replace all manually coded implementations through the source code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-16libcamera: stream: Make Stream inheritableJacopo Mondi
In preparation for multiple streams support prepare to allow sub-classing the Stream class by removing the 'final' specifier from the class definition and make its private members protected. 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-04-05libcamera: stream: Add basic stream usagesNiklas Söderlund
In preparation of reworking how a default configuration is retrieved from a camera add stream usages. The usages will be used by applications to describe how they intend to use a camera and replace the Stream IDs when retrieving default configuration from the camera using streamConfiguration(). Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-04-02libcamera: stream: Qualify 'Camera' friend directiveJacopo Mondi
Align the Stream class to all other classes in the code base to use the 'class' qualifier in 'friend' declarations. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-02libcamera: stream: Remove 2 empty linesJacopo Mondi
Remove two empty lines. Cosmetic change only. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-02-06libcamera: stream: Add stream configuration to the stream objectNiklas Söderlund
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-06libcamera: stream: Construct a streamKieran Bingham
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-04libcamera: streams: extend stream configuration with buffer countNiklas Söderlund
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-01libcamera: stream: add initial StreamConfiguration structureNiklas Söderlund
Add an initial StreamConfiguration implementation to hold configuration data for a single stream of a Camera. In its current form not many configuration parameters are supported but it's expected the number of options will grow over time. At this stage the pixel format is represented as an unsigned int to allow for easy mapping to the V4L2 API. This might be subject to change in the future as we finalize how libcamera shall represent pixel formats. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-01libcamera: stream: add initial Stream classNiklas Söderlund
Add an initial Stream implementation. The idea is that once capability support is added to the library each stream will describe its capabilities using this class. An application will then select one or more streams based on these capabilities and use them to configure the camera and capture. At this stage the Stream class is empty as capabilities are yet to be added. The class is still useful as it will be used to communicate how many streams a Camera object provides. 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>