From: Guillaume Pellerin Date: Mon, 22 Jul 2013 23:35:32 +0000 (+0200) Subject: add uri update X-Git-Tag: 0.3~37 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=18dd4e4634fd770a3561fa3597f9f71901de12a2;p=piplayer.git add uri update --- diff --git a/audio_player_osc.py b/audio_player_osc.py index ec6d6f3..6310dc5 100644 --- a/audio_player_osc.py +++ b/audio_player_osc.py @@ -22,7 +22,6 @@ # Boston, MA 02111-1307, USA. - import gobject gobject.threads_init() import pygst @@ -61,7 +60,7 @@ class AudioPlayer(Thread): # The controller self.controller = OSCController(12345) - self.controller.add_method('/play', 'i', self.play_stop_cb) + self.controller.add_method('/play', 'i', self.play_stop) self.controller.start() # The pipeline @@ -99,7 +98,6 @@ class AudioPlayer(Thread): # The MainLoop self.mainloop = gobject.MainLoop() - def on_pad_added(self, element, pad): caps = pad.get_caps() name = caps[0].get_name() @@ -124,14 +122,18 @@ class AudioPlayer(Thread): print 'on_error:', error[1] self.mainloop.quit() - def play_stop_cb(self, path, value): + def play_stop(self, path, value): value = value[0] if value: self.pipeline.set_state(gst.STATE_NULL) self.pipeline.set_state(gst.STATE_PLAYING) else: self.pipeline.set_state(gst.STATE_NULL) - + + def update_uri(uri): + self.uri = uri + self.srcdec.set_property('uri', self.uri) + def run(self): self.mainloop.run() diff --git a/guitar.wav b/guitar.wav new file mode 100644 index 0000000..b5a9e80 Binary files /dev/null and b/guitar.wav differ