[libcamera-devel,v4,0/8] libcamera: stream: Add basic stream usages
mbox series

Message ID 20190408134817.15247-1-niklas.soderlund@ragnatech.se
Headers show
Series
  • libcamera: stream: Add basic stream usages
Related show

Message

Niklas Söderlund April 8, 2019, 1:48 p.m. UTC
Hi,

This series changes how the default configuration is retrieved from a
camera. It replaces the current method where applications have to
enumerate a cameras streams and pick a set of them to ask for a default
configuration and then try to tune them to its use-case.

Instead the application asks libcamera for a set of stream usages to fit
its use-case and receives in returns a set of streams with a default
configuration (which it then can try and fine tune).

The goal of this series is to define the API towards the application and
not to implement smart choices in the pipeline handlers to actually
select streams. The main reason for this limitation in scope are that
all upstream pipeline handlers only support one stream so the new API is
not really useful for pipeline handlers yet.

The code is tested with a modified cam tool (patches posted in a
different series) together with out of tree IPU3 patches to extend it to
expose more then one stream per camera. So the API is proven to work
with multiple streams and can support capturing multiple streams in the
same request.

* Changes since v1
- Renamed StreamRole to StreamUsage
- Made geometry.h public header and use Size.
- Added CameraConfiguration object to handle mapping of stream usages to
  stream configurations.
- Added more documentation, thanks all patient reviewers!

- Changes since v2
- Extend CameraConfiguratio with .valid(), ability use operator[](Stream
  *) in a const context and add operator[](unsinged int) to fetch stream
  pointers based on insertion index.
- Fixed up a lot of documentation.
- Added geometry.h to meason.build.
- Camera::configureStreams() and PipelineHandler::configureStreams()
  take a const CameraConfiguration.
- Dropped #include <libcamera/stream.h> from camera.h.

- Changes since v3
- Add const Stream *CameraConfiguration::front() const.
- Rename empty() and valid() to isEmpty() and isValid().
- Improved the documentation.

Niklas Söderlund (8):
  cam: Rework how streams configuration is prepared
  test: camera: Remove streams argument from configurationValid()
  test: camera: Remove test for bad Stream IDs
  libcamera: Make geometry.h a public header
  libcamera: stream: Add basic stream usages
  libcamera: camera: Add support for stream usages
  libcamera: camera: Add CameraConfiguration
  libcamera: Switch to CameraConfiguration

 include/libcamera/camera.h                    |  36 ++-
 .../include => include/libcamera}/geometry.h  |   0
 include/libcamera/meson.build                 |   1 +
 include/libcamera/stream.h                    |  40 +++
 src/cam/main.cpp                              |  34 +--
 src/libcamera/camera.cpp                      | 243 +++++++++++++++---
 src/libcamera/geometry.cpp                    |   2 +-
 src/libcamera/include/formats.h               |   2 +-
 src/libcamera/include/pipeline_handler.h      |   8 +-
 src/libcamera/include/v4l2_subdevice.h        |   3 +-
 src/libcamera/pipeline/ipu3/ipu3.cpp          |  14 +-
 src/libcamera/pipeline/uvcvideo.cpp           |  18 +-
 src/libcamera/pipeline/vimc.cpp               |  18 +-
 src/libcamera/pipeline_handler.cpp            |  16 +-
 src/libcamera/stream.cpp                      |  92 +++++++
 src/libcamera/v4l2_subdevice.cpp              |   3 +-
 src/qcam/main_window.cpp                      |   5 +-
 src/qcam/main_window.h                        |   2 +-
 test/camera/camera_test.cpp                   |  27 --
 test/camera/camera_test.h                     |   3 -
 test/camera/capture.cpp                       |  11 +-
 test/camera/configuration_default.cpp         |  40 +--
 test/camera/configuration_set.cpp             |   9 +-
 test/camera/statemachine.cpp                  |   6 +-
 test/v4l2_subdevice/list_formats.cpp          |   3 +-
 25 files changed, 462 insertions(+), 174 deletions(-)
 rename {src/libcamera/include => include/libcamera}/geometry.h (100%)

Comments

Niklas Söderlund April 9, 2019, 3:50 p.m. UTC | #1
Hi,

