GNOME Bugzilla – Bug 580412
API for getting element factories by caps and type
Last modified: 2011-04-14 22:32:15 UTC
In transmageddon I spent a lot of time trying to be able to get at codecs and muxers by using GStreamer caps/mimetypes and link that with element names. We got quite a bit of API in GStreamer for taking string mimetypes and using them, but not a easy way to link that information with actual plugins. In transmageddon I created this file to deal with it: http://cgit.freedesktop.org/~uraeus/transmageddon/tree/src/codecfinder.py It is essentially an API which I can for instance provide with 'audio/mpeg,mpegversion=1,layer=3' and it will return me the name of a mp3 encoder if I got one, or let me know that there is no plugin for that format available (which in turn lets me use the pbutils stuff to search for a plugin). Would be nice to have a generic version of this API in C availalble in GStreamer as loading of plugins and checking pad caps is not obvious to people not very experienced with GStreamer.
I'd suggest something along the lines of GList *gst_.._get_element_factories(GstCaps *incaps, GstCaps *outcaps, gchar *first_class, gchar *second_class, ...); There is some nasty code that does something like that in a much less generic way in Farsight.
while you're at it, lets add a "guint min_rank" parameter to exclude bad apples
(In reply to comment #1) > I'd suggest something along the lines of > > GList *gst_.._get_element_factories(GstCaps *incaps, GstCaps *outcaps, gchar > *first_class, gchar *second_class, ...); > > There is some nasty code that does something like that in a much less generic > way in Farsight. Just provide the class as one arg: "class1/class2/class3" the classes do not form a hierarchy anyway. Code is here already more or less http://buzztard.svn.sourceforge.net/viewvc/buzztard/trunk/buzztard/src/lib/core/tools.c?view=markup#l_45 http://buzztard.svn.sourceforge.net/viewvc/buzztard/trunk/buzztard/src/lib/core/tools.c?view=markup#l_76
I guess Encodebin does more or less what I want, so I am closing this bug.
Actually, the GstElementFactory list + filter stuff added one or two cycles ago should handle this use case: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElementFactory.html#gst-element-factory-list-get-elements http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElementFactory.html#gst-element-factory-list-filter