audio: Give the BassPlayer signals for eos and about-to-finish
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
e467b784e4
commit
08696dd17a
|
@ -11,17 +11,25 @@ class BassPlayer(GObject.GObject):
|
|||
|
||||
self.video = Gst.ElementFactory.make("fakesink")
|
||||
self.playbin = Gst.ElementFactory.make("playbin")
|
||||
self.playbin.connect("about-to-finish", self.__about_to_finish__)
|
||||
self.playbin.set_property("video-sink", self.video)
|
||||
self.playbin.set_property("volume", lib.settings.get_float("audio.volume"))
|
||||
self.playbin.set_state(Gst.State.READY)
|
||||
|
||||
self.bus.add_signal_watch()
|
||||
self.bus.connect("message::eos", self.__eos__)
|
||||
self.bus.connect("message::state-changed", self.state_changed)
|
||||
self.bus.connect("message::stream-start", self.stream_start)
|
||||
self.bus.connect("message::state-changed", self.state_changed)
|
||||
|
||||
self.timeout = None
|
||||
|
||||
def __about_to_finish__(self, playbin):
|
||||
self.emit("about-to-finish")
|
||||
|
||||
def __eos__(self, bus, message):
|
||||
self.emit("eos")
|
||||
|
||||
@GObject.Property
|
||||
def bus(self):
|
||||
return self.playbin.get_bus()
|
||||
|
@ -79,6 +87,9 @@ class BassPlayer(GObject.GObject):
|
|||
self.playbin.set_property("volume", vol)
|
||||
lib.settings.set("audio.volume", vol)
|
||||
|
||||
def about_to_finish(self, playbin):
|
||||
pass
|
||||
|
||||
def state_changed(self, bus, message):
|
||||
if message.src == self.playbin:
|
||||
(old, new, pending) = message.parse_state_changed()
|
||||
|
@ -94,10 +105,18 @@ class BassPlayer(GObject.GObject):
|
|||
self.emit("position-changed")
|
||||
return GLib.SOURCE_CONTINUE
|
||||
|
||||
@GObject.Signal
|
||||
def about_to_finish(self):
|
||||
pass
|
||||
|
||||
@GObject.Signal
|
||||
def duration_changed(self):
|
||||
pass
|
||||
|
||||
@GObject.Signal
|
||||
def eos(self):
|
||||
pass
|
||||
|
||||
@GObject.Signal
|
||||
def playback_start(self):
|
||||
if not self.timeout:
|
||||
|
|
Loading…
Reference in New Issue