<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hello all, I am new to gstreamer python and was hoping I could get some help with playbin2 and a custom bin. I am trying to get the audio stream over http, play it with my player and at the same time save each song to a file.</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">I am able to play the audio stream with playbin2 alone, but when I add in the code to save to disk, things break. The player no longer plays the audio, I see files are created with 0 bytes, and this is outputted:</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px;
font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">ERROR:root:Gstreamer error: Internal GStreamer error: pad problem. Please file a bug at http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer., gstplaysink.c(1894): gen_audio_chain (): /GstPlayBin2:player/GstPlaySink:playsink0:<br>Failed to configure the audio sink., 5<br></div><br>This thread suggests that I create a Tee and a queue, and attaching that to the playbin2's audio-sink, which I have attempted:<br>http://gstreamer-devel.966125.n4.nabble.com/Help-building-a-pipeline-td1750151.html<br><br>This thread suggests that I need to create caps, but it is still unclear to me how to set that up with playbin2.<br>http://gstreamer-devel.966125.n4.nabble.com/gstreamer-python-and-playbin-td973524.html<br><br>What I am hoping to accomplish is to play the file using my wxPython player, and at the same time it would download that song to the
disk. I believe the audio files are in mp4 or m4a (although I'm not sure what the difference is) format.<br><br>Some of the code has been taken from here:<div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">http://pygstdocs.berlios.de/pygst-tutorial/playbin.html</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Here are the parts I have added:</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new
york,times,serif; background-color: transparent; font-style: normal;"> def __init__(self):<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"> # setup<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"> self.player = gst.element_factory_make("playbin2", "player")<br> bus = self.player.get_bus()<br> bus.add_signal_watch()<br> bus.connect("message::buffering", self.do_buffering)<br> self.time_format = gst.Format(gst.FORMAT_TIME)<br></div><div style="color: rgb(0, 0, 0);
font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"> self.abin = gst.Bin("audiofilebin")<br> self.audiosink = gst.element_factory_make('filesink', 'audiosink')<br> self.tee = gst.element_factory_make('tee', 'tee')<br> self.queue = gst.element_factory_make('queue', 'queue')<br><br> self.abin.add(self.tee)<br> self.abin.add(self.queue)<br> self.abin.add(self.audiosink)<br><br>
self.player.set_property('audio-sink', self.abin)</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">.........<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"> def on_play(self, songTitle, songURL):</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"> self.player.set_property("uri", songURL)<br>
self.audiosink.set_property('location', songTitle)<br> self.player.set_state(gst.STATE_PLAYING)<br><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Any help is appreciated!<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0);
font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><br></div></div></body></html>