[libcamera-devel,v5,0/7] libcamera: Map multiple V4L2 formats to a single libcamera::format
mbox series

Message ID 20220803103849.26144-1-jacopo@jmondi.org
Headers show
Series
  • libcamera: Map multiple V4L2 formats to a single libcamera::format
Related show

Message

Jacopo Mondi Aug. 3, 2022, 10:38 a.m. UTC
This series addresses the requirement of mapping multiple V4L2 pixel formats
to a single libcamera format. Specifically, it allows to map V4L2_PIX_FMT_JPEG
and V4L2_PIX_FMT_MJPEG to libcamera::formats::MJPEG.

When testing on Pinephone I was able to capture JPEG (but not to inspect images)
and YUYV. This time the sensor didn't fail me, and I was able to run a preview
stream on the pinephone using the SDL backend.

v4->v5:
- Use std::hash<V4L2PixelFormat> specialization
- Address Laurent's comment on 5/6
- Add a tiny patch for the developer guide

v3->v4:
- Move 2/6 at the beginning and simplify it
- Biggest change is in V4L2VideoDevice where formats are now collected in an
  unordered_set<> requiring V4L2PixelFormat to be instrumented with an Hash
  function object to allow it to be stored in an unordered STL container
- Minor changes in comments/wording and Laurent's tags

v2->v3:
- Resorted patches as suggested by Laurent
- Remove 'multiplanar' argument in the call chain
- Cache the V4L2VideoDevice formats at open() time

v1->v2:
- Add a missing conversion using the video device in Simple converter
- Map formats::MJPEG to V4L2_PIX_FMT_JPEG in v4l2 formats enumeration

Jacopo Mondi (7):
  libcamera: formats: Reimplement V4L2 PixelFormatInfo::info()
  libcamera: formats: Merge V4L2 single and multi formats
  guides: pipeline handler: Remove rogue spaces
  libcamera: v4l2_videodevice: Reintroduce toV4L2PixelFormat()
  libcamera: v4l2_pixelformat: Return the list of V4L2 formats
  libcamera: v4l2_videodevice: Match formats supported by the device
  libcamera: formats: Map V4L2_PIX_FMT_JPEG to formats::MJPEG

 Documentation/guides/pipeline-handler.rst     |   9 +-
 include/libcamera/internal/formats.h          |   5 +-
 include/libcamera/internal/v4l2_pixelformat.h |  18 +-
 include/libcamera/internal/v4l2_videodevice.h |   6 +
 src/libcamera/formats.cpp                     | 318 ++++--------------
 src/libcamera/pipeline/ipu3/cio2.cpp          |   2 +-
 src/libcamera/pipeline/ipu3/imgu.cpp          |   2 +-
 .../pipeline/raspberrypi/raspberrypi.cpp      |  34 +-
 src/libcamera/pipeline/rkisp1/rkisp1_path.cpp |   6 +-
 src/libcamera/pipeline/simple/converter.cpp   |  10 +-
 src/libcamera/pipeline/simple/simple.cpp      |   4 +-
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |   6 +-
 src/libcamera/pipeline/vimc/vimc.cpp          |   8 +-
 src/libcamera/v4l2_pixelformat.cpp            |  24 +-
 src/libcamera/v4l2_videodevice.cpp            |  61 +++-
 src/v4l2/v4l2_camera_proxy.cpp                |   6 +-
 test/libtest/buffer_source.cpp                |   2 +-
 17 files changed, 211 insertions(+), 310 deletions(-)

--
2.37.1