diff --git a/linphone-desktop/assets/languages/en.ts b/linphone-desktop/assets/languages/en.ts
index 0a3621a06..6fff54350 100644
--- a/linphone-desktop/assets/languages/en.ts
+++ b/linphone-desktop/assets/languages/en.ts
@@ -1133,6 +1133,13 @@ Server url not configured.
VIDEO PREVIEW
+
+ SettingsVideoPreview
+
+ confirm
+ OK
+
+
SettingsWindow
diff --git a/linphone-desktop/assets/languages/fr.ts b/linphone-desktop/assets/languages/fr.ts
index 0eaad1a52..9ad1a7a34 100644
--- a/linphone-desktop/assets/languages/fr.ts
+++ b/linphone-desktop/assets/languages/fr.ts
@@ -1133,6 +1133,13 @@ Url du serveur non configurée.
APERÇU DE LA VIDÉO
+
+ SettingsVideoPreview
+
+ confirm
+ VALIDER
+
+
SettingsWindow
diff --git a/linphone-desktop/resources.qrc b/linphone-desktop/resources.qrc
index 20600004a..972fc80da 100644
--- a/linphone-desktop/resources.qrc
+++ b/linphone-desktop/resources.qrc
@@ -308,8 +308,8 @@
ui/modules/Linphone/Styles/Blocks/CardBlockStyle.qml
ui/modules/Linphone/Styles/Blocks/RequestBlockStyle.qml
ui/modules/Linphone/Styles/Calls/CallControlsStyle.qml
- ui/modules/Linphone/Styles/Calls/CallStatisticsStyle.qml
ui/modules/Linphone/Styles/Calls/CallsStyle.qml
+ ui/modules/Linphone/Styles/Calls/CallStatisticsStyle.qml
ui/modules/Linphone/Styles/Chat/ChatStyle.qml
ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.qml
ui/modules/Linphone/Styles/Contact/AvatarStyle.qml
@@ -375,6 +375,8 @@
ui/views/App/Settings/SettingsSipAccounts.js
ui/views/App/Settings/SettingsSipAccounts.qml
ui/views/App/Settings/SettingsUi.qml
+ ui/views/App/Settings/SettingsVideo.js
+ ui/views/App/Settings/SettingsVideoPreview.qml
ui/views/App/Settings/SettingsVideo.qml
ui/views/App/Settings/SettingsWindow.qml
ui/views/App/SplashScreen/SplashScreen.qml
@@ -397,6 +399,7 @@
ui/views/App/Styles/Main/ManageAccountsStyle.qml
ui/views/App/Styles/qmldir
ui/views/App/Styles/Settings/SettingsSipAccountsEditStyle.qml
+ ui/views/App/Styles/Settings/SettingsVideoPreviewStyle.qml
ui/views/App/Styles/Settings/SettingsWindowStyle.qml
ui/views/App/Styles/SplashScreen/SplashScreenStyle.qml
diff --git a/linphone-desktop/src/app/App.cpp b/linphone-desktop/src/app/App.cpp
index d0432ea15..a1cacc723 100644
--- a/linphone-desktop/src/app/App.cpp
+++ b/linphone-desktop/src/app/App.cpp
@@ -278,7 +278,7 @@ void App::registerTypes () {
qmlRegisterType("Linphone", 1, 0, "AssistantModel");
qmlRegisterType("Linphone", 1, 0, "Authentication");
qmlRegisterType("Linphone", 1, 0, "Camera");
- qmlRegisterType("Linphone", 1, 0, "CameraPreview");
+ qmlRegisterType("Linphone", 1, 0, "CameraPreview");
qmlRegisterType("Linphone", 1, 0, "ChatModel");
qmlRegisterType("Linphone", 1, 0, "ChatProxyModel");
qmlRegisterType("Linphone", 1, 0, "ContactsListProxyModel");
diff --git a/linphone-desktop/src/components/camera/Camera.cpp b/linphone-desktop/src/components/camera/Camera.cpp
index f75058d24..47b7aff5d 100644
--- a/linphone-desktop/src/components/camera/Camera.cpp
+++ b/linphone-desktop/src/components/camera/Camera.cpp
@@ -123,7 +123,11 @@ void CameraRenderer::synchronize (QQuickFramebufferObject *item) {
Camera *camera = qobject_cast(item);
- mLinphoneCall = camera->getCall()->getLinphoneCall();
+ {
+ CallModel *model = camera->getCall();
+ mLinphoneCall = model ? model->getLinphoneCall() : nullptr;
+ }
+
mIsPreview = camera->mIsPreview;
updateWindowId();
diff --git a/linphone-desktop/src/components/camera/CameraPreview.cpp b/linphone-desktop/src/components/camera/CameraPreview.cpp
index 4bc43b519..253e87188 100644
--- a/linphone-desktop/src/components/camera/CameraPreview.cpp
+++ b/linphone-desktop/src/components/camera/CameraPreview.cpp
@@ -126,7 +126,17 @@ void CameraPreviewRenderer::updateWindowId () {
// -----------------------------------------------------------------------------
+QMutex CameraPreview::mCounterMutex;
+int CameraPreview::mCounter = 0;
+
+// -----------------------------------------------------------------------------
+
CameraPreview::CameraPreview (QQuickItem *parent) : QQuickFramebufferObject(parent) {
+ mCounterMutex.lock();
+ if (++mCounter == 1)
+ CoreManager::getInstance()->getCore()->enableVideoPreview(true);
+ mCounterMutex.unlock();
+
// The fbo content must be y-mirrored because the ms rendering is y-inverted.
setMirrorVertically(true);
@@ -142,6 +152,13 @@ CameraPreview::CameraPreview (QQuickItem *parent) : QQuickFramebufferObject(pare
mRefreshTimer->start();
}
+CameraPreview::~CameraPreview () {
+ mCounterMutex.lock();
+ if (--mCounter == 0)
+ CoreManager::getInstance()->getCore()->enableVideoPreview(false);
+ mCounterMutex.unlock();
+}
+
QQuickFramebufferObject::Renderer *CameraPreview::createRenderer () const {
return new CameraPreviewRenderer();
}
diff --git a/linphone-desktop/src/components/camera/CameraPreview.hpp b/linphone-desktop/src/components/camera/CameraPreview.hpp
index 1b9d9ccc6..478873d91 100644
--- a/linphone-desktop/src/components/camera/CameraPreview.hpp
+++ b/linphone-desktop/src/components/camera/CameraPreview.hpp
@@ -23,6 +23,7 @@
#ifndef CAMERA_PREVIEW_H_
#define CAMERA_PREVIEW_H_
+#include
#include
#include
@@ -61,12 +62,15 @@ class CameraPreview : public QQuickFramebufferObject {
public:
CameraPreview (QQuickItem *parent = Q_NULLPTR);
- ~CameraPreview () = default;
+ ~CameraPreview ();
QQuickFramebufferObject::Renderer *createRenderer () const override;
private:
QTimer *mRefreshTimer;
+
+ static QMutex mCounterMutex;
+ static int mCounter;
};
#endif // CAMERA_PREVIEW_H_
diff --git a/linphone-desktop/src/components/core/CoreManager.cpp b/linphone-desktop/src/components/core/CoreManager.cpp
index 2211492c3..269e2ef31 100644
--- a/linphone-desktop/src/components/core/CoreManager.cpp
+++ b/linphone-desktop/src/components/core/CoreManager.cpp
@@ -25,7 +25,6 @@
#include "CoreManager.hpp"
-#include
#include
#include
#include
diff --git a/linphone-desktop/ui/views/App/Settings/SettingsVideo.js b/linphone-desktop/ui/views/App/Settings/SettingsVideo.js
new file mode 100644
index 000000000..219000130
--- /dev/null
+++ b/linphone-desktop/ui/views/App/Settings/SettingsVideo.js
@@ -0,0 +1,7 @@
+// =============================================================================
+// `SettingsVideo.qml` Logic.
+// =============================================================================
+
+function showVideoPreview (account) {
+ window.attachVirtualWindow(Qt.resolvedUrl('SettingsVideoPreview.qml'))
+}
diff --git a/linphone-desktop/ui/views/App/Settings/SettingsVideo.qml b/linphone-desktop/ui/views/App/Settings/SettingsVideo.qml
index 58a484c74..26e2238e7 100644
--- a/linphone-desktop/ui/views/App/Settings/SettingsVideo.qml
+++ b/linphone-desktop/ui/views/App/Settings/SettingsVideo.qml
@@ -6,6 +6,8 @@ import Utils 1.0
import App.Styles 1.0
+import 'SettingsVideo.js' as Logic
+
// =============================================================================
TabContainer {
@@ -109,7 +111,7 @@ TabContainer {
anchors.right: parent.right
text: qsTr('showCameraPreview')
- onClicked: console.log('TODO')
+ onClicked: Logic.showVideoPreview()
}
// -------------------------------------------------------------------------
diff --git a/linphone-desktop/ui/views/App/Settings/SettingsVideoPreview.qml b/linphone-desktop/ui/views/App/Settings/SettingsVideoPreview.qml
new file mode 100644
index 000000000..ec53d64f8
--- /dev/null
+++ b/linphone-desktop/ui/views/App/Settings/SettingsVideoPreview.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.7
+
+import Common 1.0
+import Linphone 1.0
+
+import App.Styles 1.0
+
+// =============================================================================
+
+DialogPlus {
+ id: dialog
+
+ buttons: [
+ TextButtonB {
+ text: qsTr('confirm')
+
+ onClicked: exit(1)
+ }
+ ]
+
+ centeredButtons: true
+ height: SettingsVideoPreviewStyle.height
+ width: SettingsVideoPreviewStyle.width
+
+ // ---------------------------------------------------------------------------
+
+ CameraPreview {
+ anchors {
+ fill: parent
+ leftMargin: SettingsVideoPreviewStyle.preview.leftMargin
+ rightMargin: SettingsVideoPreviewStyle.preview.rightMargin
+ }
+ }
+}
diff --git a/linphone-desktop/ui/views/App/Styles/Settings/SettingsVideoPreviewStyle.qml b/linphone-desktop/ui/views/App/Styles/Settings/SettingsVideoPreviewStyle.qml
new file mode 100644
index 000000000..e324738cc
--- /dev/null
+++ b/linphone-desktop/ui/views/App/Styles/Settings/SettingsVideoPreviewStyle.qml
@@ -0,0 +1,14 @@
+pragma Singleton
+import QtQuick 2.7
+
+// =============================================================================
+
+QtObject {
+ property int height: 480
+ property int width: 640
+
+ property QtObject preview: QtObject {
+ property int leftMargin: 25
+ property int rightMargin: 25
+ }
+}
diff --git a/linphone-desktop/ui/views/App/Styles/qmldir b/linphone-desktop/ui/views/App/Styles/qmldir
index 26dcac3f3..c031135ea 100644
--- a/linphone-desktop/ui/views/App/Styles/qmldir
+++ b/linphone-desktop/ui/views/App/Styles/qmldir
@@ -24,6 +24,8 @@ singleton MainWindowMenuBarStyle 1.0 Main/MainWindowMenuBarSty
singleton MainWindowStyle 1.0 Main/MainWindowStyle.qml
singleton ManageAccountsStyle 1.0 Main/ManageAccountsStyle.qml
-singleton SettingsWindowStyle 1.0 Settings/SettingsWindowStyle.qml
singleton SettingsSipAccountsEditStyle 1.0 Settings/SettingsSipAccountsEditStyle.qml
+singleton SettingsVideoPreviewStyle 1.0 Settings/SettingsVideoPreviewStyle.qml
+singleton SettingsWindowStyle 1.0 Settings/SettingsWindowStyle.qml
+
singleton SplashScreenStyle 1.0 SplashScreen/SplashScreenStyle.qml
diff --git a/submodules/linphone b/submodules/linphone
index fba1e7ccb..740eac982 160000
--- a/submodules/linphone
+++ b/submodules/linphone
@@ -1 +1 @@
-Subproject commit fba1e7ccb12cd83865b736d873bcd8ac28e73920
+Subproject commit 740eac982a2f15c93d30499a8972a8c9d5144f4f
diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2
index dc46e818f..ecc40cd8c 160000
--- a/submodules/mediastreamer2
+++ b/submodules/mediastreamer2
@@ -1 +1 @@
-Subproject commit dc46e818fe9b621eca3c132dfebbed39f2f232e3
+Subproject commit ecc40cd8c874b833cc6ec1a05b59769d7c7c891d