Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QCamera Android Crash
Forum Updated to NodeBB v4.3 + New Features

QCamera Android Crash

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 2 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • metaDomM Offline
    metaDomM Offline
    metaDom
    wrote on last edited by
    #1

    @ QCameraViewfinder * viewFinder;
    QCamera * camera;
    QAbstractVideoSurface * surface;

    QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
    foreach (const QCameraInfo &cameraInfo, cameras) {
        if(cameraInfo.deviceName()=="front")
        {
            camera = new QCamera(cameraInfo);
            qDebug() << "found cam";
        }
    }
    
        viewFinder = new QCameraViewfinder;
        camera->setViewfinder(viewFinder);
        //ui->webBox->layout()->addWidget(viewFinder);
        viewFinder->show();
        camera->start();@
    

    It does not matter if I use the QCameraViewfinder or QAbstractVideoSurface, once the camera is started, the application crashes. Any ideas are welcome :)

    (void MainWindow::openScanner()): found cam
    Fatal signal 11 (SIGSEGV) at 0x00000005 (code=1), thread 15692

    1 Reply Last reply
    0
    • metaDomM Offline
      metaDomM Offline
      metaDom
      wrote on last edited by
      #2

      just tested, it crashes @ camera->setViewfinder(viewFinder);

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        So it's not when the camera starts, right ?

        Are you sure that camera is really valid at this time ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • metaDomM Offline
          metaDomM Offline
          metaDom
          wrote on last edited by
          #4

          It was a problem with the viewfinder/surface attached. Anyway now it crashes when the camera starts. I'm now trying to port the C++ version of the camera example to properly work on android, since I do not care about a live preview I'll try to re-render images as they come to the surface. If anyone already got a working example it would be much appreciated :)

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Just thought about something, IIRC you would need to use QML to have a preview on Android

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • metaDomM Offline
              metaDomM Offline
              metaDom
              wrote on last edited by
              #6

              using QML is not an option right now, this should be purely C++/Qt. Grabbing single images from the surface and displaying them in a Label should do the trick :)

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved