API Documentation
Loading...
Searching...
No Matches
QTMediaCameraView.h
Go to the documentation of this file.
1#pragma once
2#if NDEVR_SUPPORTS_QMEDIA_PLAYER
3#include <NDEVR/PhysicalCameraView.h>
4#include <QMediaPlayer>
5#include <QVideoWidget>
6#include <QVideoEncoderSettings>
7namespace NDEVR
8{
9 class QTMediaCameraView : public PhysicalCameraView
10 {
11 QTMediaCameraView(DynamicPointer<Camera>& camera, QWidget* parent)
12 : PhysicalCameraView(camera, parent)
13 , m_media_player(nullptr)
14 , m_video_widget(nullptr)
15 {
16 m_media_player = new QMediaPlayer(this, QMediaPlayer::StreamPlayback);
17 m_video_widget = new QVideoWidget();
18 connect(m_media_player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(vlcError()));
19 uint04 insert_location = ui->stacked_widget->indexOf(ui->view_panel);
20 ui->stacked_widget->insertWidget(insert_location, m_video_widget);
21 ui->stacked_widget->removeWidget(ui->view_panel);
22 m_media_player->setVideoOutput(m_video_widget);
23 String connection_id = m_camera->getProperty<String>(DesignObject::e_file);
24 if (connection_id.size() > 0)
25 setCameraSource(connection_id);
26 }
27 bool setCameraSource(const String& connection_id) override
28 {
29 m_media_player->setMedia(QUrl(connection_id.c_str()));
30 //m_media_player->setMuted(true);
31 m_media_player->play();
32 displayCamera();
33 return true;
34 }
35 void handleError() override
36 {
37 if (m_media_player)
38 {
39 String error(m_media_player->errorString());
40 if (error.size() > 0)
41 {
42 QTErrorDialog::CreateErrorDialog(Exception("Video Error", error));
43 }
44 }
45 }
46 QMediaPlayer* m_media_player;
47 QVideoWidget* m_video_widget;
48 };
49}
50#endif
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:115