def get_muxer_element(containercaps): 
   """
   Check all muxers for their caps and create a dictionary mapping caps 
   to element names. Then return elementname
   """

   flist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
   muxers = []
   features = []
   elementname = False
   for fact in flist:
       # FIXME: the 'and not' part of this line should be removed, but it has to
       # stay in until Ranks have been set on most muxers in GStreamer. If
       # removed now we get lots of failures due to ending up with broken muxers
       if list_compat(["Codec", "Muxer"], fact.get_klass().split('/')) and not \
               fact.get_name().startswith('ffmux'):
           muxers.append(fact.get_name())
           features.append(fact)
   muxerfeature = dict(zip(muxers, features))
   incomingcaps = containercaps
   for x in muxers:
           element = x
           factory = gst.registry_get_default().lookup_feature(str(x))
           sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() \
                   if x.direction == gst.PAD_SRC]
           for caps in sinkcaps:
               if caps.intersect(incomingcaps):
                   if elementname == False:
                       elementname = element
                   else:
                       mostrecent = gst.PluginFeature.get_rank(muxerfeature[element])
                       original = gst.PluginFeature.get_rank(muxerfeature[elementname])
                       if mostrecent >= original:
                           elementname = element
   return elementname
def get_muxer_element(containercaps):
    """
   Check all muxers for their caps and create a dictionary mapping caps 
   to element names. Then return elementname
   """

    flist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
    muxers = []
    features = []
    elementname = False
    for fact in flist:
        # FIXME: the 'and not' part of this line should be removed, but it has to
        # stay in until Ranks have been set on most muxers in GStreamer. If
        # removed now we get lots of failures due to ending up with broken muxers
        if list_compat(["Codec", "Muxer"], fact.get_klass().split("/")) and not fact.get_name().startswith("ffmux"):
            muxers.append(fact.get_name())
            features.append(fact)
    muxerfeature = dict(zip(muxers, features))
    incomingcaps = containercaps
    for x in muxers:
        element = x
        factory = gst.registry_get_default().lookup_feature(str(x))
        sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() if x.direction == gst.PAD_SRC]
        for caps in sinkcaps:
            if caps.intersect(incomingcaps):
                if elementname == False:
                    elementname = element
                else:
                    mostrecent = gst.PluginFeature.get_rank(muxerfeature[element])
                    original = gst.PluginFeature.get_rank(muxerfeature[elementname])
                    if mostrecent >= original:
                        elementname = element
    return elementname
Esempio n. 3
0
def load_exaile_directsound_plugin(presets):
    
    try:
        if platform.architecture()[0] == "32bit":
            plugin_path = os.path.abspath(os.path.join(__file__, '../../../tools/win-installer/libgstexailedirectsoundsink.dll'))
        else:
            plugin_path = os.path.abspath(os.path.join(__file__, '../../../tools/win-installer/libgstexailedirectsoundsink64.dll'))
            
        plugin = gst.plugin_load_file(plugin_path)
        gst.registry_get_default().add_plugin(plugin)
        
    except glib.GError, e:
        logger.error("Error loading custom DirectSound plugin: %s" % str(e))
Esempio n. 4
0
def get_compatible_sink_caps(factoryname, caps):
    """
    Returns the compatible caps between 'caps' and the sink pad caps of 'factoryname'
    """
    log.log("encode", "factoryname : %s , caps : %s", factoryname,
            caps.to_string())
    factory = gst.registry_get_default().lookup_feature(factoryname)
    if factory == None:
        log.warning("encode", "%s is not a valid factoryname", factoryname)
        return None

    res = []
    sinkcaps = [
        x.get_caps() for x in factory.get_static_pad_templates()
        if x.direction == gst.PAD_SINK
    ]
    for c in sinkcaps:
        log.log("encode", "sinkcaps %s", c.to_string())
        inter = caps.intersect(c)
        log.log("encode", "intersection %s", inter.to_string())
        if inter:
            res.append(inter)

    if len(res) > 0:
        return res[0]
    return None
Esempio n. 5
0
def get_compatible_sink_pad(factoryname, caps):
    """
    Returns the pad name of a (request) pad from factoryname which is
    compatible with the given caps.
    """
    factory = gst.registry_get_default().lookup_feature(factoryname)
    if factory == None:
        log.warning("encode", "%s is not a valid factoryname", factoryname)
        return None

    res = []
    sinkpads = [
        x for x in factory.get_static_pad_templates()
        if x.direction == gst.PAD_SINK
    ]
    for p in sinkpads:
        c = p.get_caps()
        log.log("encode", "sinkcaps %s", c.to_string())
        inter = caps.intersect(c)
        log.log("encode", "intersection %s", inter.to_string())
        if inter:
            res.append(p.name_template)
    if len(res) > 0:
        return res[0]
    return None
Esempio n. 6
0
 def __init__(self, encoder=None, input_stream=None, output_stream=None,
              encodersettings={}):
     """
     @param encoder: The encoder to use. If None, no encoder is used and the
     incoming stream will be outputted directly.
     @type encoder: C{str}.
     @param input_stream: The type of streams accepted by this settings. If
     None are specified, the stream type will be extracted from the encoder.
     If one is specified, then a L{StreamModifierFactory} will be use to
     conform the incoming stream to the specified L{Stream}.
     @type input_stream: L{MultimediaStream}
     @param output_stream: The type of streams accepted by this settings. If
     None are specified, the stream type will be extracted from the encoder.
     @type output_stream: L{MultimediaStream}
     @param encodersettings: Encoder-specific settings.
     @type encodersettings: C{dict}
     """
     # FIXME : What if we need parsers after the encoder ??
     self.encoder = encoder
     self.input_stream = input_stream
     self.output_stream = output_stream
     self.encodersettings = encodersettings
     self.modifyinput = (input_stream != None)
     self.modifyoutput = (output_stream != None)
     if not self.input_stream or not self.output_stream:
         # extract stream from factory
         for p in gst.registry_get_default().lookup_feature(self.encoder).get_static_pad_templates():
             if p.direction == gst.PAD_SINK and not self.input_stream:
                 self.input_stream = get_stream_for_caps(p.get_caps().copy())
                 self.input_stream.pad_name = p.name_template
             elif p.direction == gst.PAD_SRC and not self.output_stream:
                 self.output_stream = get_stream_for_caps(p.get_caps().copy())
                 self.output_stream.pad_name = p.name_template
