Changing GStreamerFilter properties dynamically

1,756 views
Skip to first unread message

Alberto Pierini

unread,
May 4, 2016, 7:20:34 AM5/4/16
to kurento
I created a new custom filter copying the source of GStreamerFilter, and I add an API method that can change the properties of the gst element:

void MyFilterImpl::setProperty (std::string &property, int value)
{
GstElement *filter;
g_object_get (element, "filter", &filter, NULL);
g_object_set (G_OBJECT(filter), property, value, NULL);
g_object_unref (filter);
}

but after I call setProperty from the client, the property doesn't really seems to change. The method is reached (verified with logs), but no outcome and no error triggered.

For example: 

pipeline.create('MyFilter', {command: "audioecho delay=5000000000 intensity=0.9 feedback=0.4"}, function (error, myFilter) {

works fine, and the audio is echoed.


But after the creation (state being PLAYING or NULL), the call

myFilter.setProperty("delay", 1, function(error) {

has no effect.


Does somebody see any mistakes?


I'm aware that some properties can change just in some states (for example some can't be changed in PLAYING or PAUSED). I tried few but the outcome is always the same.
Also, the output of gst-inspect is of course version-dependent. For example for the property queue.min-threshold-time
1.5:
flags: readable, writable, changeable in NULL, READY, PAUSED or PLAYING state
1.0:
flags: readable, writable
0.10:
flags: readable, writable

Does
filter = gst_parse_launch (command.c_str(), &error);
use 1.5 ? Could I somehow verify that?


Thanks.

Jose Antonio Santos Cadenas

unread,
May 4, 2016, 1:14:00 PM5/4/16
to kurento
Sorry, but changing properties of gstreamer filter dynamically is not possible. There are some problems on type definitions that are not trivial to solve.

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alberto Pierini

unread,
May 5, 2016, 5:53:04 AM5/5/16
to kur...@googlegroups.com
Hi Jose,

Thanks for your time.
Could you please elaborate a little more? 

The thing is, I don't see how Kurento is involved here, because the function is all gst code:

void MyFilterImpl::setProperty (std::string &property, int value)
{
GstElement *filter;
g_object_get (element, "filter", &filter, NULL);
g_object_set (G_OBJECT(filter), property, value, NULL);
g_object_unref (filter);
}

--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/NlTrCmKl1vs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+u...@googlegroups.com.

Jose Antonio Santos Cadenas

unread,
May 5, 2016, 9:25:22 PM5/5/16
to kur...@googlegroups.com
Sorry, I misunderstood you, I thought you were using kurento GStreamerElement. Have you tried different values, it should be possible to modify properties this way. Your code seems fine.

Jose Antonio Santos Cadenas

unread,
May 5, 2016, 9:27:27 PM5/5/16
to kur...@googlegroups.com
Maybe the problem is the way you create the filter, that is some code that you don't show, what do you do with "filter" once it is created with gst_parse_launch?

Alberto Pierini

unread,
May 6, 2016, 10:02:29 AM5/6/16
to kur...@googlegroups.com
My constructor is the same as GSTreamerFilter (only difference I don't pass the type cause I always work with audio).
The filter is simply set to element.

Is it possible that gst_parse_launch doesn't get the 1.5 element, but 1.0 or 0.10?

Thanks

Jose Antonio Santos Cadenas

unread,
May 6, 2016, 12:46:33 PM5/6/16
to kur...@googlegroups.com
No, it should take the 1.5 for sure. That can't be the problem. Maybe you have some other problem in the way that you are setting the properties, becase we have elements where the properties are being changed dynamically.

Alberto Pierini

unread,
May 10, 2016, 3:29:07 AM5/10/16
to kurento
Thx. It works, it was an unrelated problem. 

v k

unread,
Aug 6, 2018, 10:13:21 AM8/6/18
to kurento
I am using Gstreamer 1.0 with Python bindings. 
Below is the pipeline I am trying to build considering Opengl  : 

    gltestsrc -> gltransformation -> glimagesink

I am trying to modify the properties of element 'gltransformation' dynamically based on the values received from external hardware device.
Below is the snipped of the python script : 

    import gi
    gi.require_version('Gst','1.0')
    from gi.repository import Gst,GstController

#global variables 
#the values of a,b,c get updated for certain events dynamically based on external hardware 
a = 0 
b= 0 
c = 0 


source = Gst.ElementFactory.make("gltestsrc", "source") 
gltrnsfrm = Gst.ElementFactory.make("gltransformation","gltrnsfrm") 
sink = Gst.ElementFactory.make("glimagesink", "sink") 

# create the empty pipeline 
pipeline = Gst.Pipeline.new("test-pipeline") 

if not pipeline or not source or not gltrnsfrm or not sink: 
print("ERROR: Not all elements could be created") 
sys.exit(1) 

# build the pipeline 
pipeline.add(source,gltrnsfrm,sink) 

if not source.link(gltrnsfrm): 
print("ERROR: Could not link source to gltrsnfrm") 
sys.exit(1) 

if not gltrnsfrm.link(sink): 
   print("ERROR: Could not link gltrsnfrm  to sink") 
   sys.exit(1) 

# modify the gltransformation's properties 
gltrnsfrm.set_property("rotation-z",a) 
gltrnsfrm.set_property("rotation-x",b) 
gltrnsfrm.set_property("rotation-y",c) 
    
    #dynamic controller
    cs = GstController.InterpolationControlSource()
    cs.set_property('mode', GstController.InterpolationMode.LINEAR)
    cb= Gstcontorller.DirectControlBinding.new(gltrnsfrm,"rotation-x",cs)
    gltrnsfrm.add_control_binding(cb)
    
    #modify the values
    cs.set(0*Gst.SECOND,b)  #use updated values of b
    cs.set(1*Gst.SECOND,b)


The above example shows only modification of 1 element property, however, I have other properties as well to be modified based on the values of `a,b & c`.

Executing the above script gives me the following error: 

    GStreamer-CRITICAL : gst_object_add_control_binding: assertion 'binding->pspec' failed. 


I think I have to set certain more attributes in python to get this working. 
Does anyone have a hand on this issue? 


Regards
Reply all
Reply to author
Forward
0 new messages