playbin2 problems with custom audio-sink bin

Valey Carmid valeycarmid at yahoo.com
Sun Dec 2 11:22:52 PST 2012


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.

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:

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:
Failed to configure the audio sink., 5

This thread suggests that I create a Tee and a queue,  and attaching that to the playbin2's audio-sink, which I have attempted:
http://gstreamer-devel.966125.n4.nabble.com/Help-building-a-pipeline-td1750151.html

This thread suggests that I need to create caps, but it is still unclear to me how to set that up with playbin2.
http://gstreamer-devel.966125.n4.nabble.com/gstreamer-python-and-playbin-td973524.html

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.

Some of the code has been taken from here:
http://pygstdocs.berlios.de/pygst-tutorial/playbin.html

Here are the parts I have added:

   def __init__(self):

        # setup

        self.player = gst.element_factory_make("playbin2", "player")
        bus = self.player.get_bus()
        bus.add_signal_watch()
        bus.connect("message::buffering", self.do_buffering)
        self.time_format = gst.Format(gst.FORMAT_TIME)


        self.abin = gst.Bin("audiofilebin")
        self.audiosink = gst.element_factory_make('filesink', 'audiosink')
        self.tee = gst.element_factory_make('tee', 'tee')
        self.queue = gst.element_factory_make('queue', 'queue')

        self.abin.add(self.tee)
        self.abin.add(self.queue)
        self.abin.add(self.audiosink)

        self.player.set_property('audio-sink', self.abin)

.........

       def on_play(self, songTitle, songURL):
                      self.player.set_property("uri", songURL)
                      self.audiosink.set_property('location', songTitle)
                      self.player.set_state(gst.STATE_PLAYING)



Any help is appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20121202/6fd39706/attachment.html>


More information about the gstreamer-devel mailing list