Using deep stream in custom application

Thanks so much, @mdegans,
Q1- How I can add Deepstream GST to path to show me any plugins of gstreamer?

Q2- Is it possible to don’t use of this for uridecodebin? I want to know there are necessary id for uridecodebin element or optional?

uri_decode_bin.connect("pad-added",cb_newpad,nbin)
uri_decode_bin.connect("child-added",decodebin_child_added,nbin) 

Q3- Is it possible to have another than args in cb_newpad and decodebin_child_added functions? In this sample code, these sunction have these args cb_newpad(decodebin, decoder_src_pad,data) and decodebin_child_added(child_proxy,Object,name,user_data), I want to know these args are predined fo this function or we can pass other args to these function? If so, How there args are passed via uri_decode_bin.connect to these functions?

Q4- For last suggestion please show me with snippet code in this link, thanks.

Q5- All of elements can to have get_request_pad property?

Deepstream plugins should already be in the gstreamer plugin path.

The normal way to link withuridecodebin is with callbacks like this, however if you create a bin using gst_parse_bin_from_description (and friends) and the supplied string contains uridecodebin, it will link for you automatically as it would with gst-launch, but you’ll have less control.

The last argument can be anything you want. It’s a void* in C. In Python you can put anything there (I believe even multiple additional arguments). In Vala or Python, if the callback is a method, this or self respectively is implicitly passed, so that’s often easier than manually supplying a third argument.

Line 160 is (probably) the callback to link you’re looking for.

No, when you run gst-inspect-1.0, it will tell you whether an element has sometimes, request, or always (static) pads. You use get_static_pad with always pads, get_request_pad with request pads, and connect to pad-added to link with sometimes pads.

1 Like

@mdegans, Hi,
Q1- Some plugins of nvidia like tracker/streammux , … that are used in deepstream sdk, and these are located in the :

/usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream

I want to know these plugins are installed when we install gstreamer packages or installed when we install deepstream sdk? I want to know these plugins are registered publicly in gstreamer or these are comes with install deepstream sdk?

Q2- Suppose I want to write a custom gstreamer plugin in python like blue the image and I one solution is that convert the buffer to numpy array image and then some processing on, like this:

def do_transform_ip(self, buffer: Gst.Buffer) -> Gst.FlowReturn:
        try:
            # convert Gst.Buffer to np.ndarray
            image = gst_buffer_with_caps_to_ndarray(buffer, self.sinkpad.get_current_caps())

            # apply gaussian blur to image
            image[:] = gaussian_blur(image, self.kernel_size, sigma=(self.sigma_x, self.sigma_y))
        except Exception as e:
            logging.error(e)

        return Gst.FlowReturn.OK

I want to know, Is there a way to have not convert to numpy array and do processing on buffer data directly, I want to know converting data from buffer to numpy has overhead? If buffer located in the NVVM buffer, I have to do cuda programming codes for processing the signal?

Q3- In the above example, we know the buffer is image and I convert to numpy array with function, I want to know If we do inference deep models or trackers in deep stream. How they handle the signals? The image and bounding boxes of objects located in the buffer or each of buffers are separated when data flows in pipeline?

Q4-

It’s possible to have two (or more) static , pads, that exist always, two or more request pads, that you create on demand, or two or more sometimes pads, that the element creates (and you handle with an event handler function).

For sometimes pads that are created by self-element, and these are dynamic pads, I want to know in the pipeline these pads, Is it possible to open and close the port several times during the streaming process? My mean is that when the sometimes pad is created, then this pad is always exist? or in the vary times this pad is created and removed? only one time this pad created?

Q5-

GStreamer handles multithreading automatically,
In the multi-threading of python due to GIL issue, the multi task not perform really as parallel , but in the c/c++ the multi-threading perform parallel, right?
I want to know gstreamer python api, also has GIL problem?