diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-03-23 03:24:25 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-03-29 17:09:46 +0200 |
commit | 97e8b3a2eb321884fe1e15fb584f41a38cc33d51 (patch) | |
tree | 3ed93b2504e4fcdc3511bcf956f43ad84a558d0f /src/qcam/main_window.h | |
parent | ffef90a1c1f1990581d8fbc22193bfc766d23d3b (diff) |
qcam: Add Qt-based GUI application
qcam is a sample camera GUI application based on Qt. It demonstrates
integration of the Qt event loop with libcamera.
The application lets the user select a camera through the GUI, and then
captures a single stream from the camera and displays it in a window.
Only streams in YUYV formats are supported for now.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/qcam/main_window.h')
-rw-r--r-- | src/qcam/main_window.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h new file mode 100644 index 00000000..5e27a8fd --- /dev/null +++ b/src/qcam/main_window.h @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * main_window.h - qcam - Main application window + */ +#ifndef __QCAM_MAIN_WINDOW_H__ +#define __QCAM_MAIN_WINDOW_H__ + +#include <map> + +#include <QMainWindow> + +#include <libcamera/camera.h> +#include <libcamera/stream.h> + +#include "../cam/options.h" + +using namespace libcamera; + +class ViewFinder; + +enum { + OptCamera = 'c', + OptHelp = 'h', +}; + +class MainWindow : public QMainWindow +{ +public: + MainWindow(const OptionsParser::Options &options); + ~MainWindow(); + +private: + int openCamera(); + + int startCapture(); + int configureStreams(Camera *camera, std::set<Stream *> &streams); + void stopCapture(); + + void requestComplete(Request *request, + const std::map<Stream *, Buffer *> &buffers); + int display(Buffer *buffer); + + const OptionsParser::Options &options_; + + std::shared_ptr<Camera> camera_; + bool isCapturing_; + std::map<Stream *, StreamConfiguration> config_; + + ViewFinder *viewfinder_; +}; + +#endif /* __QCAM_MAIN_WINDOW__ */ |