Esempio n. 7
0
def get_muxer_element(containercaps): 
   """
   Check all muxers for their caps and create a dictionary mapping caps 
   to element names. Then return elementname
   """
   muxers = available_muxers()
   stringcaps = []
   blacklist = ['rate','systemstream','packetsize']
   for x in muxers:
       factory = gst.registry_get_default().lookup_feature(str(x))
       sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() if x.direction == gst.PAD_SRC]
       for caps in sinkcaps:
           result = caps[0].get_name();
           for attr in caps[0].keys():
               if attr not in blacklist:
                   result += ","+attr+"="+str(caps[0][attr])
           stringcaps.append(result)

   # print stringcaps
   muxerchoice = dict(zip(stringcaps, muxers))
   if muxerchoice.has_key(containercaps):
       elementname = muxerchoice[containercaps]
   else:
       elementname = False
   return elementname
Esempio n. 8
0
 def __init__(self, encoder=None, input_stream=None, output_stream=None,
              encodersettings={}):
     """
     @param encoder: The encoder to use. If None, no encoder is used and the
     incoming stream will be outputted directly.
     @type encoder: C{str}.
     @param input_stream: The type of streams accepted by this settings. If
     None are specified, the stream type will be extracted from the encoder.
     If one is specified, then a L{StreamModifierFactory} will be use to
     conform the incoming stream to the specified L{Stream}.
     @type input_stream: L{MultimediaStream}
     @param output_stream: The type of streams accepted by this settings. If
     None are specified, the stream type will be extracted from the encoder.
     @type output_stream: L{MultimediaStream}
     @param encodersettings: Encoder-specific settings.
     @type encodersettings: C{dict}
     """
     # FIXME : What if we need parsers after the encoder ??
     self.encoder = encoder
     self.input_stream = input_stream
     self.output_stream = output_stream
     self.encodersettings = encodersettings
     self.modifyinput = (input_stream != None)
     self.modifyoutput = (output_stream != None)
     if not self.input_stream or not self.output_stream:
         # extract stream from factory
         for p in gst.registry_get_default().lookup_feature(self.encoder).get_static_pad_templates():
             if p.direction == gst.PAD_SINK and not self.input_stream:
                 self.input_stream = get_stream_for_caps(p.get_caps().copy())
                 self.input_stream.pad_name = p.name_template
             elif p.direction == gst.PAD_SRC and not self.output_stream:
                 self.output_stream = get_stream_for_caps(p.get_caps().copy())
                 self.output_stream.pad_name = p.name_template
Esempio n. 9
0
	def FillLADSPARegistry(self):
		"""
		Fill Globals.LADSPA_FACTORY_REGISTRY with effects on the system. This
		is to ensure that only presets with effects on the current system are listed.
		"""
		Globals.debug("Filling LADSPA Registry")
		
		##make sure all the structures are empty before we append to them
		Globals.LADSPA_NAME_MAP=[]
		Globals.LADSPA_FACTORY_REGISTRY = None
		effects = []

		ladspaFactoryList = gst.registry_get_default().get_feature_list_by_plugin("ladspa")
		
		for factory in ladspaFactoryList:
			if isinstance(factory, gst.ElementFactory):
				# from the list of LADSPA effects we check which ones only
				# have a single sink and a single src so we know they work
				if factory.get_num_pad_templates() == 2:
					pads = factory.get_static_pad_templates()
					sinkpads = len( [pad for pad in pads if pad.direction == gst.PAD_SINK] )
					srcpads = len( [pad for pad in pads if pad.direction == gst.PAD_SRC] )
					
					if srcpads == 1 and sinkpads == 1:
						effects.append(factory.get_name())
						Globals.LADSPA_NAME_MAP.append((factory.get_name(), factory.get_longname()))

		Globals.debug("\t", len(effects), "LADSPA effects loaded")
		Globals.LADSPA_FACTORY_REGISTRY = set(effects)
Esempio n. 10
0
def get_video_encoder_element(videoencodercaps):
   """
   Check all video encoders for their caps and create a dictionary 
   mapping caps to element names. Then return elementname.
   """
   encoders = available_video_encoders()
   videocaps = []
   # blacklist all caps information we do not need to create a unique identifier
   blacklist = ['height','width','framerate','systemstream','depth']
   for x in encoders:
       factory = gst.registry_get_default().lookup_feature(str(x))
       sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() if x.direction == gst.PAD_SRC]
       for caps in sinkcaps:
           result = caps[0].get_name();
           for attr in caps[0].keys():
               if attr not in blacklist:
                   result += ","+attr+"="+str(caps[0][attr])
           videocaps.append(result)
   # print videocaps
   videoencoderchoice = dict(zip(videocaps, encoders))
   # print videoencoderchoice
   if videoencoderchoice.has_key(videoencodercaps):
       elementname = videoencoderchoice[videoencodercaps]
   else:
       elementname = False
   return elementname
Esempio n. 11
0
def get_audio_encoder_element(audioencodercaps):
   """
   Check all audio encoders for their caps and create a dictionary 
   mapping caps to element names. Then return elementname.
   """
   audioencoders = available_audio_encoders()
   audiocaps = []
   # blacklist all caps information we do not need to create a unique identifier
   blacklist = ['rate','channels','bitrate','block_align','mode','subbands'
               ,'allocation','framed','bitpool','blocks','width']
   for x in audioencoders:
       factory = gst.registry_get_default().lookup_feature(str(x))
       sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() if x.direction == gst.PAD_SRC]
       for caps in sinkcaps:
           result = caps[0].get_name();
           for attr in caps[0].keys():
               if attr not in blacklist:
                   result += ","+attr+"="+str(caps[0][attr])
           audiocaps.append(result)
   # print audiocaps 
   audioencoderchoice = dict(zip(audiocaps, audioencoders))
   if audioencoderchoice.has_key(audioencodercaps):
       elementname = audioencoderchoice[audioencodercaps]
   else:
       elementname = False
   return elementname
Esempio n. 12
0
    def __init__(self):
        QtCore.QObject.__init__(self)

        self._supported_extensions = []
        for plugin, extensions in self.PLUGINS.items():
            if gst.registry_get_default().find_plugin(plugin) is not None:
                self._supported_extensions.extend(extensions)

        self.uri = None
        self._status = State.STOPPED
        self.bin = gst.element_factory_make('playbin')
        self.bin.set_property('video-sink', None)
        try:
            device = gst.parse_launch(self.SINK)
        except gobject.GError:
            pass
        else:
            self.bin.set_property('audio-sink', device)

        bus = self.bin.get_bus()
        bus.add_signal_watch()
        bus.connect('message::eos', self._message_eos)
        bus.connect('message::error', self._message_error)
        bus.connect('message::async-done', self._message_async_done)

        self.time_fmt = gst.Format(gst.FORMAT_TIME)
        self.seek_pending = False
Esempio n. 13
0
def check_required_version(modulename):
    """
    Checks if the installed module is the required version or more recent.
    Returns [None, None] if it's recent enough, else will return a list
    containing the strings of the required version and the installed version.
    This function does not check for the existence of the given module !
    """
    if modulename == "gtk":
        if list(gtk.pygtk_version) < _string_to_list(PYGTK_REQ):
            return [PYGTK_REQ, _version_to_string(gtk.pygtk_version)]
    if modulename == "pygst":
        if list(gst.get_pygst_version()) < _string_to_list(PYGST_REQ):
            return [PYGST_REQ, _version_to_string(gst.get_pygst_version())]
    if modulename == "cairo":
        import cairo
        if _string_to_list(
                cairo.cairo_version_string()) < _string_to_list(PYCAIRO_REQ):
            return [PYCAIRO_REQ, cairo.cairo_version_string()]
    if modulename == "gst":
        if list(gst.get_gst_version()) < _string_to_list(GST_REQ):
            return [GST_REQ, _version_to_string(gst.get_gst_version())]
    if modulename == "gnonlin":
        gnlver = gst.registry_get_default().find_plugin(
            "gnonlin").get_version()
        if _string_to_list(gnlver) < _string_to_list(GNONLIN_REQ):
            return [GNONLIN_REQ, gnlver]
    return [None, None]
Esempio n. 14
0
    def __createUi(self):

        def get_data(w, context, s_d, info, time):
            model, rows = treeview.get_selection().get_selected_rows()
            uris = '\n'.join((model[path][1] for path in rows))
            s_d.set(s_d.target, 8, uris)

        # get list of all elements
        registry = gst.registry_get_default()
        registrylist = registry.get_feature_list(gst.ElementFactory)
        registrylist.sort(lambda x, y: cmp(x.get_name(), y.get_name()))

        # create a tree view to display them
        treemodel = gtk.TreeStore(gobject.TYPE_PYOBJECT, gobject.TYPE_STRING)
        for item in registrylist:
            treemodel.append(None, [item, item.get_name()])
        treeview = gtk.TreeView()
        treeview.set_model(treemodel)
        treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn("Element", renderer, text=1)
        treeview.append_column(column)
        treeview.set_size_request(100, 100)
        treeview.drag_source_set(gtk.gdk.BUTTON1_MASK,
            target, gtk.gdk.ACTION_COPY)
        treeview.connect('drag_data_get', get_data)
        self.add(treeview)
Esempio n. 15
0
    def FillLADSPARegistry(self):
        """
		Fill Globals.LADSPA_FACTORY_REGISTRY with effects on the system. This
		is to ensure that only presets with effects on the current system are listed.
		"""
        Globals.debug("Filling LADSPA Registry")

        ##make sure all the structures are empty before we append to them
        Globals.LADSPA_NAME_MAP = []
        Globals.LADSPA_FACTORY_REGISTRY = None
        effects = []

        ladspaFactoryList = gst.registry_get_default(
        ).get_feature_list_by_plugin("ladspa")

        for factory in ladspaFactoryList:
            if isinstance(factory, gst.ElementFactory):
                # from the list of LADSPA effects we check which ones only
                # have a single sink and a single src so we know they work
                if factory.get_num_pad_templates() == 2:
                    pads = factory.get_static_pad_templates()
                    sinkpads = len(
                        [pad for pad in pads if pad.direction == gst.PAD_SINK])
                    srcpads = len(
                        [pad for pad in pads if pad.direction == gst.PAD_SRC])

                    if srcpads == 1 and sinkpads == 1:
                        effects.append(factory.get_name())
                        Globals.LADSPA_NAME_MAP.append(
                            (factory.get_name(), factory.get_longname()))

        Globals.debug("\t", len(effects), "LADSPA effects loaded")
        Globals.LADSPA_FACTORY_REGISTRY = set(effects)
Esempio n. 16
0
def check_required_version(modulename):
    """
    Checks if the installed module is the required version or more recent.
    Returns [None, None] if it's recent enough, else will return a list
    containing the strings of the required version and the installed version.
    This function does not check for the existence of the given module !
    """
    if modulename == "gtk":
        if list(gtk.pygtk_version) < _string_to_list(PYGTK_REQ):
            return [PYGTK_REQ, _version_to_string(gtk.pygtk_version)]
    if modulename == "pygst":
        if list(gst.get_pygst_version()) < _string_to_list(PYGST_REQ):
            return [PYGST_REQ, _version_to_string(gst.get_pygst_version())]
    if modulename == "cairo":
        import cairo
        if _string_to_list(cairo.cairo_version_string()) < _string_to_list(PYCAIRO_REQ):
            return [PYCAIRO_REQ, cairo.cairo_version_string()]
    if modulename == "gst":
        if list(gst.get_gst_version()) < _string_to_list(GST_REQ):
            return [GST_REQ, _version_to_string(gst.get_gst_version())]
    if modulename == "gnonlin":
        gnlver = gst.registry_get_default().find_plugin("gnonlin").get_version()
        if _string_to_list(gnlver) < _string_to_list(GNONLIN_REQ):
            return [GNONLIN_REQ, gnlver]
    return [None, None]
Esempio n. 17
0
 def _setup_preferences(self):
     # Fix for https://github.com/mopidy/mopidy/issues/604
     registry = gst.registry_get_default()
     jacksink = registry.find_feature('jackaudiosink',
                                      gst.TYPE_ELEMENT_FACTORY)
     if jacksink:
         jacksink.set_rank(gst.RANK_SECONDARY)
Esempio n. 18
0
 def _setup_preferences(self):
     # Fix for https://github.com/mopidy/mopidy/issues/604
     registry = gst.registry_get_default()
     jacksink = registry.find_feature(
         'jackaudiosink', gst.TYPE_ELEMENT_FACTORY)
     if jacksink:
         jacksink.set_rank(gst.RANK_SECONDARY)
Esempio n. 19
0
def get_all_plugin_names():
    global all_plugin_names, has_gst
    if len(all_plugin_names)==0 and has_gst:
        registry = gst.registry_get_default()
        all_plugin_names = [el.get_name() for el in registry.get_feature_list(gst.ElementFactory)]
        all_plugin_names.sort()
        log("found the following plugins: %s", all_plugin_names)
    return all_plugin_names
Esempio n. 20
0
def get_all_plugin_names():
    global all_plugin_names, has_gst
    if len(all_plugin_names)==0 and has_gst:
        registry = gst.registry_get_default()
        all_plugin_names = [el.get_name() for el in registry.get_feature_list(gst.ElementFactory)]
        all_plugin_names.sort()
        log("found the following plugins: %s", all_plugin_names)
    return all_plugin_names
Esempio n. 21
0
def available_muxers():
   """ return all available muxers except the broken ffmpeg ones """
   flist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
   res = []
   for fact in flist:
       if list_compat(["Codec", "Muxer"], fact.get_klass().split('/')) and not fact.get_name().startswith('ffmux'):
           res.append(fact.get_name())
   return res
Esempio n. 22
0
 def __init__(self):
     self._audioEncoders = []
     self._videoEncoders = []
     self._muxers = []
     self._compatibleMuxers = []
     self._factories = None
     self._registry = gst.registry_get_default()
     self._registry.connect("feature-added", self._registryFeatureAddedCb)
Esempio n. 23
0
def initial_checks():
    reg = gst.registry_get_default()
    if PiTiVi:
        return (_("%s is already running") % APPNAME,
                _("An instance of %s is already running in this script.") % APPNAME)
    if not reg.find_plugin("gnonlin"):
        return (_("Could not find the GNonLin plugins"),
                _("Make sure the plugins were installed and are available in the GStreamer plugins path."))
    if not reg.find_plugin("autodetect"):
        return (_("Could not find the autodetect plugins"),
                _("Make sure you have installed gst-plugins-good and that it's available in the GStreamer plugin path."))
    if not hasattr(gtk.gdk.Window, 'cairo_create'):
        return (_("PyGTK doesn't have cairo support"),
                _("Please use a version of the GTK+ Python bindings built with cairo support."))
    if not initiate_videosinks():
        return (_("Could not initiate the video output plugins"),
                _("Make sure you have at least one valid video output sink available (xvimagesink or ximagesink)."))
    if not initiate_audiosinks():
        return (_("Could not initiate the audio output plugins"),
                _("Make sure you have at least one valid audio output sink available (alsasink or osssink)."))
    if not __try_import__("cairo"):
        return (_("Could not import the cairo Python bindings"),
                _("Make sure you have the cairo Python bindings installed."))
    if not __try_import__("goocanvas"):
        return (_("Could not import the goocanvas Python bindings"),
                _("Make sure you have the goocanvas Python bindings installed."))
    if not __try_import__("xdg"):
        return (_("Could not import the xdg Python library"),
                _("Make sure you have the xdg Python library installed."))
    req, inst = check_required_version("gtk")
    if req:
        return (_("You do not have a recent enough version of the GTK+ Python bindings (your version %s)") % inst,
                _("Install a version of the GTK+ Python bindings greater than or equal to %s.") % req)
    req, inst = check_required_version("pygst")
    if req:
        return (_("You do not have a recent enough version of GStreamer Python bindings (your version %s)") % inst,
                _("Install a version of the GStreamer Python bindings greater than or equal to %s.") % req)
    req, inst = check_required_version("gst")
    if req:
        return (_("You do not have a recent enough version of GStreamer (your version %s)") % inst,
                _("Install a version of the GStreamer greater than or equal to %s.") % req)
    req, inst = check_required_version("cairo")
    if req:
        return (_("You do not have a recent enough version of the cairo Python bindings (your version %s)") % inst,
                _("Install a version of the cairo Python bindings greater than or equal to %s.") % req)
    req, inst = check_required_version("gnonlin")
    if req:
        return (_("You do not have a recent enough version of the GNonLin GStreamer plugin (your version %s)") % inst,
                _("Install a version of the GNonLin GStreamer plugin greater than or equal to %s.") % req)
    if not __try_import__("zope.interface"):
        return (_("Could not import the Zope interface module"),
                _("Make sure you have the zope.interface module installed."))
    if not __try_import__("pkg_resources"):
        return (_("Could not import the distutils modules"),
                _("Make sure you have the distutils Python module installed."))
    return None
Esempio n. 24
0
def checkPlugin(pluginName, packageName, minimumVersion=None,
                featureName=None, featureCheck=None):
    """
    Check if the given plug-in is available.
    Return a result with an error if it is not, or not new enough.

    @param pluginName: name of the plugin to check
    @param packageName: name of the package to tell the user to install
    if the check fails
    @param minimumVersion: minimum version of the plugin, as a tuple.
    Optional.
    @param featureName: name of a specific feature to check for in the
    plugin. Optional. Overrides the minimum version check, if given.
    @param featureCheck: function to call on the found feature, which
    should return a boolean representing whether the feature is good or
    not. Optional, and only makes sense if you specify featureName.
    @rtype: L{messages.Result}
    """
    result = messages.Result()
    version = gstreamer.get_plugin_version(pluginName)

    if not version:
        m = messages.Error(T_(
            N_("This host is missing the '%s' GStreamer plug-in.\n"),
                pluginName))
        m.add(T_(N_(
            "Please install '%s'.\n"), packageName))
        documentation.messageAddGStreamerInstall(m)
        result.add(m)
    elif featureName:
        r = gst.registry_get_default()
        features = r.get_feature_list_by_plugin(pluginName)
        byname = dict([(f.get_name(), f) for f in features])
        if (featureName not in byname
            or (featureCheck and not featureCheck(byname[featureName]))):
            m = messages.Error(T_(
                N_("Your '%s' GStreamer plug-in is too old.\n"), pluginName),
                mid = 'plugin-%s-check' % pluginName)
            m.add(T_(N_(
                "Please upgrade '%s' to version %s or higher."),
                packageName, ".".join([str(x) for x in minimumVersion])))
            documentation.messageAddGStreamerInstall(m)
            result.add(m)
    elif version < minimumVersion:
        m = messages.Error(T_(
            N_("Version %s of the '%s' GStreamer plug-in is too old.\n"),
               ".".join([str(x) for x in version]), pluginName),
            mid = 'plugin-%s-check' % pluginName)
        m.add(T_(N_(
            "Please upgrade '%s' to version %s."), packageName,
               ".".join([str(x) for x in minimumVersion])))
        documentation.messageAddGStreamerInstall(m)
        result.add(m)

    result.succeed(None)
    return defer.succeed(result)
Esempio n. 25
0
 def _getSimpleFilters(self):
     # go trough the list of element factories and
     # add them to the correct list
     factlist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
     for fact in factlist:
         klass = fact.get_klass()
         if 'Audio' in klass and 'Effect' in klass:
             self.simple_audio.append(fact)
         elif 'Video' in klass and 'Effect' in klass:
             self.simple_video.append(fact)
Esempio n. 26
0
 def _getSimpleFilters(self):
     # go trough the list of element factories and
     # add them to the correct list
     factlist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
     for fact in factlist:
         klass = fact.get_klass()
         if 'Audio' in klass and 'Effect' in klass:
             self.simple_audio.append(fact)
         elif 'Video' in klass and 'Effect' in klass:
             self.simple_video.append(fact)
Esempio n. 27
0
 def __init__(self):
     gtk.TreeStore.__init__(self, gobject.TYPE_STRING, gst.ElementFactory, gobject.TYPE_STRING, gobject.TYPE_STRING)
     self.set_sort_func(ElementFactoriesModel.NAME_COLUMN, self._compare_items, None)
     self.set_sort_column_id(ElementFactoriesModel.NAME_COLUMN, gtk.SORT_ASCENDING)
     registry = gst.registry_get_default()
     for plugin in registry.get_plugin_list():
         for feature in registry.get_feature_list_by_plugin(plugin.get_name()):
             if isinstance(feature, gst.ElementFactory):
                 feature.plugin = plugin
                 parent = self._get_parent_iter(feature.get_klass().split("/"))
                 self.append(parent, (feature.get_longname(), feature, gtk.STOCK_CONNECT, glib.markup_escape_text(feature.get_description())))
Esempio n. 28
0
def find_mux(caps):
	print caps.to_string()
	muxers = [f for f in gst.registry_get_default().get_feature_list(gst.ElementFactory)]
	#muxers = filter(lambda f: f.get_klass() == "Codec/Muxer", muxers)
	#muxers = filter(lambda f: "not recommended" not in f.get_longname(), muxers)
	muxers = filter(lambda f: f.can_sink_caps(caps), muxers)
	
	for m in muxers:
		print m
	
	return muxers[-1].create()
Esempio n. 29
0
    def __init__(self):

        self.gst_registry = gst.registry_get_default()
        all_effects = self.gst_registry.get_feature_list(gst.ElementFactory)
        self.registry = {}
        self.registry[MEDIA_VIDEO] = self._register_filter(
            all_effects, "Filter/Effect/Video")
        self.registry[MEDIA_VIDEO] += self._register_filter(
            all_effects, "Filter/Video")
        self.registry[MEDIA_AUDIO] = self._register_filter(
            all_effects, "Filter/Effect/Audio")
Esempio n. 30
0
 def _find_parsers(self):
     registry = gst.registry_get_default()
     ret = {}
     for f in registry.get_feature_list(gst.ElementFactory):
         if f.get_klass().find('Parser') >= 0:
             for t in f.get_static_pad_templates():
                 if t.direction == gst.PAD_SINK:
                     for s in t.get_caps():
                         ret[s.get_name()] = f.get_name()
                     break
     return ret
Esempio n. 31
0
 def _find_parsers(self):
     registry = gst.registry_get_default()
     ret = {}
     for f in registry.get_feature_list(gst.ElementFactory):
         if f.get_klass().find('Parser') >= 0:
             for t in f.get_static_pad_templates():
                 if t.direction == gst.PAD_SINK:
                     for s in t.get_caps():
                         ret[s.get_name()] = f.get_name()
                     break
     return ret
Esempio n. 32
0
def load_exaile_directsound_plugin(presets):

    try:
        if platform.architecture()[0] == "32bit":
            plugin_path = os.path.abspath(
                os.path.join(
                    __file__,
                    '../../../tools/win-installer/libgstexailedirectsoundsink.dll'
                ))
        else:
            plugin_path = os.path.abspath(
                os.path.join(
                    __file__,
                    '../../../tools/win-installer/libgstexailedirectsoundsink64.dll'
                ))

        plugin = gst.plugin_load_file(plugin_path)
        gst.registry_get_default().add_plugin(plugin)

    except glib.GError, e:
        logger.error("Error loading custom DirectSound plugin: %s" % str(e))
Esempio n. 33
0
def available_audio_encoders():
   """ returns all available audio encoders """
   flist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
   res = []
   for fact in flist:
       if list_compat(["Codec", "Encoder", "Audio"], fact.get_klass().split('/')):
           # excluding wavpackenc as the fact that it got two SRC pads mess up the logic of this code
           if fact.get_name() != 'wavpackenc':
               res.append(fact.get_name())
           else:
               print ""
   return res
Esempio n. 34
0
def element_factory_exists(name):
    """
    Check if the given element factory name exists.

    @rtype: boolean
    """
    registry = gst.registry_get_default()
    factory = registry.find_feature(name, gst.TYPE_ELEMENT_FACTORY)

    if factory:
        return True

    return False
def get_video_encoder_element(videoencodercaps):
   """
   Check all video encoders for their caps and create a dictionary 
   mapping caps to element names, only using the highest ranked element
   for each unique caps value. The input of the function is the unique caps
   and it returns the elementname. If the caps to not exist in dictionary it
   will return False.
   """

   flist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
   encoders = []
   features = []
   elementname = False
   for fact in flist:
       if list_compat(["Codec", "Encoder", "Video"], \
               fact.get_klass().split('/')):
           encoders.append(fact.get_name())
           features.append(fact) 
       elif list_compat(["Codec", "Encoder", "Image"], \
               fact.get_klass().split('/')):
           encoders.append(fact.get_name())
           features.append(fact)
   encoderfeature = dict(zip(encoders, features))
   incomingcaps = videoencodercaps
   for x in encoders:
           element = x
           factory = gst.registry_get_default().lookup_feature(str(x))
           sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() \
                   if x.direction == gst.PAD_SRC]
           for caps in sinkcaps:
               if caps.intersect(incomingcaps):
                   if elementname == False:
                       elementname = element
                   else:
                       mostrecent = gst.PluginFeature.get_rank(encoderfeature[element])
                       original = gst.PluginFeature.get_rank(encoderfeature[elementname])
                       if mostrecent >= original:
                           elementname = element
   return elementname
Esempio n. 36
0
def get_video_encoder_element(videoencodercaps):
   """
   Check all video encoders for their caps and create a dictionary 
   mapping caps to element names, only using the highest ranked element
   for each unique caps value. The input of the function is the unique caps
   and it returns the elementname. If the caps to not exist in dictionary it
   will return False.
   """

   flist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
   encoders = []
   features = []
   elementname = False
   for fact in flist:
       if list_compat(["Codec", "Encoder", "Video"], \
               fact.get_klass().split('/')):
           encoders.append(fact.get_name())
           features.append(fact) 
       elif list_compat(["Codec", "Encoder", "Image"], \
               fact.get_klass().split('/')):
           encoders.append(fact.get_name())
           features.append(fact)
   encoderfeature = dict(zip(encoders, features))
   incomingcaps = videoencodercaps
   for x in encoders:
           element = x
           factory = gst.registry_get_default().lookup_feature(str(x))
           sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() \
                   if x.direction == gst.PAD_SRC]
           for caps in sinkcaps:
               if caps.intersect(incomingcaps):
                   if elementname == False:
                       elementname = element
                   else:
                       mostrecent = gst.PluginFeature.get_rank(encoderfeature[element])
                       original = gst.PluginFeature.get_rank(encoderfeature[elementname])
                       if mostrecent >= original:
                           elementname = element
   return elementname
Esempio n. 37
0
 def _audioEncoderChangedComboCb(self, combo):
     aencoder = get_combo_value(combo).get_name()
     self.settings.setEncoders(aencoder=aencoder)
     for template in gst.registry_get_default().lookup_feature(aencoder).get_static_pad_templates():
         if template.name_template == "src":
             self.audiotype = template.get_caps().to_string()
             for elem in self.audiotype.split(","):
                 if "{" in elem or "[" in elem:
                     self.audiotype = self.audiotype[:self.audiotype.index(elem) - 1]
                     break
     if not self.muxer_combo_changing:
         # The user directly changed the audio encoder combo.
         self.preferred_aencoder = aencoder
Esempio n. 38
0
def _gstreamer_check_elements():
    elements_to_check = [
        # Core playback
        'uridecodebin',

        # External HTTP streams
        'souphttpsrc',

        # Spotify
        'appsrc',

        # Audio sinks
        'alsasink',
        'osssink',
        'oss4sink',
        'pulsesink',

        # MP3 encoding and decoding
        #
        # One of flump3dec, mad, and mpg123audiodec is required for MP3
        # playback.
        'flump3dec',
        'id3demux',
        'id3v2mux',
        'lame',
        'mad',
        'mp3parse',
        # 'mpg123audiodec',  # Only available in GStreamer 1.x

        # Ogg Vorbis encoding and decoding
        'vorbisdec',
        'vorbisenc',
        'vorbisparse',
        'oggdemux',
        'oggmux',
        'oggparse',

        # Flac decoding
        'flacdec',
        'flacparse',

        # Shoutcast output
        'shout2send',
    ]
    known_elements = [
        factory.get_name() for factory in
        gst.registry_get_default().get_feature_list(gst.TYPE_ELEMENT_FACTORY)
    ]
    return [(element, element in known_elements)
            for element in elements_to_check]
Esempio n. 39
0
    def __init__(self):

        self.gst_registry = gst.registry_get_default()
        all_effects = self.gst_registry.get_feature_list(gst.ElementFactory)
        self.registry = {}
        self.registry[MEDIA_VIDEO] = self._register_filter(
            all_effects, "Filter/Effect/Video"
        )
        self.registry[MEDIA_VIDEO] += self._register_filter(
            all_effects, "Filter/Video"
        )
        self.registry[MEDIA_AUDIO] = self._register_filter(
            all_effects, "Filter/Effect/Audio"
        )
Esempio n. 40
0
def _gstreamer_check_elements():
    elements_to_check = [
        # Core playback
        'uridecodebin',

        # External HTTP streams
        'souphttpsrc',

        # Spotify
        'appsrc',

        # Mixers and sinks
        'alsamixer',
        'alsasink',
        'ossmixer',
        'osssink',
        'oss4mixer',
        'oss4sink',
        'pulsemixer',
        'pulsesink',

        # MP3 encoding and decoding
        'mp3parse',
        'mad',
        'id3demux',
        'id3v2mux',
        'lame',

        # Ogg Vorbis encoding and decoding
        'vorbisdec',
        'vorbisenc',
        'vorbisparse',
        'oggdemux',
        'oggmux',
        'oggparse',

        # Flac decoding
        'flacdec',
        'flacparse',

        # Shoutcast output
        'shout2send',
    ]
    known_elements = [
        factory.get_name() for factory in
        gst.registry_get_default().get_feature_list(gst.TYPE_ELEMENT_FACTORY)
    ]
    return [(element, element in known_elements)
            for element in elements_to_check]
Esempio n. 41
0
def _gstreamer_check_elements():
    elements_to_check = [
        # Core playback
        'uridecodebin',

        # External HTTP streams
        'souphttpsrc',

        # Spotify
        'appsrc',

        # Audio sinks
        'alsasink',
        'osssink',
        'oss4sink',
        'pulsesink',

        # MP3 encoding and decoding
        #
        # One of flump3dec, mad, and mpg123audiodec is required for MP3
        # playback.
        'flump3dec',
        'id3demux',
        'id3v2mux',
        'lame',
        'mad',
        'mp3parse',
        # 'mpg123audiodec',  # Only available in GStreamer 1.x

        # Ogg Vorbis encoding and decoding
        'vorbisdec',
        'vorbisenc',
        'vorbisparse',
        'oggdemux',
        'oggmux',
        'oggparse',

        # Flac decoding
        'flacdec',
        'flacparse',

        # Shoutcast output
        'shout2send',
    ]
    known_elements = [
        factory.get_name() for factory in
        gst.registry_get_default().get_feature_list(gst.TYPE_ELEMENT_FACTORY)]
    return [
        (element, element in known_elements) for element in elements_to_check]
def get_audio_encoder_element(audioencodercaps):
    """
   Check all audio encoders for their caps and create a dictionary 
   mapping caps to element names, only using the highest ranked element
   for each unique caps value. The input of the function is the unique caps
   and it returns the elementname. If the caps to not exist in dictionary it
   will return False.
   """

    flist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
    encoders = []
    features = []
    elementname = False
    for fact in flist:
        if list_compat(["Codec", "Encoder", "Audio"], fact.get_klass().split("/")):
            # excluding wavpackenc as the fact that it got two SRC pads mess up
            # the logic of this code
            if fact.get_name() != "wavpackenc":
                encoders.append(fact.get_name())
                features.append(fact)
    encoderfeature = dict(zip(encoders, features))
    incomingcaps = audioencodercaps
    for x in encoders:
        element = x
        factory = gst.registry_get_default().lookup_feature(str(x))
        sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() if x.direction == gst.PAD_SRC]
        for caps in sinkcaps:
            if caps.intersect(incomingcaps):
                if elementname == False:
                    elementname = element
                else:
                    mostrecent = gst.PluginFeature.get_rank(encoderfeature[element])
                    original = gst.PluginFeature.get_rank(encoderfeature[elementname])
                    if mostrecent >= original:
                        elementname = element
    return elementname
Esempio n. 43
0
def available_video_encoders():
   """ returns all available video encoders """
   flist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
   res = []
   for fact in flist:
       if list_compat(["Codec", "Encoder", "Video"], fact.get_klass().split('/')):
           if fact.get_name() != 'ffenc_libtheora':
               res.append(fact.get_name())
           elif 'theoraenc' in res:
               print "adding nothing"
           else:
               res.append(fact.get_name()) 
       elif list_compat(["Codec", "Encoder", "Image"], fact.get_klass().split('/')):
           res.append(fact.get_name())
   return res 
Esempio n. 44
0
def _gstreamer_check_elements():
    elements_to_check = [
        # Core playback
        'uridecodebin',

        # External HTTP streams
        'souphttpsrc',

        # Spotify
        'appsrc',

        # Mixers and sinks
        'alsamixer',
        'alsasink',
        'ossmixer',
        'osssink',
        'oss4mixer',
        'oss4sink',
        'pulsemixer',
        'pulsesink',

        # MP3 encoding and decoding
        'mp3parse',
        'mad',
        'id3demux',
        'id3v2mux',
        'lame',

        # Ogg Vorbis encoding and decoding
        'vorbisdec',
        'vorbisenc',
        'vorbisparse',
        'oggdemux',
        'oggmux',
        'oggparse',

        # Flac decoding
        'flacdec',
        'flacparse',

        # Shoutcast output
        'shout2send',
    ]
    known_elements = [
        factory.get_name() for factory in
        gst.registry_get_default().get_feature_list(gst.TYPE_ELEMENT_FACTORY)]
    return [
        (element, element in known_elements) for element in elements_to_check]
Esempio n. 45
0
 def _getSortedFactoryList(self):
     """
     Returns the list of demuxers, decoders and parsers available, sorted
     by rank
     """
     def myfilter(fact):
         if fact.get_rank() < 64 :
             return False
         klass = fact.get_klass()
         if not ("Demuxer" in klass or "Decoder" in klass or "Parse" in klass):
             return False
         return True
     reg = gst.registry_get_default()
     res = [x for x in reg.get_feature_list(gst.ElementFactory) if myfilter(x)]
     res.sort(lambda a, b: int(b.get_rank() - a.get_rank()))
     return res
Esempio n. 46
0
def get_plugin_version(plugin_name):
    """
    Find the version of the given plugin.

    @rtype: tuple of (major, minor, micro, nano), or None if it could not be
            found or determined
    """
    plugin = gst.registry_get_default().find_plugin(plugin_name)

    if not plugin:
        return None

    versionTuple = tuple([int(x) for x in plugin.get_version().split('.')])
    if len(versionTuple) < 4:
        versionTuple = versionTuple + (0, )
    return versionTuple
Esempio n. 47
0
def supported_uri_schemes(uri_schemes):
    """Determine which URIs we can actually support from provided whitelist.

    :param uri_schemes: list/set of URIs to check support for.
    :type uri_schemes: list or set or URI schemes as strings.
    :rtype: set of URI schemes we can support via this GStreamer install.
    """
    supported_schemes = set()
    registry = gst.registry_get_default()

    for factory in registry.get_feature_list(gst.TYPE_ELEMENT_FACTORY):
        for uri in factory.get_uri_protocols():
            if uri in uri_schemes:
                supported_schemes.add(uri)

    return supported_schemes
Esempio n. 48
0
    def __init__(self, parent):
        self.__parent = parent

        self.freeze_messages = threading.Event()

        # Collect a set of possible mixers to use
        found_mixers = set()
        for f in gst.registry_get_default().get_feature_list(
                gst.ElementFactory):
            if f.get_name().endswith(
                    "mixer") and f.get_klass() == "Generic/Audio":
                found_mixers.add(f.get_name())

        # Only keep certain names and sort it in order of mixer_names' order
        useable_mixers = [i for i in mixer_names if i in found_mixers]

        if len(useable_mixers) == 0:
            parent.applet.errors.general(
                (_("No GStreamer mixer found"),
                 no_mixer_message % ", ".join(mixer_names)))
            raise BackendError("No GStreamer mixer found")

        mixer_devices = self.find_mixer_and_devices(useable_mixers)

        if mixer_devices is None:
            parent.applet.errors.general(
                (_("No devices found"), no_devices_message))
            raise BackendError("No devices found")

        self.__mixer, self.__devices = mixer_devices

        # Prefer PulseAudio's volume control when using GStreamer mixer element pulsemixer
        if self.__mixer.get_factory().get_name() == "pulsemixer":
            volume_control_apps.insert(0, pa_control_app)

        # Set-up the necessary mechanism to receive volume/mute change updates
        self.__mixer.set_state(gst.STATE_READY)
        if self.__mixer.get_mixer_flags(
        ) & gst.interfaces.MIXER_FLAG_AUTO_NOTIFICATIONS:
            bus = gst.Bus()
            bus.add_signal_watch()
            bus.connect("message::element", self.message_element_cb)
            self.__mixer.set_bus(bus)
        else:
            parent.applet.timing.register(parent.refresh_icon,
                                          read_volume_interval)
        self.__mixer.set_state(gst.STATE_NULL)
