After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 679181 - PyGI equivalent of URIHandler subclass: do_get_type_full(), do_get_protocols_full()?
PyGI equivalent of URIHandler subclass: do_get_type_full(), do_get_protocols_...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-python
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-06-30 07:57 UTC by Jason Gerard DeRose
Modified: 2018-05-06 09:22 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jason Gerard DeRose 2012-06-30 07:57:45 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?
Comment 1 Sebastian Dröge (slomo) 2012-07-02 07:32:49 UTC
GI/PyGI probably doesn't support static interface methods at all.
Comment 2 Jason Gerard DeRose 2012-07-18 16:43:06 UTC
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.
Comment 3 Tim-Philipp Müller 2012-09-27 22:00:33 UTC
Moving to gst-python for overriding then if we can't do anything using g-i annotations.
Comment 4 Sebastian Dröge (slomo) 2012-12-17 11:44:32 UTC
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.
Comment 5 Jason Gerard DeRose 2012-12-19 12:21:20 UTC
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.
Comment 6 Sebastian Dröge (slomo) 2012-12-19 12:46:24 UTC
Sorry, I missed that this bug was still relevant for 1.0 and GI/pygi.
Comment 7 Jason Gerard DeRose 2012-12-19 13:23:22 UTC
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.
Comment 8 Edward Hervey 2018-05-06 09:22:05 UTC
Closing for now, seems to be fixed. Please re-open if you can reproduce the issue.