Public feed #891610

Unnamed

public text v1 · immutable
Raw Edit
·published 2008-02-04 19:54 UTC
rendered paste body
Index: playbin_engine.py
===================================================================
--- playbin_engine.py	(revision 4884)
+++ playbin_engine.py	(working copy)
@@ -40,9 +40,6 @@
     This class implements a player using playbin to access the uris
     """
 
-    uri_schemes = {'http' : 150, 'smb' : 150, 'file': 150, 'ftp' : 150,
-                    'sftp' : 150, 'cdda' : 150, 'mms': 150, 'daap': 150}
-
     def __init__(self):
         PlayerEngine.__init__(self)
         self.log_category = 'playbin_engine'
@@ -59,36 +56,38 @@
         self._state = STATES.STOPPED
 
     # FIXME: make elisa able to handle methods for uri_schemes__get also!
-    def _uri_schemes__get(self):
-        schemes = {}
-        reg = gst.registry_get_default()
-        plugins = reg.get_plugin_list()
-        try:
-            for plugin in plugins:
-                features = reg.get_feature_list_by_plugin(plugin.get_name())
-                for feature in features:
-                    if isinstance(feature, gst.ElementFactory) and \
-                           feature.get_uri_type():
-                        protocols = feature.get_uri_protocols()
-                        for protocol in protocols:
-                            schemes[str(protocol)] = 150
-        except AttributeError:
-            # FIXME: URI-Schemes bug..
-            # There is a problem in getting the uri_protocols of factories.
-            # depending on error #385841. 
-            # The problem is fixed in the CVS only.
-            schemes = {'http' : 150, 'smb' : 150, 'file': 150, 'ftp' : 150,
-                    'sftp' : 150, 'cdda' : 150,}
-                    
-            self.warning("Could not find out all uris which are supported by"
-                            " playbin. Using statically file, smb, ftp,"
-                            " sftp, cdda and http only! \n If you have"
-                            " problems with playing this uri-schemes, you"
-                            " might install the latest gstreamer and python-"
-                            "bindings from cvs.")
-        return schemes
+    class uri_schemes_get(object):
+        def __get__(self, instance, owner):
+            schemes = {}
+            reg = gst.registry_get_default()
+            plugins = reg.get_plugin_list()
+            try:
+                for plugin in plugins:
+                    features = reg.get_feature_list_by_plugin(plugin.get_name())
+                    for feature in features:
+                        if isinstance(feature, gst.ElementFactory) and \
+                            feature.get_uri_type():
+                            protocols = feature.get_uri_protocols()
+                            for protocol in protocols:
+                                schemes[str(protocol)] = 150
+            except AttributeError:
+                # FIXME: URI-Schemes bug..
+                # There is a problem in getting the uri_protocols of factories.
+                # depending on error #385841. 
+                # The problem is fixed in the CVS only.
+                schemes = {'http' : 150, 'smb' : 150, 'file': 150, 'ftp' : 150,
+                        'sftp' : 150, 'cdda' : 150,}
+                        
+                self.warning("Could not find out all uris which are supported by"
+                                " playbin. Using statically file, smb, ftp,"
+                                " sftp, cdda and http only! \n If you have"
+                                " problems with playing this uri-schemes, you"
+                                " might install the latest gstreamer and python-"
+                                "bindings from cvs.")
+            return schemes
+    
+    uri_schemes = uri_schemes_get()
 
-
     def audio_sink__get(self):
         return self._audiosink