diff options
author | Umang Jain <umang.jain@ideasonboard.com> | 2024-06-24 19:18:59 +0530 |
---|---|---|
committer | Umang Jain <umang.jain@ideasonboard.com> | 2024-07-03 10:36:55 +0530 |
commit | cc3a3c46a5ae4353b7bc9fe740521cef1008c998 (patch) | |
tree | 840d06571649ea1c5d22da72a6b6cbf14c71258a /include | |
parent | 7f85673e13a034908e773a6bf421ca880ef0ab4a (diff) |
libcamera: converter: Replace usage of stream index by Stream pointer
The converter interface uses the unsigned int output stream index to map
to the output frame buffers. This is cumbersome to implement new
converters because one has to keep around additional book keeping
to track the streams with their correct indexes.
The v4l2_converter_m2m and simple pipeline handler are adapted to
use the new interface. This work roped in software ISP as well,
which also seems to use indexes (although it doesn't implement converter
interface) because of a common conversionQueue_ queue used for
converter_ and swIsp_.
The logPrefix is no longer able to generate an index from a stream, and
is updated to be more expressive by reporting the stream configuration
instead, for example, reporting "1920x1080-MJPEG" in place of
"stream0".
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Andrei Konovalov <andrey.konovalov.ynk@gmail.com> # sm8250 RB5
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/internal/converter.h | 5 | ||||
-rw-r--r-- | include/libcamera/internal/converter/converter_v4l2_m2m.h | 11 | ||||
-rw-r--r-- | include/libcamera/internal/software_isp/software_isp.h | 5 |
3 files changed, 12 insertions, 9 deletions
diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h index 5d74db6b..b51563d7 100644 --- a/include/libcamera/internal/converter.h +++ b/include/libcamera/internal/converter.h @@ -26,6 +26,7 @@ namespace libcamera { class FrameBuffer; class MediaDevice; class PixelFormat; +class Stream; struct StreamConfiguration; class Converter @@ -46,14 +47,14 @@ public: virtual int configure(const StreamConfiguration &inputCfg, const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs) = 0; - virtual int exportBuffers(unsigned int output, unsigned int count, + virtual int exportBuffers(const Stream *stream, unsigned int count, std::vector<std::unique_ptr<FrameBuffer>> *buffers) = 0; virtual int start() = 0; virtual void stop() = 0; virtual int queueBuffers(FrameBuffer *input, - const std::map<unsigned int, FrameBuffer *> &outputs) = 0; + const std::map<const Stream *, FrameBuffer *> &outputs) = 0; Signal<FrameBuffer *> inputBufferReady; Signal<FrameBuffer *> outputBufferReady; diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h index 0da62290..b9e59899 100644 --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h @@ -28,6 +28,7 @@ class FrameBuffer; class MediaDevice; class Size; class SizeRange; +class Stream; struct StreamConfiguration; class V4L2M2MDevice; @@ -47,20 +48,20 @@ public: int configure(const StreamConfiguration &inputCfg, const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfg); - int exportBuffers(unsigned int output, unsigned int count, + int exportBuffers(const Stream *stream, unsigned int count, std::vector<std::unique_ptr<FrameBuffer>> *buffers); int start(); void stop(); int queueBuffers(FrameBuffer *input, - const std::map<unsigned int, FrameBuffer *> &outputs); + const std::map<const Stream *, FrameBuffer *> &outputs); private: class V4L2M2MStream : protected Loggable { public: - V4L2M2MStream(V4L2M2MConverter *converter, unsigned int index); + V4L2M2MStream(V4L2M2MConverter *converter, const Stream *stream); bool isValid() const { return m2m_ != nullptr; } @@ -82,7 +83,7 @@ private: void outputBufferReady(FrameBuffer *buffer); V4L2M2MConverter *converter_; - unsigned int index_; + const Stream *stream_; std::unique_ptr<V4L2M2MDevice> m2m_; unsigned int inputBufferCount_; @@ -91,7 +92,7 @@ private: std::unique_ptr<V4L2M2MDevice> m2m_; - std::vector<V4L2M2MStream> streams_; + std::map<const Stream *, std::unique_ptr<V4L2M2MStream>> streams_; std::map<FrameBuffer *, unsigned int> queue_; }; diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h index c5338c05..f8e00003 100644 --- a/include/libcamera/internal/software_isp/software_isp.h +++ b/include/libcamera/internal/software_isp/software_isp.h @@ -37,6 +37,7 @@ namespace libcamera { class DebayerCpu; class FrameBuffer; class PixelFormat; +class Stream; struct StreamConfiguration; LOG_DECLARE_CATEGORY(SoftwareIsp) @@ -62,7 +63,7 @@ public: const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs, const ControlInfoMap &sensorControls); - int exportBuffers(unsigned int output, unsigned int count, + int exportBuffers(const Stream *stream, unsigned int count, std::vector<std::unique_ptr<FrameBuffer>> *buffers); void processStats(const ControlList &sensorControls); @@ -71,7 +72,7 @@ public: void stop(); int queueBuffers(FrameBuffer *input, - const std::map<unsigned int, FrameBuffer *> &outputs); + const std::map<const Stream *, FrameBuffer *> &outputs); void process(FrameBuffer *input, FrameBuffer *output); |