mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-06 15:55:48 +02:00
videosettings: restart the camera at the selected resolution
Change-Id: I6c7942bda27377c6b83946c855a43c1a09f900ff GitLab: #872
This commit is contained in:
parent
eabbf15681
commit
26cc5cecd5
4 changed files with 13 additions and 7 deletions
|
@ -27,13 +27,13 @@ VideoView {
|
||||||
|
|
||||||
crop: true
|
crop: true
|
||||||
|
|
||||||
function startWithId(id) {
|
function startWithId(id, force = false) {
|
||||||
if (id.length === 0) {
|
if (id.length === 0) {
|
||||||
VideoDevices.stopDevice(rendererId)
|
VideoDevices.stopDevice(rendererId)
|
||||||
rendererId = id
|
rendererId = id
|
||||||
} else {
|
} else {
|
||||||
if (rendererId !== id)
|
const forceRestart = rendererId === id
|
||||||
rendererId = VideoDevices.startDevice(id)
|
rendererId = VideoDevices.startDevice(id, forceRestart)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ ColumnLayout {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
previewWidget.startWithId(VideoDevices.getDefaultDevice())
|
previewWidget.startWithId(VideoDevices.getDefaultDevice(), force)
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
|
|
|
@ -236,14 +236,20 @@ VideoDevices::getDefaultDevice()
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
VideoDevices::startDevice(const QString& id)
|
VideoDevices::startDevice(const QString& id, bool force)
|
||||||
{
|
{
|
||||||
if (id.isEmpty())
|
if (id.isEmpty())
|
||||||
return {};
|
return {};
|
||||||
auto& avModel = lrcInstance_->avModel();
|
auto& avModel = lrcInstance_->avModel();
|
||||||
if (avModel.hasRenderer(id)) {
|
if (avModel.hasRenderer(id)) {
|
||||||
|
// If the device is already started AND we're NOT trying to
|
||||||
|
// force a format change, we can do nothing and return the
|
||||||
|
// renderer id.
|
||||||
|
if (!force) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
avModel.stopPreview(id);
|
||||||
|
}
|
||||||
deviceOpen_ = true;
|
deviceOpen_ = true;
|
||||||
return avModel.startPreview(id);
|
return avModel.startPreview(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void setDefaultDevice(int index);
|
Q_INVOKABLE void setDefaultDevice(int index);
|
||||||
Q_INVOKABLE const QString getDefaultDevice();
|
Q_INVOKABLE const QString getDefaultDevice();
|
||||||
Q_INVOKABLE QString startDevice(const QString& deviceId);
|
Q_INVOKABLE QString startDevice(const QString& deviceId, bool force = false);
|
||||||
Q_INVOKABLE void stopDevice(const QString& deviceId);
|
Q_INVOKABLE void stopDevice(const QString& deviceId);
|
||||||
Q_INVOKABLE void setDefaultDeviceRes(int index);
|
Q_INVOKABLE void setDefaultDeviceRes(int index);
|
||||||
Q_INVOKABLE void setDefaultDeviceFps(int index);
|
Q_INVOKABLE void setDefaultDeviceFps(int index);
|
||||||
|
|
Loading…
Add table
Reference in a new issue