Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT6 Using QVideoSink with QCamera to process every frame



  • I`m digging example qt6 6.2.2 camera.pro and found next line code:

    m_captureSession.setVideoOutput(ui->viewfinder);
    

    this is the way of outing frames to ui.

    I know what QVideoSinc is used for grab every frame and process it.

    I have replaced this line with

    m_captureSession.setVideoSink(&videoSink);
    

    where videoSinc defined as my class :

    class MyVideoSinc : public QVideoSink
    {
        Q_OBJECT
    public:
        bool videoframeReady=false;
        MyVideoSinc()
        {
            connect(this, &QVideoSink::videoFrameChanged, this, &MyVideoSinc::hvideoFrameChanged);
        }
    public Q_SLOTS:
    
        void hvideoFrameChanged(const QVideoFrame &frame)
        {
            videoframeReady=true;
        }
    };
    

    hvideoFrameChanged raised for every frame in Windows build, but only once in Android application.

    What is wrong here. How to grab and process frames from QCamera in QT6 ? I don`t want show frames with ui->viewfinder. I need processing frames myself.