With Laurents comment fixed pushed to master.

On 2019-04-08 15:48:09 +0200, Niklas Söderlund wrote:
> Hi,
> 
> This series changes how the default configuration is retrieved from a
> camera. It replaces the current method where applications have to
> enumerate a cameras streams and pick a set of them to ask for a default
> configuration and then try to tune them to its use-case.
> 
> Instead the application asks libcamera for a set of stream usages to fit
> its use-case and receives in returns a set of streams with a default
> configuration (which it then can try and fine tune).
> 
> The goal of this series is to define the API towards the application and
> not to implement smart choices in the pipeline handlers to actually
> select streams. The main reason for this limitation in scope are that
> all upstream pipeline handlers only support one stream so the new API is
> not really useful for pipeline handlers yet.
> 
> The code is tested with a modified cam tool (patches posted in a
> different series) together with out of tree IPU3 patches to extend it to
> expose more then one stream per camera. So the API is proven to work
> with multiple streams and can support capturing multiple streams in the
> same request.
> 
> * Changes since v1
> - Renamed StreamRole to StreamUsage
> - Made geometry.h public header and use Size.
> - Added CameraConfiguration object to handle mapping of stream usages to
>   stream configurations.
> - Added more documentation, thanks all patient reviewers!
> 
> - Changes since v2
> - Extend CameraConfiguratio with .valid(), ability use operator[](Stream
>   *) in a const context and add operator[](unsinged int) to fetch stream
>   pointers based on insertion index.
> - Fixed up a lot of documentation.
> - Added geometry.h to meason.build.
> - Camera::configureStreams() and PipelineHandler::configureStreams()
>   take a const CameraConfiguration.
> - Dropped #include <libcamera/stream.h> from camera.h.
> 
> - Changes since v3
> - Add const Stream *CameraConfiguration::front() const.
> - Rename empty() and valid() to isEmpty() and isValid().
> - Improved the documentation.
> 
> Niklas Söderlund (8):
>   cam: Rework how streams configuration is prepared
>   test: camera: Remove streams argument from configurationValid()
>   test: camera: Remove test for bad Stream IDs
>   libcamera: Make geometry.h a public header
>   libcamera: stream: Add basic stream usages
>   libcamera: camera: Add support for stream usages
>   libcamera: camera: Add CameraConfiguration
>   libcamera: Switch to CameraConfiguration
> 
>  include/libcamera/camera.h                    |  36 ++-
>  .../include => include/libcamera}/geometry.h  |   0
>  include/libcamera/meson.build                 |   1 +
>  include/libcamera/stream.h                    |  40 +++
>  src/cam/main.cpp                              |  34 +--
>  src/libcamera/camera.cpp                      | 243 +++++++++++++++---
>  src/libcamera/geometry.cpp                    |   2 +-
>  src/libcamera/include/formats.h               |   2 +-
>  src/libcamera/include/pipeline_handler.h      |   8 +-
>  src/libcamera/include/v4l2_subdevice.h        |   3 +-
>  src/libcamera/pipeline/ipu3/ipu3.cpp          |  14 +-
>  src/libcamera/pipeline/uvcvideo.cpp           |  18 +-
>  src/libcamera/pipeline/vimc.cpp               |  18 +-
>  src/libcamera/pipeline_handler.cpp            |  16 +-
>  src/libcamera/stream.cpp                      |  92 +++++++
>  src/libcamera/v4l2_subdevice.cpp              |   3 +-
>  src/qcam/main_window.cpp                      |   5 +-
>  src/qcam/main_window.h                        |   2 +-
>  test/camera/camera_test.cpp                   |  27 --
>  test/camera/camera_test.h                     |   3 -
>  test/camera/capture.cpp                       |  11 +-
>  test/camera/configuration_default.cpp         |  40 +--
>  test/camera/configuration_set.cpp             |   9 +-
>  test/camera/statemachine.cpp                  |   6 +-
>  test/v4l2_subdevice/list_formats.cpp          |   3 +-
>  25 files changed, 462 insertions(+), 174 deletions(-)
>  rename {src/libcamera/include => include/libcamera}/geometry.h (100%)
> 
> -- 
> 2.21.0
>