Example #1
0
 def on_message(self, bus, message):
     t = message.type
     if t == Gst.MESSAGE_EOS:
         self.eos()
     elif t == Gst.MESSAGE_ERROR:
         myGtk.show_error("Gstreamer error: %s - %s" %
                          message.parse_error())
Example #2
0
    def __init__(self, sink):
        Gst.Pipeline.__init__(self)
        self.playbin = Gst.ElementFactory.make("playbin")
        self.add(self.playbin)

        bin = Gst.Bin()
        self.speedchanger = Gst.ElementFactory.make("pitch")
        if self.speedchanger is None:
            myGtk.show_error(
                _("You need to install the Gstreamer soundtouch elements for "
                  "play it slowly to. They are part of Gstreamer-plugins-bad. Consult the "
                  "README if you need more information.")).run()
            raise SystemExit()

        bin.add(self.speedchanger)

        self.audiosink = Gst.parse_launch(sink)
        #self.audiosink = Gst.ElementFactory.make(sink, "sink")

        bin.add(self.audiosink)
        convert = Gst.ElementFactory.make("audioconvert")
        bin.add(convert)
        self.speedchanger.link(convert)
        convert.link(self.audiosink)
        sink_pad = Gst.GhostPad.new("sink",
                                    self.speedchanger.get_static_pad("sink"))
        bin.add_pad(sink_pad)
        self.playbin.set_property("audio-sink", bin)
        #bus = self.playbin.get_bus()
        #bus.add_signal_watch()
        #bus.connect("message", self.on_message)

        self.eos = lambda: None
Example #3
0
    def __init__(self, sink):
        Gst.Pipeline.__init__(self)
        self.playbin = Gst.ElementFactory.make("playbin")
        self.add(self.playbin)

        bin = Gst.Bin()
        self.speedchanger = Gst.ElementFactory.make("pitch")
        if self.speedchanger is None:
            myGtk.show_error(_("You need to install the Gstreamer soundtouch elements for "
                    "play it slowly to. They are part of Gstreamer-plugins-bad. Consult the "
                    "README if you need more information.")).run()
            raise SystemExit()

        bin.add(self.speedchanger)

        self.audiosink = Gst.parse_launch(sink)
        #self.audiosink = Gst.ElementFactory.make(sink, "sink")

        bin.add(self.audiosink)
        convert = Gst.ElementFactory.make("audioconvert")
        bin.add(convert)
        self.speedchanger.link(convert)
        convert.link(self.audiosink)
        sink_pad = Gst.GhostPad.new("sink", self.speedchanger.get_static_pad("sink"))
        bin.add_pad(sink_pad)
        self.playbin.set_property("audio-sink", bin)
        #bus = self.playbin.get_bus()
        #bus.add_signal_watch()
        #bus.connect("message", self.on_message)

        self.eos = lambda: None
Example #4
0
 def on_message(self, bus, message):
     t = message.type
     if t == Gst.MESSAGE_EOS:
         self.eos()
     elif t == Gst.MESSAGE_ERROR:
         myGtk.show_error("Gstreamer error: %s - %s" % message.parse_error())