pygst: The "about-to-finish" event fails to play next song (gapless playing) in Python

Eduardo Matus ematus at gmail.com
Tue Dec 20 14:06:38 PST 2011


Did you try firts to stop or set to ready the pipeline, then set the
filename an play?
El 20/12/2011 18:05, "Ralph Heinkel" <ralph.heinkel at web.de> escribió:

>  Hi Eduardo,
> so according to your hint I changed the method to
>
>    def about_to_finish(self, player):
>        player.set_property("uri", self.filename)
>        player.set_state(gst.STATE_PLAYING)
>
> but unfortunately this did not help, it still only plays the first song. I
> also tried to set the state first to STATE_NULL but then I got a lengthy
> error message that this is not allowed from within the event thread, and
> the whole thing went down with a segmentation fault.
>
> Ralph
>
> On 20.12.11 21:18, Eduardo Matus wrote:
>
> You have to set the pipeline state to playing again
>
> On Tue, Dec 20, 2011 at 1:57 PM, Ralph Heinkel <ralph.heinkel at web.de>wrote:
>
>> Hi,
>> following code ("stolen" from eurion.net...) does not replay the same
>> song (or any other song) set in about_to_finish() event callback method.
>> The event method is entered (verified by temporarily added print
>> statements), but the player just stops after playing the first song.
>>
>> I'm using (opensuse 12.1) linux, gstreamer 0.10.35, gst-python 0.10.22
>>
>> Am I missing anything? Any help would be appreciated.
>>
>> Thanks,
>>
>> Ralph
>>
>> ------------------------------------------
>> #!/usr/bin/python
>> # code from
>> http://www.eurion.net/python-snippets/snippet/Gapless%20playback.html
>> import pygst
>> pygst.require("0.10")
>> import gst, sys, gobject
>>
>> class Player:
>>    def __init__(self, filename):
>>        self.filename = filename
>>        self.player = gst.element_factory_make("playbin2", "player")
>>        self.player.set_property("uri", filename)
>>        self.player.connect("about-to-finish", self.about_to_finish)
>>
>>    def run(self):
>>        self.player.set_state(gst.STATE_PLAYING)
>>        loop = gobject.MainLoop()
>>        loop.run()
>>
>>    def about_to_finish(self, player):
>>        player.set_property("uri", self.filename)
>>
>> if __name__ == "__main__":
>>    gobject.threads_init()
>>    player = Player("file:///path/to/song.ogg")
>>    player.run()
>>
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>
>
>
>  --
> Eduardo Matus Coquelet
> Ingeniero Civil Informático y Telecomunicaciones.
> Celular: 77113825
>
>
> _______________________________________________
> gstreamer-devel mailing listgstreamer-devel at lists.freedesktop.orghttp://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111220/e53d46bb/attachment.html>


More information about the gstreamer-devel mailing list