Skip to main content
ALT Linux Bugzilla
– Attachment 22771 Details for
Bug 60885
Недоступна камера в opentoonz
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Исправление выбора Linux-устройства камеры, повторного выбора и резервного разрешения
opentoonz-1.8.0-camera-device.patch (text/plain), 2.61 KB, created by
Anton Farygin
on 2026-10-21 10:45:45 MSK
(
hide
)
Description:
Исправление выбора Linux-устройства камеры, повторного выбора и резервного разрешения
Filename:
MIME Type:
Creator:
Anton Farygin
Created:
2026-10-21 10:45:45 MSK
Size:
2.61 KB
patch
obsolete
>diff --git a/toonz/sources/toonz/penciltestpopup.cpp b/toonz/sources/toonz/penciltestpopup.cpp >index bccd294e..5a88ede3 100644 >--- a/toonz/sources/toonz/penciltestpopup.cpp >+++ b/toonz/sources/toonz/penciltestpopup.cpp >@@ -2235,7 +2235,13 @@ void PencilTestPopup::refreshCameraList() { > > void PencilTestPopup::onCameraListComboActivated(int comboIndex) { > QList<QCameraInfo> cameras = QCameraInfo::availableCameras(); >- if (cameras.size() != m_cameraListCombo->count() - 1) return; >+ if (cameras.size() != m_cameraListCombo->count() - 1 || comboIndex < 0 || >+ comboIndex > cameras.size()) >+ return; >+ // Reselecting the current camera must not stop its capture timer. >+ if (comboIndex > 0 && >+ cameras.at(comboIndex - 1).deviceName() == m_deviceName) >+ return; > > m_cvWebcam.release(); > if (m_timer->isActive()) m_timer->stop(); >@@ -2251,9 +2257,6 @@ void PencilTestPopup::onCameraListComboActivated(int comboIndex) { > } > > int index = comboIndex - 1; >- // In case the camera is not changed (just click the combobox) >- if (cameras.at(index).deviceName() == m_deviceName) return; >- > m_currentCamera = new QCamera(cameras.at(index), this); > m_deviceName = cameras.at(index).deviceName(); > >@@ -2263,6 +2266,7 @@ void PencilTestPopup::onCameraListComboActivated(int comboIndex) { > // Refresh resolution > m_resolutionCombo->clear(); > QList<QSize> sizes = m_currentCamera->supportedViewfinderResolutions(); >+ bool resolutionsDetected = !sizes.isEmpty(); > // Simple workaround because Qt fails to auto-detect the camera resolutions > // https://forum.qt.io/topic/68904/how-to-get-the-supported-resolution-of-a-qcamera/5 > if (sizes.size() == 0) { >@@ -2288,8 +2292,10 @@ void PencilTestPopup::onCameraListComboActivated(int comboIndex) { > QString("%1 x %2").arg(size.width()).arg(size.height()), size); > } > if (!sizes.isEmpty()) { >- // Select the largest available resolution >- m_resolutionCombo->setCurrentIndex(m_resolutionCombo->count() - 1); >+ // Do not default to an unverified 4K mode when Qt cannot query the camera. >+ m_resolutionCombo->setCurrentIndex( >+ resolutionsDetected ? m_resolutionCombo->count() - 1 >+ : m_resolutionCombo->findData(QSize(640, 480))); > } > > m_videoWidget->setImage(QImage()); >@@ -2598,6 +2604,9 @@ void PencilTestPopup::getWebcamImage() { > } else { > m_cvWebcam.open(camIndex, cv::CAP_DSHOW); > } >+#elif defined(__linux__) >+ // Qt's camera ordinal need not match the /dev/videoN device number. >+ m_cvWebcam.open(m_deviceName.toStdString(), cv::CAP_V4L2); > #else > m_cvWebcam.open(translateIndex(camIndex)); > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 60885
:
22372
|
22752
| 22771