NDEVR
API Documentation
VulkanPhysicalCameraView.h
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: VulkanPhysicalCameraView
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
36#include <NDEVR/PhysicalCameraView.h>
37#include <NDEVR/Camera.h>
38#include <NDEVR/Pointer.h>
39#include <NDEVR/File.h>
40#include <qglobal.h>
41struct _GstAppSink;
42struct _GstElement;
43namespace NDEVR
44{
45 class VulkanGraphicsWindow;
46 class QCustomComboBox;
47 class Button;
52 class VULKAN_VIDEO_STREAMER_API VulkanPhysicalCameraView : public PhysicalCameraView
53 {
54 Q_OBJECT
55 public:
57 VulkanPhysicalCameraView();
62 VulkanPhysicalCameraView(const DynamicPointer<Camera>& camera, DesignObjectLookup* lookup, QWidget* parent = nullptr);
63 virtual ~VulkanPhysicalCameraView();
64 virtual bool setCameraSource(const StringView& connection_id) override;
65 virtual void refreshInstance() override;
67 void setToDefaultCamera();
68 virtual void setCameraZoom(fltp08 zoom) override;
70 void stop();
73 VulkanVideoRenderer* videoWidget();
76 virtual void setRemoteSource(const StringView& remote);
77 bool event(QEvent* event) override;
81 bool handleRemoteSink(_GstAppSink* sink);
83 void updateRenderLocation();
84 protected slots:
85 void processCapturedImage(int index, const QImage& img);
86 void handleCameraError(int camera_error);
87 void handleScreenshotError(int id, int error, const QString& errorString);
88 void handleVideoError();
89 void updateCameraState(bool state);
90 void updateRecorderState(int state);
91 void updateRecorderTimespan();
92 protected:
93 static void OnEnd(_GstAppSink* sink, void* user);
94 void init() override;
95 void updateCameraSourceCombo();
96 bool startRecord(const File& file) override;
97 bool finishRecord(File file) override;
98 virtual bool pauseRecord(bool paused, const File& file) override;
99 virtual bool takeImage(const File& file) override;
100 virtual void invertScreenColors(bool invert) override;
101 protected:
102 Vector<2, uint04> m_source_size = Constant<Vector<2, uint04>>::Invalid;
103 VulkanGraphicsWindow* m_window = nullptr;
104 DesignObjectLookup* m_lookup = nullptr;
105 _GstElement* m_pipeline = nullptr;
106 File m_screenshot_location;
107 VulkanVideoRenderer* m_video_widget = nullptr;
108 QCustomComboBox* m_selection_combo;
109 bool m_is_running = false;
110 };
115 {
116 public:
122 virtual PhysicalCameraView* createView(const DynamicPointer<Camera>& camera, DesignObjectLookup* model_manager, QWidget* parent) override;
128 virtual bool canCreateView(const DynamicPointer<Camera>& camera, DesignObjectLookup* model_manager, bool ignore_active) override;
132 };
133}
134#endif
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A core widget that allows the user to click one of many button types.
Definition Button.h:68
A core class where all Design Objects including models, materials, and geometries are stored.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
Factory for creating PhysicalCameraView instances and querying supported output formats.
A Viewport that represents a physical camera stream, or real world camera view.
A compact way to present a list of options to the user.
Provides access to a local camera on the system, such as a webcam or camera for a phone.
virtual bool canCreateView(const DynamicPointer< Camera > &camera, DesignObjectLookup *model_manager, bool ignore_active) override
Checks whether this factory can create a view for the given camera.
virtual PhysicalCameraView * createView(const DynamicPointer< Camera > &camera, DesignObjectLookup *model_manager, QWidget *parent) override
Creates a VulkanPhysicalCameraView for the given camera.
virtual Buffer< DynamicPointer< Camera > > availableCameraStreams() const override
Returns all camera streams available for Vulkan-based rendering.
A Model subclass that renders a video stream from a GStreamer source into the 3D scene.
The primary namespace for the NDEVR SDK.