mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Merge feature/camera-support into develop
This commit is contained in:
@@ -27,10 +27,11 @@ MainApplication::MainApplication(int &argc, char *argv[])
|
||||
: QApplication(argc, argv)
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
// Set GStreamer plugins path on Windows
|
||||
QString pluginPath = QCoreApplication::applicationDirPath() + "/plugins";
|
||||
// Set GStreamer plugins path on Windows
|
||||
QString pluginPath = QCoreApplication::applicationDirPath() + "/plugin";
|
||||
|
||||
_putenv_s("GST_PLUGIN_PATH", pluginPath.toLocal8Bit());
|
||||
if (QDir(pluginPath).exists())
|
||||
_putenv_s("GST_PLUGIN_PATH", pluginPath.toLocal8Bit());
|
||||
|
||||
// Set settings default format
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <QDebug>
|
||||
#include "MM.h"
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
|
||||
namespace mmp {
|
||||
|
||||
|
||||
@@ -35,11 +35,11 @@ CameraImpl::~CameraImpl()
|
||||
delete _cameraSurface;
|
||||
}
|
||||
|
||||
bool CameraImpl::loadMovie(const QString &path)
|
||||
bool CameraImpl::loadMovie(const QString &deviceName)
|
||||
{
|
||||
VideoImpl::loadMovie(path);
|
||||
VideoImpl::loadMovie(deviceName);
|
||||
|
||||
_camera = new QCamera(path.toLocal8Bit());
|
||||
_camera = new QCamera(deviceName.toLocal8Bit());
|
||||
|
||||
_cameraSurface = new CameraSurface();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
CameraImpl();
|
||||
~CameraImpl();
|
||||
|
||||
bool loadMovie(const QString& path);
|
||||
bool loadMovie(const QString& deviceName);
|
||||
bool isLive() { return true; }
|
||||
|
||||
int getWidth() const;
|
||||
|
||||
@@ -92,10 +92,14 @@ bool CameraSurface::present(const QVideoFrame &frame)
|
||||
currentFrame.unmap();
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
_temporaryImage = QGLWidget::convertToGLFormat(_temporaryImage);
|
||||
#else
|
||||
// Convert to OpenGLformat and apply transforms to straighten.
|
||||
_temporaryImage = QGLWidget::convertToGLFormat(_temporaryImage)
|
||||
.mirrored(true, false)
|
||||
.transformed(QTransform().rotate(180));
|
||||
.mirrored(true, false)
|
||||
.transformed(QTransform().rotate(180));
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+11
-6
@@ -198,6 +198,7 @@ Video::Video(int id) : Texture(id),
|
||||
Video::Video(const QString uri_, VideoType type, double rate, uid id):
|
||||
Texture(id),
|
||||
_uri(""),
|
||||
_videoType(type),
|
||||
_impl(nullptr)
|
||||
{
|
||||
switch (type) {
|
||||
@@ -303,11 +304,11 @@ bool Video::hasVideoSupport()
|
||||
bool Video::setUri(const QString &uri)
|
||||
{
|
||||
QSettings settings;
|
||||
bool sameMediasource = settings.value("oscSameMediaSource").toBool();
|
||||
bool sameMediaSourceOSC = settings.value("oscSameMediaSource").toBool();
|
||||
// Check if we're actually changing the uri.
|
||||
// In some case with OSC message the user may need to allow
|
||||
// the same media source (uri)
|
||||
if (sameMediasource || uri != _uri)
|
||||
if (sameMediaSourceOSC || uri != _uri)
|
||||
{
|
||||
// Try to load movie.
|
||||
if (!_impl->loadMovie(uri))
|
||||
@@ -327,14 +328,18 @@ bool Video::setUri(const QString &uri)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_generateThumbnail())
|
||||
qDebug() << "Could not generate thumbnail for " << uri << ": using generic icon." << endl;
|
||||
if (_videoType != VIDEO_WEBCAM) { // Generated thumbnail if source type is not camera
|
||||
if (!_generateThumbnail())
|
||||
qDebug() << "Could not generate thumbnail for " << uri << ": using generic icon." << endl;
|
||||
}
|
||||
|
||||
_emitPropertyChanged("uri");
|
||||
|
||||
// Return success.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return success.
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Video::_doPlay()
|
||||
|
||||
@@ -36,7 +36,7 @@ class AboutDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AboutDialog(QWidget *parent = 0);
|
||||
AboutDialog(QWidget *parent = nullptr);
|
||||
~AboutDialog() {}
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -34,7 +34,7 @@ MainWindow::MainWindow()
|
||||
{
|
||||
// Create model.
|
||||
#if QT_VERSION >= 0x050500
|
||||
QMessageLogger(__FILE__, __LINE__, 0).info() << "Video support: " <<
|
||||
QMessageLogger(__FILE__, __LINE__, nullptr).info() << "Video support: " <<
|
||||
(Video::hasVideoSupport() ? "yes" : "no");
|
||||
#else
|
||||
QMessageLogger(__FILE__, __LINE__, 0).debug() << "Video support: " <<
|
||||
|
||||
@@ -76,6 +76,8 @@ win32 {
|
||||
$${GST_HOME}/lib/gstreamer-1.0.lib \
|
||||
$${GST_HOME}/lib/gobject-2.0.lib \
|
||||
$${GST_HOME}/lib/glib-2.0.lib \
|
||||
$${GST_HOME}/lib/gstaudio-1.0.lib \
|
||||
$${GST_HOME}/lib/gstvideo-1.0.lib \
|
||||
-lopengl32
|
||||
|
||||
CONFIG -= debug
|
||||
|
||||
Reference in New Issue
Block a user