[gstreamer-bugs] [Bug 339279] Subclassing from interfaces isn't always possible
GStreamer (bugzilla.gnome.org)
bugzilla-daemon at bugzilla.gnome.org
Thu Apr 27 02:58:33 PDT 2006
Do not reply to this via email (we are currently unable to handle email
responses and they get discarded). You can add comments to this bug at
http://bugzilla.gnome.org/show_bug.cgi?id=339279
GStreamer | gst-python | Ver: HEAD CVS
------- Comment #8 from Jason Toffaletti 2006-04-27 09:58 UTC -------
I've done some thinking and the only solution I can come up with that doesn't
involve changing GstURIHandlerInterface is pretty ugly. Basically all python
URIHandlers are fake and never registered with gstreamer in the traditional
sense. Instead a global python GstURIHandler is registered only once for each
uri type (GST_URI_SINK, GST_URI_SRC) and gst-python keeps its own registery of
python URIHandlers. When Gstreamer calls get_protocols for the global
GstURIHandlerInterface, it returns a list of all protocols handled by every
python URIHandler. When set_uri is called, it associates that instance of
GstURIHandler with the real python GstElement which handles the protocol so it
is able to proxy the function calls.
# gst code
class URIHandler(object):
type = gst.URI_UNKNOWN
protocols = []
def get_uri(self):
raise UnimplementedError
def set_uri(self, uri):
raise UnimplementedError
def register_uri_handler(klass):
assert issubclass(klass, URIHandler):
_register_uri_handler(klass, klass.type)
# _register_uri_handler is the C function which maintains the global
# list of src and sink uri handlers and takes care of registering
# the two real GstURIHandler proxies with gstreamer.
# application code
class DaapSrc(gst.Element, gst.URIHandler):
type = gst.URI_SRC
protocols = ['daap']
def get_uri(self):
return 'daap'
def set_uri(self, uri):
pass
gst.register_uri_handler(DaapSrc)
--
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Gstreamer-bugs
mailing list