Undetstanding the src/sink caps behaviour in case of setting them manually as compared to using `gst-launch`

vk_gst venkateshkuppan26 at gmail.com
Fri Aug 17 14:44:30 UTC 2018


Hello GStreamer Experts and Developers,

With respect to my  previous
<http://gstreamer-devel.966125.n4.nabble.com/GStreamer-Dynamic-pipelines-Issue-with-adding-a-new-element-in-the-pipeline-td4688129.html>  
question, below is the pipeline I am trying to build : 

v4l2src -> h264parse -> avdec_h264 -> identity -> imagefreeze -> glupload ->
glcolorconvert
-> gltransformation -> glimagesink 

The above pipeline built using the tool `gst-launch`, works perfectly fine. 

Now I want to add and delete element `imagefreeze` based on certain events.
For this, I unlink and link the  source and sink pads manually to add and
delete based on the events.  Here is a snippet : 

        upload_sinkpad = upload.get_static_pad("sink")
        if idsrcpad.is_linked():
            print("id_src pad is linked, begin unlinking now")
            idsrcpad.unlink(upload_sinkpad)
            
        #get new src and sink pad of imagefreeze
        ifreeze_sinkpad = ifreeze.get_static_pad("sink")
        ifreeze_srcpad = ifreeze.get_static_pad("src")
        
        # link identity src pad to image freeze sinkpad
        idsrcpad = videoconvert.get_static_pad("src")
        if idsrcpad.can_link(ifreeze_sinkpad):
            idsrcpad.link(ifreeze_sinkpad)
            print("identity srcpad linked to imagefreeze sinkpad")
        else :
            print("cannot link identity src pad to image freeze sink pad")
        
        # link imagefreeze src pad to upload sink pad
        if ifreeze_srcpad.can_link(upload_sinkpad):
            ifreeze_srcpad.link(upload_sinkpad)
            print("imagefreeze srcpad linked to upload sinkpad")
        else:
            print("cannot link imagefreeeze srcpad to upload sink pad")


The above code fails for these 2 conditions :
'idsrcpad.can_link(ifreeze_sinkpad)' and
'ifreeze_srcpad.can_link(upload_sinkpad)'.  The check for '<pad>.can_link()'
fails. 

I see that the identity has src caps = ANY , and imagefreeze has sink caps =
video/x-raw(ANY)

I am trying to understand how the caps negotiation is done automatically by
'gst-launch', and the data flows from ' identity -> imagefreeze' with no
issue.  Can any of the Gstreamer experts explain this behaviour? 

I reckon, that I must also change the caps at the 'identity' source pads, so
that the 'imagefreeze' can accept the data and display.
How do I set the 'src caps' for identity, so that the 'image freze ' can
accept and let the data flow? 



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list