[gstreamer-bugs] [Bug 350522] New: gst registry.get_feature_list should facilitate sorting

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Tue Aug 8 20:28:15 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=350522
 GStreamer | gst-python | Ver: HEAD CVS

           Summary: gst registry.get_feature_list should facilitate sorting
           Product: GStreamer
           Version: HEAD CVS
          Platform: Other
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: Normal
         Component: gst-python
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: mute at howell-ersatz.com
         QAContact: johan at gnome.org
     GNOME version: Unspecified
   GNOME milestone: Unspecified


As the number of plugins increases, it becomes useful to have a list of plugins
sorted by name.  Currently the following code returns a list sorted by some
index other than the name strings:

    registry = gst.registry_get_default()
    registrylist = registry.get_feature_list(gst.ElementFactory)
    registrylist.sort()

Results in this:

typefind
tee
filesink
queue
identity
filesrc
fdsink
fdsrc
fakesink
fakesrc
capsfilter
xvimagesink
ximagesink
...

The fastest option is probably to have gst.PluginFeature have it's own __cmp__
method like this:

def __cmp__(self, other):
    return cmp(self.get_name(), other.get_name())

This will make registrylist.sort() result in a list sorted alphabetically by
name.

Then again, this may be something that should be added to the gstreamer core
and is inappropriate for gst-python.  

The workaround is this:

registrylist.sort(lambda x, y: cmp(x.get_name(), y.get_name()))


-- 
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