GNOME Bugzilla – Bug 89836
[API] gst_element_(s|g)et_name are redundant
Last modified: 2004-12-22 21:47:04 UTC
The functions gst_element_(s|g)et_name() are redundant, because there is already a equivalent in the super class GstObject called gst_object_(s|g)et_name().
gst_element_set_name should probably check with its parent bin (if it has one) that the name is unique. There might be extra behaviour that we will want to attach in the future so I would be in favour of not changing this atm.
But in this case shouldn't it be a virtual method?
Could you elaborate a bit more on what you mean by that ?
If set_name's functionality depends on the class type and should, for example, enforce that each name is unique in a GstBin, then the function should be virtual/polymorphic. I think with GObjects this is done by putting a pointer to the function in the class object. Sub-classes can overwrite the pointer if they need a special implementation of the function. So when you then call set_name on a GstObject that happens to be a GstElement, GstElement's implementation will be invoked and not GstObject's. Otherwise you could break the Bin's structure by calling gst_object_set_name on a GstElement, even though the API allows that.
a vmethod is a bit of an overkill for something as simple as setting a name IMO. This bug is related to gst_element_(s|g)et_parent (which has different error reporting than its GstObject part, for no reason). We have to decide if we keep the methods or only use the gstobject counterparts (look at gtk+ for example). I vote for removal...
changed to macros, feel free to either use or ignore them ;) in the future if we feel giddy they may even get deprecated