Access denied finding property "vendor.camera.aux.packagelist"
-
@jsulm, hello again.
Thankfully to your suggestion I've been able to get somewhere!
Here's what I have now
main.cpp
int main(int argc, char *argv[]) { QApplication a(argc, argv); checkPermission(); checkPermission1(); QWidget widget; QPushButton btn; btn.setMinimumSize(QSize(200, 200)); btn.setText("Take a picutre"); QVBoxLayout layout; layout.addWidget(&btn); widget.setLayout(&layout); QCamera *camera = new QCamera; QMediaCaptureSession m_captureSession; QImageCapture *m_imageCapture; camera = new QCamera(QCameraDevice::FrontFace); m_captureSession.setCamera(camera); m_imageCapture = new QImageCapture; m_captureSession.setImageCapture(m_imageCapture); camera->start(); QObject::connect(&btn, &QPushButton::clicked, [m_imageCapture, camera]() { qDebug() << camera->isActive() << " " << m_imageCapture->isReadyForCapture(); int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg"); }); widget.show(); return a.exec(); }
The interesting part in this code is the qDebug outout for camera->isActive() and m_imageCapture->isReadyForCapture()!
camera->isActive() is true, but m_imageCature->isReadyForCapture() is false.
However, I have no idea why ?
Could someone take a look ? Why is m_imageCapture->isReadyForCapture() false ? How can I fix it?
@Ivelin Connect a slot to https://doc.qt.io/qt-6/qimagecapture.html#readyForCaptureChanged - is it called?
You can also check https://doc.qt.io/qt-5/qcamera.html#captureMode-prop -
@Ivelin Connect a slot to https://doc.qt.io/qt-6/qimagecapture.html#readyForCaptureChanged - is it called?
You can also check https://doc.qt.io/qt-5/qcamera.html#captureMode-prop@jsulm, no it is not being called. Seems like a bug?
QMediaCaptureSession m_captureSession; QImageCapture *m_imageCapture = new QImageCapture; camera = new QCamera(QCameraDevice::FrontFace); m_captureSession.setCamera(camera); m_captureSession.setImageCapture(m_imageCapture); camera->start(); if (!m_imageCapture->isReadyForCapture()) { qDebug() << "Camera is not ready for capture"; } QObject::connect(&btn, &QPushButton::clicked, [m_imageCapture, camera]() { qDebug() << camera->isActive() << " " << m_imageCapture->isReadyForCapture(); int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg"); }); QObject::connect(m_imageCapture, &QImageCapture::readyForCaptureChanged, []() { qDebug() << "READYYYYYYYYYYYYYYYYYY"; });
There is no "READYYYYYYYYYYYYYYYYYY" in my logs. I have tried both on Xiaomi and Samsung.
-
@jsulm, no it is not being called. Seems like a bug?
QMediaCaptureSession m_captureSession; QImageCapture *m_imageCapture = new QImageCapture; camera = new QCamera(QCameraDevice::FrontFace); m_captureSession.setCamera(camera); m_captureSession.setImageCapture(m_imageCapture); camera->start(); if (!m_imageCapture->isReadyForCapture()) { qDebug() << "Camera is not ready for capture"; } QObject::connect(&btn, &QPushButton::clicked, [m_imageCapture, camera]() { qDebug() << camera->isActive() << " " << m_imageCapture->isReadyForCapture(); int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg"); }); QObject::connect(m_imageCapture, &QImageCapture::readyForCaptureChanged, []() { qDebug() << "READYYYYYYYYYYYYYYYYYY"; });
There is no "READYYYYYYYYYYYYYYYYYY" in my logs. I have tried both on Xiaomi and Samsung.
-
@jsulm, I am using Qt 6.2.4.
I try to stick to something older, so there is lower chance for bugs, unfortunately this doesn't seem to be the case, so I will try the latest one.
@Ivelin said in Access denied finding property "vendor.camera.aux.packagelist":
I try to stick to something older, so there is lower chance for bugs
Bugs get fixed in newer versions (of course new bugs are also introduced :-)).
-
@Ivelin said in Access denied finding property "vendor.camera.aux.packagelist":
I try to stick to something older, so there is lower chance for bugs
Bugs get fixed in newer versions (of course new bugs are also introduced :-)).
@jsulm, hello
Late update. It is not the version I am pretty sure.
The Qt 6.2 example for camera works just fine, so it must be something from my code.
Yes, I am still banging my head, so I can fix that problem. it is been a week now I am getting pretty desperate
The problem must be in the code.
Could someone please help me ? Any Ideas ?
-
@jsulm, I am using Qt 6.2.4.
I try to stick to something older, so there is lower chance for bugs, unfortunately this doesn't seem to be the case, so I will try the latest one.
-
@JoeCFD, I am going to try With Qt 6.6 ( latest current ), but again the qt camera example for qt 6.2 worked just fine, so I suppose it should be a problem in the code.
-
@Ivelin put or zip your whole test code somewhere for other people to be able to access for testing.
@JoeCFD, I will, but I just think that I have found something !
This is my current code:
int main(int argc, char *argv[]) { QApplication a(argc, argv); checkPermission(); checkPermission1(); QWidget widget; QPushButton btn; btn.setMinimumSize(QSize(200, 200)); btn.setText("Take a picutre"); QVBoxLayout layout; layout.addWidget(&btn); widget.setLayout(&layout); QCamera *camera = new QCamera; QMediaCaptureSession m_captureSession; QImageCapture *m_imageCapture; camera = new QCamera(QCameraDevice::FrontFace); m_captureSession.setCamera(camera); m_imageCapture = new QImageCapture; m_captureSession.setImageCapture(m_imageCapture); QObject::connect(camera, &QCamera::errorOccurred, [&camera]() { if (camera->error() != QCamera::NoError) qDebug() << "ERROR: " << camera->errorString(); }); QObject::connect(m_imageCapture, &QImageCapture::errorOccurred, [](int id, const QImageCapture::Error error, const QString &errorString) { qDebug() << "ERROR: " << errorString; }); camera->start(); QObject::connect(&btn, &QPushButton::clicked, [m_imageCapture, camera]() { qDebug() << camera->isActive() << " " << m_imageCapture->isReadyForCapture(); int id = m_imageCapture->captureToFile("/storage/emulated/0/Download/f.jpeg"); }); widget.show(); return a.exec(); }
After having those QObject:connect for rrorOccured when clicking the button, so I can take a picture I get:
ERROR: "Could not capture in stopped state"
Maybe this is a valid lead ?
Could someone take a look?