Hi Sander,<br><br>Try setting the state to GST_STATE_READY instead of
GST_STATE_NULL before changing the "location". I am not sure if this is
recommended but it had worked for me sometime back.<br><br>regards<br>
Mohit<br><br>Personal Homepage: <a href="http://mohitgarg.vectorstar.net/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://mohitgarg.vectorstar.net</a><br>Social Work: <a href="http://www.noragging.com/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.noragging.com</a><br><br><div><span class="gmail_quote">On 9/12/07, <b class="gmail_sendername">Sander Marechal</b> <<a href="mailto:s.marechal@jejik.com">s.marechal@jejik.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello all,<br><br>I have been trying for a long time now to get a simple player working<br>that can play through a playlist and obey a simple "next" command,<br>without setting the pipeline to STATE_NULL (because in the final
<br>version, the output will be a shout2send sink[1])<br><br>I've written a simplified, minimal version of my player, but I can't<br>even get that to work :-( I always get gstreamer errors when I switch to<br>the next song, and usually output stops alltogether. Or it hangs.
<br><br>I have attached my minimal player below. When you run it, simply typing<br>"next" and hitting return should start playing the next song. I'm<br>probably doing something fundamentally wrong here.<br><br>
I haven't been able to find any examples online that implement something<br>similar. It's either gstreamer tutorials that do "set STATE_NULL, change<br>location on filesrc, set STATE_PLAYING" or trying to comprehend the
<br>source of advanced players/managers that do quite complicated stuff with<br>pipelines that I really don't understand.<br><br>Could someone point out to me what I'm doing wrong?<br><br>Thanks in advance,<br><br>
--<br>Sander Marechal<br><br>[1] When a pipeline goes to STATE_NULL, the shout2send will unmount the<br>stream from icecast and all the icecast listeners get disconnected.<br><br>playlist.py:<br>============<br>#!/usr/bin/env python
<br><br>import pygst, gobject, time, sys<br>pygst.require("0.10")<br>import gst<br><br>class AudioPlayer:<br> def __init__(self):<br> self.songs = [<br> 'music/Ozzy/Mr.
Tinkertrain.mp3',<br> 'music/Ozzy/I Don\'t Want to Change the World.mp3',<br> 'music/Ozzy/Mama, I\'m Coming Home.mp3 ',<br> 'music/Ozzy/Desire.mp3',
<br> 'music/Ozzy/No More Tears.mp3 ',<br> 'music/Ozzy/S.I.N..mp3',<br> 'music/Ozzy/Hellraiser.mp3',<br> ]<br><br>
# create a new gstreamer pipeline<br> self.pipeline = gst.Pipeline("mypipeline")<br><br> # add a file source to the pipeline<br> self.filesrc = gst.element_factory_make
("filesrc", "source")<br> self.pipeline.add(self.filesrc)<br><br> # add a generic decoder to the pipeline and link it to the source<br> self.decode = gst.element_factory_make
("decodebin", "decode")<br> self.decode.connect("new-decoded-pad", self.decode_link)<br> self.pipeline.add(self.decode)<br> self.filesrc.link(self.decode
)<br><br> # add a convertor to the pipeline<br> self.convert = gst.element_factory_make("audioconvert", "convert")<br> self.pipeline.add(self.convert)<br><br>
# add an alsa sink to the pipeline and link it to the convertor<br> self.sink = gst.element_factory_make("alsasink", "sink")<br> self.pipeline.add(self.sink
)<br> self.convert.link(self.sink)<br><br> # start playing<br> self.filesrc.set_property("location", self.songs.pop(0))<br> self.pipeline.set_state(gst.STATE_PLAYING
)<br><br> def decode_link(self, dbin, pad, islast):<br> pad.link(self.convert.get_pad("sink"))<br><br> def next(self):<br> self.convert.unlink(self.sink)<br>
self.filesrc.set_state(gst.STATE_NULL)<br> self.filesrc.set_property("location", self.songs.pop(0))<br> self.convert.link(self.sink)<br> self.pipeline.set_state(gst.STATE_PLAYING
)<br> return True<br><br>player = AudioPlayer()<br>loop = gobject.MainLoop()<br>gobject.threads_init()<br>context = loop.get_context()<br><br>while 1:<br> value = sys.stdin.readline()<br> if value == "next\n":
<br> player.next()<br> context.iteration(True)<br><br>-------------------------------------------------------------------------<br>This SF.net email is sponsored by: Microsoft<br>Defy all challenges. Microsoft(R) Visual Studio 2005.
<br><a href="http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/">http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/</a><br>_______________________________________________<br>gstreamer-devel mailing list<br><a href="mailto:gstreamer-devel@lists.sourceforge.net">
gstreamer-devel@lists.sourceforge.net</a><br><a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br></blockquote></div>