Esempio n. 49
0
File: auto.py Progetto: xim/mopidy
    def _find_mixer(self):
        registry = gst.registry_get_default()

        factories = registry.get_feature_list(gst.TYPE_ELEMENT_FACTORY)
        factories.sort(key=lambda f: (-f.get_rank(), f.get_name()))

        for factory in factories:
            # Avoid sink/srcs that implement mixing.
            if factory.get_klass() != 'Generic/Audio':
                continue
            # Avoid anything that doesn't implement mixing.
            elif not factory.has_interface('GstMixer'):
                continue

            if self._test_mixer(factory):
                return factory.create()

        return None
Esempio n. 50
0
    def test(self):

        # here to avoid import gst eating our options
        import gst

        plugin = gst.registry_get_default().find_plugin('flac')
        if not plugin:
            print 'ERROR: cannot find flac plugin'
            return False

        versionTuple = tuple([int(x) for x in plugin.get_version().split('.')])
        if len(versionTuple) < 4:
            versionTuple = versionTuple + (0, )
        if versionTuple > (0, 10, 9, 0) and versionTuple <= (0, 10, 15, 0):
            print 'ERROR: flacenc between 0.10.9 and 0.10.15 has a bug'
            return False

        return True
Esempio n. 51
0
	def OnCheckEncoders(self):
		"""
		List the available encoders installed on the computer.
		This code is not currently used, but is still here as it may 
		be useful in the future.
		"""

		gstfeatures = gst.registry_get_default().get_feature_list(gst.ElementFactory)
		encoders = []
		for feature in gstfeatures:
			if "Codec/Encoder/Audio" in feature.get_klass():
				encoders.append(feature)
		gst.log(str(encoders))

		# these encoders are not actually hooked up yet - we will most likely
		# need to use enc.get_short_name() to return the element to include in
		# the pipeline
		
		for enc in encoders:
			self.mixdownFormat.append_text(enc.get_longname())
def output_plugin(plugin, indent=0):
    print "PLUGIN", plugin.get_name()
    version = plugin.get_version()
    
    elements = {}
    gst.debug('getting features for plugin %s' % plugin.get_name())
    registry = gst.registry_get_default()
    features = registry.get_feature_list_by_plugin(plugin.get_name())
    gst.debug('plugin %s has %d features' % (plugin.get_name(), len(features)))
    for feature in features:
        if isinstance(feature, gst.ElementFactory):
            elements[feature.get_name()] = feature
    #gst.debug("got features")
        
    elementsoutput = []
    keys = elements.keys()
    keys.sort()
    for name in keys:
        feature = elements[name]
        elementsoutput.append(output_element_factory(feature, indent + 2))

    filename = plugin.get_filename()
    basename = filename
    if basename:
        basename = os.path.basename(basename)
    d = {
        'name':        xmlencode(plugin.get_name()),
        'description': xmlencode(plugin.get_description()),
        'filename':    filename,
        'basename':    basename,
        'version':     version,
        'license':     xmlencode(plugin.get_license()),
        'source':      xmlencode(plugin.get_source()),
        'package':     xmlencode(plugin.get_package()),
        'origin':      xmlencode(plugin.get_origin()),
        'elements': "\n".join(elementsoutput),
    }
    block = PLUGIN_TEMPLATE % d
    
    offset = get_offset(indent)
    return offset + ("\n" + offset).join(block.split("\n"))
Esempio n. 53
0
def make_browser():
    def get_data(w, context, s_d, info, time):
        row = w.get_cursor()[0][0]
        s_d.set(s_d.target, 8, treemodel[row][1])

    # get list of all elements
    registry = gst.registry_get_default()
    registrylist = registry.get_feature_list(gst.ElementFactory)
    registrylist.sort(lambda x, y: cmp(x.get_name(), y.get_name()))

    # create a tree view to display them
    treemodel = gtk.TreeStore(gobject.TYPE_PYOBJECT, gobject.TYPE_STRING)
    for item in registrylist:
        treemodel.append(None, [item, item.get_name()])
    treeview = gtk.TreeView()
    treeview.set_model(treemodel)
    renderer = gtk.CellRendererText()
    column = gtk.TreeViewColumn("Element", renderer, text=1)
    treeview.append_column(column)
    treeview.set_size_request(100, 100)
    treeview.drag_source_set(gtk.gdk.BUTTON1_MASK, target, gtk.gdk.ACTION_COPY)
    treeview.connect('drag_data_get', get_data)
    return scrolled(treeview)
Esempio n. 54
0
def removeAudioParsers():
    log.debug('gstreamer', 'Removing buggy audioparsers plugin if needed')

    import gst
    registry = gst.registry_get_default()

    plugin = registry.find_plugin("audioparsersbad")
    if plugin:
        # always remove from bad
        log.debug('gstreamer', 'removing audioparsersbad plugin from registry')
        registry.remove_plugin(plugin)

    plugin = registry.find_plugin("audioparsers")
    if plugin:
        log.debug('gstreamer', 'Found audioparsers plugin from %s %s',
                  plugin.get_source(), plugin.get_version())

        # was fixed after 0.10.30 and before 0.10.31
        if plugin.get_source() == 'gst-plugins-good' \
            and plugin.get_version() > '0.10.30.1':
            return

        registry.remove_plugin(plugin)
def main():
    if len(sys.argv) == 1:
        sys.stderr.write("Please specify a source module to inspect")
        sys.exit(1)
    source = sys.argv[1]

    if len(sys.argv) > 2:
        os.chdir(sys.argv[2])

    registry = gst.registry_get_default()
    all = registry.get_plugin_list()
    for plugin in all:
        gst.debug("inspecting plugin %s from source %s" % (
            plugin.get_name(), plugin.get_source()))
        # this skips gstcoreelements, with bin and pipeline
        if plugin.get_filename() is None:
            continue
        if plugin.get_source() != source:
            continue

        filename = "plugin-%s.xml" % plugin.get_name()
        handle = open(filename, "w")
        handle.write(output_plugin(plugin))
        handle.close()