def get_gst_launch_str()

in awstreamer/gst_pipeline/stream_graph.py [0:0]


    def get_gst_launch_str(self, config=dict(), parse_launch=False):
        '''
        Returns gst-launch-1.0 string to use with command line or Gst.parse_launch()
        '''
        gst_launch_str = ""
        first = True
        tee = None
        for k,v in self.items():
            if not v.enabled:
                continue

            # Separator
            sep = " " if first else " ! "
            gst_launch_str += sep
            first = False

            # Next plug-in
            if v.factory_name != "capsfilter":
                gst_launch_str += v.factory_name

            # Plug-in's parameters
            plugin = self[k]
            config_params = config[k] if k in config else {}

            if plugin is None:
                # For dummy plug-ins, we just assume that what's in config is going to the params,
                # as there is no plug-in instance (yet), no cross-check
                for p,q in config_params.items():
                    prefix = " "
                    if p != "caps":
                        prefix += p + "="
                    decorator = "'" if not parse_launch and p == "caps" else ""
                    gst_launch_str += prefix + decorator + str(q) + decorator
            else:
                props = plugin.list_properties()
                for p in props:
                    if p.name == "name":
                        if v.factory_name == "tee":
                            tee = plugin.get_property(p.name)
                            gst_launch_str += " name=" + tee
                        continue
                    if p.name in config_params:
                        prefix = " "
                        if p.name != "caps":
                            prefix += p.name + "="
                        decorator = "'" if not parse_launch and p.name == "caps" else ""
                        gst_launch_str += prefix + decorator + str(config_params[p.name]) + decorator

            if v.linkable is None and tee is not None:
                gst_launch_str += " %s." % tee

        return gst_launch_str.strip()