Commit 41519fef authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

make it work by implementing Qabstractvideosurface and converting each

frame to QImage
parent 66e89071
......@@ -79,6 +79,7 @@ include(GenerateExportHeader)
find_package(VTK REQUIRED)
find_package(Qt5 COMPONENTS Core Widgets OpenGL Xml Multimedia MultimediaWidgets WebSockets REQUIRED)
include_directories(${Qt5Multimedia_PRIVATE_INCLUDE_DIRS})
find_package(dtkCore 2.2.2 REQUIRED)
find_package(dtkFonts 2.0.0 REQUIRED)
......
......@@ -56,7 +56,7 @@ dtkVisualizationViewVideoPrivate::dtkVisualizationViewVideoPrivate(QWidget *pare
format.setVersion(1, 2);
format.setSamples(32);
QSurfaceFormat::setDefaultFormat(format);
this->setFormat(format);
}
void dtkVisualizationViewVideoPrivate::initializeGL(void)
......@@ -208,7 +208,7 @@ void dtkVisualizationViewVideo::setTitle(const QString& title)
void dtkVisualizationViewVideo::setImage(const QImage& image)
{
d->render_image = image.mirrored(true, false);
d->render_image = image;
d->recalculatePosition();
d->updateScene();
......
......@@ -81,6 +81,9 @@ dtkVisualizationViewVideoGLPrivate::dtkVisualizationViewVideoGLPrivate(QWidget *
vbo(QOpenGLBuffer::VertexBuffer),
ibo(QOpenGLBuffer::IndexBuffer)
{
QSurfaceFormat format;
this->setFormat(format);
}
......@@ -281,7 +284,7 @@ void dtkVisualizationViewVideoGL::setTitle(const QString& title)
void dtkVisualizationViewVideoGL::setImage(const QImage& image)
{
d->buffer = image.mirrored(true, true);
d->buffer = image.mirrored(false, true);
d->resizeGL(d->width(), d->height());
}
......
......@@ -3,6 +3,9 @@
#include <QtCore>
#include <QtWidgets>
#include "dtkVisualizationViewVideo.h"
#include "dtkVisualizationViewVideoGL.h"
#include "dtkVisualizationViewVideoRaster.h"
#include <dtkVisualizationExport>
#include <dtkWidgets/dtkWidgetsWidget>
......@@ -10,7 +13,9 @@
class dtkWidgetsHUD;
class dtkWidgetsOverlayPane;
class DTKVISUALIZATION_EXPORT dtkVisualizationViewVideoPlayer: public dtkWidgetsWidget
using ViewVideo = dtkVisualizationViewVideoGL;
class DTKVISUALIZATION_EXPORT dtkVisualizationViewVideoPlayer: public ViewVideo
{
Q_OBJECT
......@@ -18,15 +23,12 @@ public:
dtkVisualizationViewVideoPlayer(QWidget *parent = nullptr);
virtual ~dtkVisualizationViewVideoPlayer();
public:
QWidget *widget(void);
public slots:
void open(void);
public:
dtkWidgetsOverlayPane *overlay(void);
dtkWidgetsHUD *hud(void);
dtkWidgetsHUD *hud(void) ;
protected:
void dragEnterEvent(QDragEnterEvent *);
......@@ -34,7 +36,6 @@ protected:
void dragMoveEvent(QDragMoveEvent *);
void dropEvent(QDropEvent *);
void keyPressEvent(QKeyEvent *);
// void mousePressEvent(QMouseEvent *);
void resizeEvent(QResizeEvent *);
private:
......
......@@ -73,6 +73,14 @@ dtkVisualizationViewVideoRaster::dtkVisualizationViewVideoRaster(QWidget *parent
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(d);
QImage image(this->width(), this->height(), QImage::Format_RGBA8888);
image.fill(Qt::black);
d->setPixmap(QPixmap::fromImage(image));
QPalette p = palette();
p.setColor(QPalette::Window, Qt::black);
setPalette(p);
}
dtkVisualizationViewVideoRaster::~dtkVisualizationViewVideoRaster(void)
......@@ -97,7 +105,7 @@ void dtkVisualizationViewVideoRaster::setTitle(const QString& title)
void dtkVisualizationViewVideoRaster::setImage(const QImage& image)
{
d->setPixmap(QPixmap::fromImage(image.mirrored(true, false).scaled(this->width(), this->height(), Qt::KeepAspectRatio)));
d->setPixmap(QPixmap::fromImage(image.scaled(this->width(), this->height(), Qt::KeepAspectRatio)));
}
//
......
......@@ -62,7 +62,6 @@ dtkVisualizationWidgetsVideoControls::dtkVisualizationWidgetsVideoControls(QWidg
{
this->setAttribute(Qt::WA_NoSystemBackground);
this->setAttribute(Qt::WA_TranslucentBackground);
this->setAttribute(Qt::WA_TransparentForMouseEvents, true);
dtkFontAwesome::instance()->initFontAwesome();
dtkFontAwesome::instance()->setDefaultOption("color", QColor(Qt::gray));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment