diff --git a/src/app/MainApplication.cpp b/src/app/MainApplication.cpp index 864b178..9444169 100644 --- a/src/app/MainApplication.cpp +++ b/src/app/MainApplication.cpp @@ -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); diff --git a/src/app/MainApplication.h b/src/app/MainApplication.h index b3e5777..6741ab0 100644 --- a/src/app/MainApplication.h +++ b/src/app/MainApplication.h @@ -27,6 +27,7 @@ #include #include "MM.h" #include +#include namespace mmp { diff --git a/src/core/CameraImpl.cpp b/src/core/CameraImpl.cpp index b242920..93dc6ac 100644 --- a/src/core/CameraImpl.cpp +++ b/src/core/CameraImpl.cpp @@ -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(); diff --git a/src/core/CameraImpl.h b/src/core/CameraImpl.h index 5740a6f..b6bca55 100644 --- a/src/core/CameraImpl.h +++ b/src/core/CameraImpl.h @@ -34,7 +34,7 @@ public: CameraImpl(); ~CameraImpl(); - bool loadMovie(const QString& path); + bool loadMovie(const QString& deviceName); bool isLive() { return true; } int getWidth() const; diff --git a/src/core/CameraSurface.cpp b/src/core/CameraSurface.cpp index 3ff03e6..f62d6f2 100644 --- a/src/core/CameraSurface.cpp +++ b/src/core/CameraSurface.cpp @@ -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; } diff --git a/src/core/Paint.cpp b/src/core/Paint.cpp index 7793f45..b3f99bb 100644 --- a/src/core/Paint.cpp +++ b/src/core/Paint.cpp @@ -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() diff --git a/src/gui/AboutDialog.h b/src/gui/AboutDialog.h index a893bf4..f777eda 100644 --- a/src/gui/AboutDialog.h +++ b/src/gui/AboutDialog.h @@ -36,7 +36,7 @@ class AboutDialog : public QDialog { Q_OBJECT public: - AboutDialog(QWidget *parent = 0); + AboutDialog(QWidget *parent = nullptr); ~AboutDialog() {} public slots: diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index a2cd881..31d40f4 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -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: " << diff --git a/src/src.pri b/src/src.pri index 68cce29..f24032c 100644 --- a/src/src.pri +++ b/src/src.pri @@ -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