GNOME Bugzilla – Bug 679181
PyGI equivalent of URIHandler subclass: do_get_type_full(), do_get_protocols_full()?
Last modified: 2018-05-06 09:22:05 UTC
With gst-python you can do something like this to add an element with a custom URI handler: class DmediaSrc(gst.Bin, gst.URIHandler): @classmethod def do_get_type_full(cls): return gst.URI_SRC @classmethod def do_get_protocols_full(cls): return ['dmedia'] def do_set_uri(self, uri): if not uri.startswith('dmedia://'): return False self.uri = uri return True def do_get_uri(self): return self.uri I know in 0.10 there was some special magic in the do_get_*_full() methods, and perhaps the issue is there isn't the equivalent in PyGI. Here's my working custom 0.10 element with URI handler: http://bazaar.launchpad.net/~jderose/+junk/gst-examples/view/head:/plugin-0.10 Here's what I'm trying to do with 1.0: http://bazaar.launchpad.net/~jderose/+junk/gst-examples/view/head:/plugin-1.0 Thanks to help from Edward Hervey a while back, I can register my 1.0 plugin and element, but as soon as I also subclass from Gst.URIHandler, things break. do_get_protocols_full(), do_get_type_full() don't get called (although I wasn't really expected them to be). do_get_protocols(), do_get_type() don't get called either. Am I missing something, or is this just not yet usable from PyGI?
GI/PyGI probably doesn't support static interface methods at all.
So are Gst "interfaces" the same as GObject "interfaces"? From looking at the pygobject unit tests, it seems GObject interfaces are supported, although I'm still very fuzzy on the details and how pygobject decides what do expose via do_foo() methods.
Moving to gst-python for overriding then if we can't do anything using g-i annotations.
Closing this bug now, gst-python is only an extension module to pygi now and this bug doesn't make much sense anymore in this context.
I confused as to why this has anything to do with gst-python. The fundamental issue is whether GI, PyGI, and the current GStreamer annotations can support interfaces, right? My concern isn't doing this the same way it was in 0.10, I'm just trying to figure out if this is possible still.
Sorry, I missed that this bug was still relevant for 1.0 and GI/pygi.
No worries, I don't understand enough about what exactly Gst interfaces are to make particularly intelligent comments :) For what it's worth, I do hope that Python can remain first-class way of using GStreamer in 1.0 just because it's such a great way to prototype, and I think it makes teaching/learning GStreamer easier.
Closing for now, seems to be fixed. Please re-open if you can reproduce the issue.