Camera fails is object is created dynamically



  • I'm trying to create Camera, VideoOutPut objects dynamically in QML, but getting error from gstreamer and not able to start camera preview.

    Code:

    function createPreviewObjects(parent, cameraId) {
        cam_component = Qt.createComponent("Camera.qml");
        camera = cam_component.createObject(cameraUI);
        if (camera == null) {
            // Error Handling
            console.log("Error creating video camera object");
            return;
        }
        camera.deviceId = cameraId;
        console.log("Camera component is created "+cameraId);
    
    
        preview_component = Qt.createComponent("Preview.qml");
        preview = preview_component.createObject(cameraUI);
        if (preview == null) {
            // Error Handling
            console.log("Error creating video preview object");
            return;
        }
    
        preview.width = parent.width;
        preview.height = parent.height;
        preview.x = 0;
        preview.y = 0;
        preview.source = camera;
        console.log("Preview component is created: "+camera);
    
    

    Logs:

    GstElement* CameraBinSession::buildCameraSource()
    GstElement* CameraBinSession::buildCameraSource()
    GstElement* CameraBinSession::buildCameraSource()
    set camera device "/dev/video1"
    GstElement* CameraBinSession::buildCameraSource()
    GstElement* CameraBinSession::buildCameraSource()
    GstElement* CameraBinSession::buildCameraSource()
    virtual void CameraBinControl::setState(QCamera::State) ActiveState
    void CamerabinResourcePolicy::setResourceSet(CamerabinResourcePolicy::ResourceSet) 2
    void CameraBinSession::setState(QCamera::State) QCamera::ActiveState
    GstElement* CameraBinSession::buildCameraSource()
    bool CameraBinSession::setupCameraBin() Viewfinder changed, reconfigure.
    Starting camera without viewfinder available
    GstElement* CameraBinSession::buildCameraSource()
    qml: Camera component is created /dev/video1
    CameraBinControl: reload pipeline requested ActiveState
    void CameraBinSession::setState(QCamera::State) QCamera::LoadedState
    CameraBinControl: reload pipeline requested ActiveState
    CameraBinControl: reload pipeline requested ActiveState
    qml: Preview component is created: QDeclarativeCamera(0x569ad0)
    process 2392: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/etc/machine-id": No such file or directory
    See the manual page for dbus-uuidgen to correct this issue.
    CameraBinControl: reload pipeline
    void CameraBinSession::setState(QCamera::State) QCamera::ActiveState
    GstElement* CameraBinSession::buildCameraSource()
    bool CameraBinSession::setupCameraBin() Viewfinder changed, reconfigure.

    (declarative-camera:2392): GStreamer-CRITICAL **: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (src)' failed

    (declarative-camera:2392): GStreamer-CRITICAL *: gst_object_unref: assertion 'object != NULL' failed
    CameraBin error: "GStreamer error: negotiation problem."

    install jpeg buffer probe
    install metadata probe
    install uncompressed buffer probe
    "Camera bin: state changed: old: GST_STATE_NULL new: GST_STATE_READY pending: GST_STATE_VOID_PENDING"
    "Camera bin: state changed: old: GST_STATE_READY new: GST_STATE_PAUSED pending: GST_STATE_PLAYING"
    CameraBin error: "Internal data flow error."
    CameraBin error: "Internal data flow error."


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.