summaryrefslogtreecommitdiff
path: root/src/cam/sdl_texture_yuyv.h
AgeCommit message (Collapse)Author
2022-05-23cam: sdl_sink: Add SDL sink with initial YUYV supportEric Curtin
This adds more portability to existing cam sinks. You can pass a YUYV camera buffer and SDL will handle the pixel buffer conversion to the display. This allows cam reference implementation to display images on VMs, Mac M1, Raspberry Pi, etc. This also enables cam reference implementation, to run as a desktop application in Wayland or X11. SDL also has support for Android and ChromeOS which has not been tested. Also tested on simpledrm Raspberry Pi 4 framebuffer successfully where existing kms sink did not work. Can also be used as kmsdrm sink. Only supports one camera stream at present. Signed-off-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
/span> * camera_session.h - Camera capture session */ #ifndef __CAM_CAMERA_SESSION_H__ #define __CAM_CAMERA_SESSION_H__ #include <memory> #include <stdint.h> #include <vector> #include <libcamera/base/signal.h> #include <libcamera/camera.h> #include <libcamera/framebuffer.h> #include <libcamera/framebuffer_allocator.h> #include <libcamera/request.h> #include <libcamera/stream.h> #include "buffer_writer.h" #include "options.h" class CameraSession { public: CameraSession(std::shared_ptr<libcamera::Camera> camera, libcamera::CameraConfiguration *config); int start(const OptionsParser::Options &options); void stop(); libcamera::Signal<> captureDone; private: int startCapture(); int queueRequest(libcamera::Request *request); void requestComplete(libcamera::Request *request); void processRequest(libcamera::Request *request); std::shared_ptr<libcamera::Camera> camera_; libcamera::CameraConfiguration *config_; std::map<const libcamera::Stream *, std::string> streamName_; std::unique_ptr<BufferWriter> writer_; uint64_t last_; unsigned int queueCount_; unsigned int captureCount_; unsigned int captureLimit_; bool printMetadata_; std::unique_ptr<libcamera::FrameBufferAllocator> allocator_; std::vector<std::unique_ptr<libcamera::Request>> requests_; }; #endif /* __CAM_CAMERA_SESSION_H__ */