API Documentation
Loading...
Searching...
No Matches
LocalPhysicalCameraView.h
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Widgets
28File: PhysicalCameraView
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#define NDEVR_SUPPORTS_LOCAL_CAMERA 1
35#if NDEVR_SUPPORTS_LOCAL_CAMERA
39#include "Base/Headers/File.h"
40#include <qglobal.h>
41class QAudioInput;
42class QImageCapture;
43class QCamera;
44class QCameraDevice;
45class QVideoWidget;
46class QMediaDevices;
47class QMediaRecorder;
48class QMediaCaptureSession;
49class QCameraInfo;
50class QCameraImageCapture;
51class QVideoEncoderSettings;
52class QAudioEncoderSettings;
53class QImage;
54namespace NDEVR
55{
56#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
57 class QCustomComboBox;
58 class Button;
59 class LOCAL_CAMERA_STREAM_API LocalPhysicalCameraView : public PhysicalCameraView
60 {
61 Q_OBJECT
62 public:
64 LocalPhysicalCameraView(const DynamicPointer<Camera>& camera, QWidget* parent = nullptr);
65 virtual bool setCameraSource(const String& connection_id) override;
66 virtual bool setCameraSource(const QCameraDevice& connection_id);
67 virtual void refreshInstance() override;
70 protected slots:
71 void processCapturedImage(int index, const QImage& img);
72 void handleCameraError(int camera_error);
73 void handleScreenshotError(int id, int error, const QString& errorString);
75 void updateCameraState(bool state);
76 void updateRecorderState(int state);
78 protected:
79 void init();
81 bool startRecord(const File& file) override;
82 bool finishRecord(File file) override;
83 virtual bool pauseRecord(bool paused, const File& file) override;
84 virtual bool takeImage(const File& file) override;
85 virtual void invertScreenColors(bool invert) override;
86 protected:
88 QMediaDevices* m_devices = nullptr;
89 QMediaCaptureSession* m_capture_session = nullptr;
90 QCamera* m_camera = nullptr;
91 QAudioInput* m_audio_input = nullptr;
92 QImageCapture* m_image_capture = nullptr;
93 QVideoWidget* m_video_widget = nullptr;
94 QMediaRecorder* m_media_recorder = nullptr;
97 };
98 class LocalPhysicalCameraViewFactory : public PhysicalCameraViewFactory
99 {
100 public:
101 virtual PhysicalCameraView* createView(const DynamicPointer<Camera>& camera, DesignObjectLookup* model_manager, bool auto_add_models, QWidget* parent) override;
102 virtual bool canCreateView(const DynamicPointer<Camera>& camera, DesignObjectLookup* model_manager) override;
104 };
105#else
106 class NDEVR_WIDGETS_API LocalPhysicalCameraView : public PhysicalCameraView
107 {
108 Q_OBJECT
109 public:
111 LocalPhysicalCameraView(DynamicPointer<Camera>& camera, QWidget* parent = nullptr);
112 virtual bool setCameraSource(const String& connection_id) override;
113 virtual bool setCameraSource(const QCameraInfo& connection_id);
114 virtual void refreshInstance() override;
115 void setToDefaultCamera();
116 QAudioEncoderSettings audioSettings() const;
117 QVideoEncoderSettings videoSettings() const;
118 virtual ~LocalPhysicalCameraView();
119 protected slots:
120 void processCapturedImage(int index, const QImage& img);
121 void handleCameraError(int camera_error);
122 protected:
123 bool startRecord(const File& file) override;
124 bool finishRecord(const File& file) override;
125 virtual bool takeImage(const File& file) override;
126 virtual void invertScreenColors(bool invert) override;
127 void updateCameraState(int state);
128 protected:
129 File m_screenshot_location;
130 QCamera* m_camera;
131 QCameraImageCapture* imageCapture;
132 QMediaRecorder* mediaRecorder;
133 QVideoWidget* m_video_widget;
134 };
135#endif
136}
137#endif
#define LOCAL_CAMERA_STREAM_API
Definition DLLInfo.h:73
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:81
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition Button.h:60
Definition DesignObjectLookup.h:61
Definition Pointer.hpp:303
Definition File.h:47
Definition LocalPhysicalCameraView.h:99
virtual PhysicalCameraView * createView(const DynamicPointer< Camera > &camera, DesignObjectLookup *model_manager, bool auto_add_models, QWidget *parent) override
virtual Buffer< DynamicPointer< Camera > > availableCameraStreams() const override
virtual bool canCreateView(const DynamicPointer< Camera > &camera, DesignObjectLookup *model_manager) override
Definition LocalPhysicalCameraView.h:60
virtual bool takeImage(const File &file) override
virtual void refreshInstance() override
bool finishRecord(File file) override
LocalPhysicalCameraView(const DynamicPointer< Camera > &camera, QWidget *parent=nullptr)
Button * m_camera_flash_button
Definition LocalPhysicalCameraView.h:96
void handleScreenshotError(int id, int error, const QString &errorString)
virtual bool pauseRecord(bool paused, const File &file) override
virtual void invertScreenColors(bool invert) override
QCustomComboBox * m_selection_combo
Definition LocalPhysicalCameraView.h:95
void updateRecorderState(int state)
void updateCameraState(bool state)
File m_screenshot_location
Definition LocalPhysicalCameraView.h:87
virtual bool setCameraSource(const QCameraDevice &connection_id)
void processCapturedImage(int index, const QImage &img)
bool startRecord(const File &file) override
virtual bool setCameraSource(const String &connection_id) override
void handleCameraError(int camera_error)
Definition QCustomCombobox.h:47
Definition String.h:40
Definition ACIColor.h:37