basler / gst-plugin-pylon

The official GStreamer plug-in for Basler cameras
BSD 3-Clause "New" or "Revised" License
42 stars 10 forks source link

Delete pipeline and create a new one in C #91

Open rbnrtg opened 9 months ago

rbnrtg commented 9 months ago

Hi @thiesmoeller

My camera is Basler daA3840-45uc (USB Model).

In my code, I create the pipeline correctly using GStreamer with the pylonsrc source, but I have implemented that when a parameter is modified in a txt, the pipeline is closed and a new one is created with the modified parameters and with the same pylonsrc source of the camera.

But when I release the necessary resources and try to start the second pipeline:

    if (pipeline != NULL) {

            gst_element_set_state(pipeline, GST_STATE_NULL);

           gst_bin_remove(GST_BIN(pipeline), src);

           gst_object_unref (blockpad);

           gst_object_unref (GST_OBJECT(pipeline));

           pipeline = NULL;
    }
    gst_bin_add_many(GST_BIN(pipeline), src, filter, conv, q1, encoder, filter_h264, sink, NULL);

   gst_element_link_many(src, filter, conv, q1, encoder, filter_h264, sink, NULL);

   if (gst_element_set_state (pipeline,
           GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
           g_error ("Error starting pipeline");
   }

When trying to change the pipeline status to PLAYING, the following error appears in basler logs:

gstpylonsrc.cpp:820:gst_pylon_src_start:ESC[00m error: Failed to start camera.

gstpylonsrc.cpp:820:gst_pylon_src_start:ESC[00m error: TLFactory not instanciated, you must call PylonInitialize()

GST_ERROR_SYSTEM gstelement.c:2271:gst_element_message_full_with_details:ESC[00m posting message: Failed to start camera.

What could I do to solve this problem?

Thank you!