def start()

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


    def start(self, loop=None):
        '''
        Sets pipeline to the playing state
        '''
        logger.info("Starting %s (%s)..." % (self.__class__.__name__, self.config["id"]))
        bus = self.pipeline.get_bus()
        bus.add_watch(0, self.on_message, (self.pipeline, self.loop if loop is None else loop))

        # Set pipeline state to playing
        self.pipeline.set_state(Gst.State.PLAYING)

        # Check the state
        if not self.graph.contains_plugin(["appsrc", "appsink"]):
            logger.info(self.pipeline.get_state(Gst.CLOCK_TIME_NONE))
            if self.pipeline.get_state(Gst.CLOCK_TIME_NONE)[0] != Gst.StateChangeReturn.SUCCESS:
                logger.error("Failed to set the pipeline to the playing state")
                return

        # Create timer for end of stream
        if self.config.isSet("timeout"):
            delay = datetime.timedelta(seconds=self.config.get("timeout")).total_seconds()
            Timer(delay, self.send_eos, args=(self.pipeline,)).start()

        if loop is None:
            # Start the main loop, blocking call
            self.loop.run()

            # This will be called after main loop has ended
            self.pipeline.set_state(Gst.State.NULL)